Merge pull request #996 from Ebag333/PreferencesPaneV2
Preferences Pane V4
This commit is contained in:
@@ -4,13 +4,18 @@ import gui.mainFrame
|
||||
import wx
|
||||
import gui.globalEvents as GE
|
||||
from service.fit import Fit
|
||||
from service.settings import ContextMenuSettings
|
||||
|
||||
|
||||
class AmmoPattern(ContextMenu):
|
||||
def __init__(self):
|
||||
self.mainFrame = gui.mainFrame.MainFrame.getInstance()
|
||||
self.settings = ContextMenuSettings.getInstance()
|
||||
|
||||
def display(self, srcContext, selection):
|
||||
if not self.settings.get('ammoPattern'):
|
||||
return False
|
||||
|
||||
if srcContext not in ("marketItemGroup", "marketItemMisc") or self.mainFrame.getActiveFit() is None:
|
||||
return False
|
||||
|
||||
|
||||
@@ -7,13 +7,18 @@ import wx
|
||||
from service.fit import Fit
|
||||
from eos.saveddata.cargo import Cargo as es_Cargo
|
||||
from eos.saveddata.fighter import Fighter as es_Fighter
|
||||
from service.settings import ContextMenuSettings
|
||||
|
||||
|
||||
class ChangeAmount(ContextMenu):
|
||||
def __init__(self):
|
||||
self.mainFrame = gui.mainFrame.MainFrame.getInstance()
|
||||
self.settings = ContextMenuSettings.getInstance()
|
||||
|
||||
def display(self, srcContext, selection):
|
||||
if not self.settings.get('amount'):
|
||||
return False
|
||||
|
||||
return srcContext in ("cargoItem", "projectedFit", "fighterItem", "projectedFighter")
|
||||
|
||||
def getText(self, itmContext, selection):
|
||||
|
||||
@@ -4,20 +4,28 @@ import gui.globalEvents as GE
|
||||
# noinspection PyPackageRequirements
|
||||
import wx
|
||||
from service.fit import Fit
|
||||
from service.settings import ContextMenuSettings
|
||||
|
||||
|
||||
class Cargo(ContextMenu):
|
||||
def __init__(self):
|
||||
self.mainFrame = gui.mainFrame.MainFrame.getInstance()
|
||||
self.settings = ContextMenuSettings.getInstance()
|
||||
|
||||
def display(self, srcContext, selection):
|
||||
if not self.settings.get('cargo'):
|
||||
return False
|
||||
|
||||
if srcContext not in ("marketItemGroup", "marketItemMisc"):
|
||||
return False
|
||||
|
||||
sFit = Fit.getInstance()
|
||||
fitID = self.mainFrame.getActiveFit()
|
||||
|
||||
fit = sFit.getFit(fitID)
|
||||
# Make sure context menu registers in the correct view
|
||||
if srcContext not in ("marketItemGroup", "marketItemMisc") or not fit or fit.isStructure:
|
||||
if not fit or fit.isStructure:
|
||||
return False
|
||||
|
||||
return True
|
||||
|
||||
def getText(self, itmContext, selection):
|
||||
|
||||
@@ -8,13 +8,18 @@ from eos.saveddata.character import Skill
|
||||
import gui.globalEvents as GE
|
||||
from service.fit import Fit
|
||||
from service.character import Character
|
||||
from service.settings import ContextMenuSettings
|
||||
|
||||
|
||||
class ChangeAffectingSkills(ContextMenu):
|
||||
def __init__(self):
|
||||
self.mainFrame = gui.mainFrame.MainFrame.getInstance()
|
||||
self.settings = ContextMenuSettings.getInstance()
|
||||
|
||||
def display(self, srcContext, selection):
|
||||
if not self.settings.get('changeAffectingSkills'):
|
||||
return False
|
||||
|
||||
if self.mainFrame.getActiveFit() is None or srcContext not in ("fittingModule", "fittingCharge", "fittingShip"):
|
||||
return False
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ import wx
|
||||
from gui.bitmapLoader import BitmapLoader
|
||||
from service.fit import Fit
|
||||
from service.damagePattern import DamagePattern as import_DamagePattern
|
||||
from service.settings import ContextMenuSettings
|
||||
|
||||
try:
|
||||
from collections import OrderedDict
|
||||
@@ -16,8 +17,12 @@ except ImportError:
|
||||
class DamagePattern(ContextMenu):
|
||||
def __init__(self):
|
||||
self.mainFrame = gui.mainFrame.MainFrame.getInstance()
|
||||
self.settings = ContextMenuSettings.getInstance()
|
||||
|
||||
def display(self, srcContext, selection):
|
||||
if not self.settings.get('damagePattern'):
|
||||
return False
|
||||
|
||||
return srcContext == "resistancesViewFull" and self.mainFrame.getActiveFit() is not None
|
||||
|
||||
def getText(self, itmContext, selection):
|
||||
|
||||
@@ -4,13 +4,18 @@ import gui.mainFrame
|
||||
import wx
|
||||
import gui.globalEvents as GE
|
||||
from service.fit import Fit
|
||||
from service.settings import ContextMenuSettings
|
||||
|
||||
|
||||
class ItemRemove(ContextMenu):
|
||||
def __init__(self):
|
||||
self.mainFrame = gui.mainFrame.MainFrame.getInstance()
|
||||
self.settings = ContextMenuSettings.getInstance()
|
||||
|
||||
def display(self, srcContext, selection):
|
||||
if not self.settings.get('droneRemoveStack'):
|
||||
return False
|
||||
|
||||
return srcContext == "droneItem"
|
||||
|
||||
def getText(self, itmContext, selection):
|
||||
|
||||
@@ -4,13 +4,18 @@ import gui.globalEvents as GE
|
||||
from service.fit import Fit
|
||||
# noinspection PyPackageRequirements
|
||||
import wx
|
||||
from service.settings import ContextMenuSettings
|
||||
|
||||
|
||||
class DroneSplit(ContextMenu):
|
||||
def __init__(self):
|
||||
self.mainFrame = gui.mainFrame.MainFrame.getInstance()
|
||||
self.settings = ContextMenuSettings.getInstance()
|
||||
|
||||
def display(self, srcContext, selection):
|
||||
if not self.settings.get('droneSplit'):
|
||||
return False
|
||||
|
||||
return srcContext in ("droneItem", "projectedDrone") and selection[0].amount > 1
|
||||
|
||||
def getText(self, itmContext, selection):
|
||||
|
||||
@@ -5,13 +5,18 @@ import gui.globalEvents as GE
|
||||
import wx
|
||||
from gui.bitmapLoader import BitmapLoader
|
||||
from service.fit import Fit
|
||||
from service.settings import ContextMenuSettings
|
||||
|
||||
|
||||
class FactorReload(ContextMenu):
|
||||
def __init__(self):
|
||||
self.mainFrame = gui.mainFrame.MainFrame.getInstance()
|
||||
self.settings = ContextMenuSettings.getInstance()
|
||||
|
||||
def display(self, srcContext, selection):
|
||||
if not self.settings.get('factorReload'):
|
||||
return False
|
||||
|
||||
return srcContext == "firepowerViewFull" and self.mainFrame.getActiveFit() is not None
|
||||
|
||||
def getText(self, itmContext, selection):
|
||||
|
||||
@@ -4,13 +4,18 @@ from gui.contextMenu import ContextMenu
|
||||
import gui.mainFrame
|
||||
import gui.globalEvents as GE
|
||||
from service.fit import Fit
|
||||
from service.settings import ContextMenuSettings
|
||||
|
||||
|
||||
class FighterAbility(ContextMenu):
|
||||
def __init__(self):
|
||||
self.mainFrame = gui.mainFrame.MainFrame.getInstance()
|
||||
self.settings = ContextMenuSettings.getInstance()
|
||||
|
||||
def display(self, srcContext, selection):
|
||||
if not self.settings.get('fighterAbilities'):
|
||||
return False
|
||||
|
||||
if self.mainFrame.getActiveFit() is None or srcContext not in ("fighterItem", "projectedFighter"):
|
||||
return False
|
||||
|
||||
|
||||
@@ -6,13 +6,18 @@ import wx
|
||||
from service.implantSet import ImplantSets as s_ImplantSets
|
||||
from service.character import Character
|
||||
from service.fit import Fit
|
||||
from service.settings import ContextMenuSettings
|
||||
|
||||
|
||||
class ImplantSets(ContextMenu):
|
||||
def __init__(self):
|
||||
self.mainFrame = gui.mainFrame.MainFrame.getInstance()
|
||||
self.settings = ContextMenuSettings.getInstance()
|
||||
|
||||
def display(self, srcContext, selection):
|
||||
if not self.settings.get('implantSets'):
|
||||
return False
|
||||
|
||||
return srcContext in ("implantView", "implantEditor")
|
||||
|
||||
def getText(self, itmContext, selection):
|
||||
|
||||
@@ -4,13 +4,18 @@ import gui.mainFrame
|
||||
import wx
|
||||
import gui.globalEvents as GE
|
||||
from service.fit import Fit
|
||||
from service.settings import ContextMenuSettings
|
||||
|
||||
|
||||
class ItemRemove(ContextMenu):
|
||||
def __init__(self):
|
||||
self.mainFrame = gui.mainFrame.MainFrame.getInstance()
|
||||
self.settings = ContextMenuSettings.getInstance()
|
||||
|
||||
def display(self, srcContext, selection):
|
||||
if not self.settings.get('itemRemove'):
|
||||
return False
|
||||
|
||||
return srcContext in ("fittingModule", "fittingCharge",
|
||||
"droneItem", "implantItem",
|
||||
"boosterItem", "projectedModule",
|
||||
|
||||
@@ -4,13 +4,17 @@ import gui.mainFrame
|
||||
# noinspection PyPackageRequirements
|
||||
import wx
|
||||
from service.fit import Fit
|
||||
from service.settings import ContextMenuSettings
|
||||
|
||||
|
||||
class ItemStats(ContextMenu):
|
||||
def __init__(self):
|
||||
self.mainFrame = gui.mainFrame.MainFrame.getInstance()
|
||||
self.settings = ContextMenuSettings.getInstance()
|
||||
|
||||
def display(self, srcContext, selection):
|
||||
if not self.settings.get('itemStats'):
|
||||
return False
|
||||
|
||||
return srcContext in ("marketItemGroup", "marketItemMisc",
|
||||
"fittingModule", "fittingCharge",
|
||||
|
||||
@@ -1,13 +1,18 @@
|
||||
from gui.contextMenu import ContextMenu
|
||||
import gui.mainFrame
|
||||
from service.market import Market
|
||||
from service.settings import ContextMenuSettings
|
||||
|
||||
|
||||
class MarketJump(ContextMenu):
|
||||
def __init__(self):
|
||||
self.mainFrame = gui.mainFrame.MainFrame.getInstance()
|
||||
self.settings = ContextMenuSettings.getInstance()
|
||||
|
||||
def display(self, srcContext, selection):
|
||||
if not self.settings.get('marketJump'):
|
||||
return False
|
||||
|
||||
validContexts = ("marketItemMisc", "fittingModule",
|
||||
"fittingCharge", "droneItem",
|
||||
"implantItem", "boosterItem",
|
||||
|
||||
@@ -8,6 +8,7 @@ from service.market import Market
|
||||
import gui.mainFrame
|
||||
import gui.globalEvents as GE
|
||||
from gui.contextMenu import ContextMenu
|
||||
from service.settings import ContextMenuSettings
|
||||
from eos.saveddata.booster import Booster
|
||||
from eos.saveddata.module import Module
|
||||
from eos.saveddata.drone import Drone
|
||||
@@ -18,8 +19,11 @@ from eos.saveddata.implant import Implant
|
||||
class MetaSwap(ContextMenu):
|
||||
def __init__(self):
|
||||
self.mainFrame = gui.mainFrame.MainFrame.getInstance()
|
||||
self.settings = ContextMenuSettings.getInstance()
|
||||
|
||||
def display(self, srcContext, selection):
|
||||
if not self.settings.get('metaSwap'):
|
||||
return False
|
||||
|
||||
if self.mainFrame.getActiveFit() is None or srcContext not in (
|
||||
"fittingModule",
|
||||
|
||||
@@ -10,6 +10,7 @@ import gui.mainFrame
|
||||
import gui.globalEvents as GE
|
||||
from gui.contextMenu import ContextMenu
|
||||
from gui.bitmapLoader import BitmapLoader
|
||||
from service.settings import ContextMenuSettings
|
||||
|
||||
|
||||
class ModuleAmmoPicker(ContextMenu):
|
||||
@@ -18,8 +19,12 @@ class ModuleAmmoPicker(ContextMenu):
|
||||
|
||||
def __init__(self):
|
||||
self.mainFrame = gui.mainFrame.MainFrame.getInstance()
|
||||
self.settings = ContextMenuSettings.getInstance()
|
||||
|
||||
def display(self, srcContext, selection):
|
||||
if not self.settings.get('moduleAmmoPicker'):
|
||||
return False
|
||||
|
||||
if self.mainFrame.getActiveFit() is None or srcContext not in ("fittingModule", "projectedModule"):
|
||||
return False
|
||||
|
||||
|
||||
@@ -6,12 +6,14 @@ import gui.globalEvents as GE
|
||||
from gui.builtinContextMenus.moduleAmmoPicker import ModuleAmmoPicker
|
||||
from eos.db.saveddata.queries import getFit as db_getFit
|
||||
from service.fit import Fit
|
||||
from service.settings import ContextMenuSettings
|
||||
|
||||
|
||||
class ModuleGlobalAmmoPicker(ModuleAmmoPicker):
|
||||
def __init__(self):
|
||||
super(ModuleGlobalAmmoPicker, self).__init__()
|
||||
self.mainFrame = gui.mainFrame.MainFrame.getInstance()
|
||||
self.settings = ContextMenuSettings.getInstance()
|
||||
|
||||
def getText(self, itmContext, selection):
|
||||
return "Charge (All)"
|
||||
@@ -42,6 +44,9 @@ class ModuleGlobalAmmoPicker(ModuleAmmoPicker):
|
||||
wx.PostEvent(self.mainFrame, GE.FitChanged(fitID=fitID))
|
||||
|
||||
def display(self, srcContext, selection):
|
||||
if not self.settings.get('moduleGlobalAmmoPicker'):
|
||||
return False
|
||||
|
||||
try:
|
||||
selectionLen = len(selection)
|
||||
except:
|
||||
|
||||
@@ -3,13 +3,18 @@ import gui.mainFrame
|
||||
# noinspection PyPackageRequirements
|
||||
import wx
|
||||
from gui.shipBrowser import FitSelected
|
||||
from service.settings import ContextMenuSettings
|
||||
|
||||
|
||||
class OpenFit(ContextMenu):
|
||||
def __init__(self):
|
||||
self.mainFrame = gui.mainFrame.MainFrame.getInstance()
|
||||
self.settings = ContextMenuSettings.getInstance()
|
||||
|
||||
def display(self, srcContext, selection):
|
||||
if not self.settings.get('openFit'):
|
||||
return False
|
||||
|
||||
return srcContext == "projectedFit"
|
||||
|
||||
def getText(self, itmContext, selection):
|
||||
|
||||
@@ -4,13 +4,18 @@ import gui.mainFrame
|
||||
import wx
|
||||
import gui.globalEvents as GE
|
||||
from service.market import Market
|
||||
from service.settings import ContextMenuSettings
|
||||
|
||||
|
||||
class PriceClear(ContextMenu):
|
||||
def __init__(self):
|
||||
self.mainFrame = gui.mainFrame.MainFrame.getInstance()
|
||||
self.settings = ContextMenuSettings.getInstance()
|
||||
|
||||
def display(self, srcContext, selection):
|
||||
if not self.settings.get('priceClear'):
|
||||
return False
|
||||
|
||||
return srcContext == "priceViewFull"
|
||||
|
||||
def getText(self, itmContext, selection):
|
||||
|
||||
@@ -4,13 +4,18 @@ import gui.globalEvents as GE
|
||||
# noinspection PyPackageRequirements
|
||||
import wx
|
||||
from service.fit import Fit
|
||||
from service.settings import ContextMenuSettings
|
||||
|
||||
|
||||
class Project(ContextMenu):
|
||||
def __init__(self):
|
||||
self.mainFrame = gui.mainFrame.MainFrame.getInstance()
|
||||
self.settings = ContextMenuSettings.getInstance()
|
||||
|
||||
def display(self, srcContext, selection):
|
||||
if not self.settings.get('project'):
|
||||
return False
|
||||
|
||||
if srcContext not in ("marketItemGroup", "marketItemMisc") or self.mainFrame.getActiveFit() is None:
|
||||
return False
|
||||
|
||||
|
||||
@@ -4,13 +4,18 @@ from gui.contextMenu import ContextMenu
|
||||
import gui.mainFrame
|
||||
from gui.shipBrowser import Stage3Selected
|
||||
from service.fit import Fit
|
||||
from service.settings import ContextMenuSettings
|
||||
|
||||
|
||||
class ShipJump(ContextMenu):
|
||||
def __init__(self):
|
||||
self.mainFrame = gui.mainFrame.MainFrame.getInstance()
|
||||
self.settings = ContextMenuSettings.getInstance()
|
||||
|
||||
def display(self, srcContext, selection):
|
||||
if not self.settings.get('shipJump'):
|
||||
return False
|
||||
|
||||
return srcContext == "fittingShip"
|
||||
|
||||
def getText(self, itmContext, selection):
|
||||
|
||||
@@ -5,13 +5,18 @@ import gui.mainFrame
|
||||
|
||||
import gui.globalEvents as GE
|
||||
from service.fit import Fit
|
||||
from service.settings import ContextMenuSettings
|
||||
|
||||
|
||||
class TacticalMode(ContextMenu):
|
||||
def __init__(self):
|
||||
self.mainFrame = gui.mainFrame.MainFrame.getInstance()
|
||||
self.settings = ContextMenuSettings.getInstance()
|
||||
|
||||
def display(self, srcContext, selection):
|
||||
if not self.settings.get('tacticalMode'):
|
||||
return False
|
||||
|
||||
if self.mainFrame.getActiveFit() is None or srcContext != "fittingShip":
|
||||
return False
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ import wx
|
||||
from gui.bitmapLoader import BitmapLoader
|
||||
from service.targetResists import TargetResists as svc_TargetResists
|
||||
from service.fit import Fit
|
||||
from service.settings import ContextMenuSettings
|
||||
|
||||
try:
|
||||
from collections import OrderedDict
|
||||
@@ -16,8 +17,12 @@ except ImportError:
|
||||
class TargetResists(ContextMenu):
|
||||
def __init__(self):
|
||||
self.mainFrame = gui.mainFrame.MainFrame.getInstance()
|
||||
self.settings = ContextMenuSettings.getInstance()
|
||||
|
||||
def display(self, srcContext, selection):
|
||||
if not self.settings.get('targetResists'):
|
||||
return False
|
||||
|
||||
if self.mainFrame.getActiveFit() is None or srcContext != "firepowerViewFull":
|
||||
return False
|
||||
|
||||
|
||||
@@ -5,13 +5,18 @@ import gui.globalEvents as GE
|
||||
import wx
|
||||
from service.market import Market
|
||||
from service.fit import Fit
|
||||
from service.settings import ContextMenuSettings
|
||||
|
||||
|
||||
class WhProjector(ContextMenu):
|
||||
def __init__(self):
|
||||
self.mainFrame = gui.mainFrame.MainFrame.getInstance()
|
||||
self.settings = ContextMenuSettings.getInstance()
|
||||
|
||||
def display(self, srcContext, selection):
|
||||
if not self.settings.get('whProjector'):
|
||||
return False
|
||||
|
||||
return srcContext == "projected"
|
||||
|
||||
def getText(self, itmContext, selection):
|
||||
|
||||
@@ -1,8 +1,16 @@
|
||||
# noinspection PyPackageRequirements
|
||||
import wx
|
||||
|
||||
__all__ = ["pyfaGeneralPreferences", "pyfaHTMLExportPreferences", "pyfaUpdatePreferences",
|
||||
"pyfaNetworkPreferences"] # noqa
|
||||
__all__ = [
|
||||
"pyfaGeneralPreferences",
|
||||
"pyfaHTMLExportPreferences",
|
||||
"pyfaUpdatePreferences",
|
||||
"pyfaNetworkPreferences",
|
||||
"pyfaDatabasePreferences",
|
||||
"pyfaLoggingPreferences",
|
||||
"pyfaEnginePreferences",
|
||||
"pyfaStatViewPreferences",
|
||||
]
|
||||
|
||||
if 'wxMac' not in wx.PlatformInfo or ('wxMac' in wx.PlatformInfo and wx.VERSION >= (3, 0)):
|
||||
__all__.append("pyfaCrestPreferences")
|
||||
|
||||
114
gui/builtinPreferenceViews/pyfaContextMenuPreferences.py
Normal file
114
gui/builtinPreferenceViews/pyfaContextMenuPreferences.py
Normal file
@@ -0,0 +1,114 @@
|
||||
import wx
|
||||
|
||||
from gui.preferenceView import PreferenceView
|
||||
from gui.bitmapLoader import BitmapLoader
|
||||
import gui.mainFrame
|
||||
from service.settings import ContextMenuSettings
|
||||
|
||||
|
||||
class PFContextMenuPref(PreferenceView):
|
||||
title = "Context Menu Panel"
|
||||
|
||||
def populatePanel(self, panel):
|
||||
self.settings = ContextMenuSettings.getInstance()
|
||||
self.mainFrame = gui.mainFrame.MainFrame.getInstance()
|
||||
|
||||
self.dirtySettings = False
|
||||
mainSizer = wx.BoxSizer(wx.VERTICAL)
|
||||
|
||||
self.stTitle = wx.StaticText(panel, wx.ID_ANY, self.title, wx.DefaultPosition, wx.DefaultSize, 0)
|
||||
self.stTitle.Wrap(-1)
|
||||
self.stTitle.SetFont(wx.Font(12, 70, 90, 90, False, wx.EmptyString))
|
||||
|
||||
mainSizer.Add(self.stTitle, 0, wx.ALL, 5)
|
||||
|
||||
self.stSubTitle = wx.StaticText(panel, wx.ID_ANY,
|
||||
u"Disabling context menus can improve responsiveness.",
|
||||
wx.DefaultPosition, wx.DefaultSize, 0)
|
||||
self.stSubTitle.Wrap(-1)
|
||||
mainSizer.Add(self.stSubTitle, 0, wx.ALL, 5)
|
||||
|
||||
# Row 1
|
||||
self.m_staticline1 = wx.StaticLine(panel, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL)
|
||||
mainSizer.Add(self.m_staticline1, 0, wx.EXPAND | wx.ALL, 5)
|
||||
|
||||
rbSizerRow1 = wx.BoxSizer(wx.HORIZONTAL)
|
||||
|
||||
self.rbBox1 = wx.RadioBox(panel, -1, "Set as Damage Pattern", wx.DefaultPosition, wx.DefaultSize, ['Disabled', 'Enabled'], 1, wx.RA_SPECIFY_COLS)
|
||||
self.rbBox1.SetSelection(self.settings.get('ammoPattern'))
|
||||
rbSizerRow1.Add(self.rbBox1, 1, wx.TOP | wx.RIGHT, 5)
|
||||
self.rbBox1.Bind(wx.EVT_RADIOBOX, self.OnSetting1Change)
|
||||
|
||||
self.rbBox2 = wx.RadioBox(panel, -1, "Change Skills", wx.DefaultPosition, wx.DefaultSize, ['Disabled', 'Enabled'], 1, wx.RA_SPECIFY_COLS)
|
||||
self.rbBox2.SetSelection(self.settings.get('changeAffectingSkills'))
|
||||
rbSizerRow1.Add(self.rbBox2, 1, wx.ALL, 5)
|
||||
self.rbBox2.Bind(wx.EVT_RADIOBOX, self.OnSetting2Change)
|
||||
|
||||
self.rbBox3 = wx.RadioBox(panel, -1, "Factor in Reload Time", wx.DefaultPosition, wx.DefaultSize, ['Disabled', 'Enabled'], 1, wx.RA_SPECIFY_COLS)
|
||||
self.rbBox3.SetSelection(self.settings.get('factorReload'))
|
||||
rbSizerRow1.Add(self.rbBox3, 1, wx.ALL, 5)
|
||||
self.rbBox3.Bind(wx.EVT_RADIOBOX, self.OnSetting3Change)
|
||||
|
||||
mainSizer.Add(rbSizerRow1, 1, wx.ALL | wx.EXPAND, 0)
|
||||
|
||||
# Row 2
|
||||
rbSizerRow2 = wx.BoxSizer(wx.HORIZONTAL)
|
||||
|
||||
self.rbBox4 = wx.RadioBox(panel, -1, "Variations", wx.DefaultPosition, wx.DefaultSize, ['Disabled', 'Enabled'], 1, wx.RA_SPECIFY_COLS)
|
||||
self.rbBox4.SetSelection(self.settings.get('metaSwap'))
|
||||
rbSizerRow2.Add(self.rbBox4, 1, wx.TOP | wx.RIGHT, 5)
|
||||
self.rbBox4.Bind(wx.EVT_RADIOBOX, self.OnSetting4Change)
|
||||
|
||||
'''
|
||||
self.rbBox5 = wx.RadioBox(panel, -1, "Charge", wx.DefaultPosition, wx.DefaultSize, ['Disabled', 'Enabled'], 1, wx.RA_SPECIFY_COLS)
|
||||
self.rbBox5.SetSelection(self.settings.get('moduleAmmoPicker'))
|
||||
rbSizerRow2.Add(self.rbBox5, 1, wx.ALL, 5)
|
||||
self.rbBox5.Bind(wx.EVT_RADIOBOX, self.OnSetting5Change)
|
||||
'''
|
||||
|
||||
self.rbBox6 = wx.RadioBox(panel, -1, "Charge (All)", wx.DefaultPosition, wx.DefaultSize, ['Disabled', 'Enabled'], 1, wx.RA_SPECIFY_COLS)
|
||||
self.rbBox6.SetSelection(self.settings.get('moduleGlobalAmmoPicker'))
|
||||
rbSizerRow2.Add(self.rbBox6, 1, wx.ALL, 5)
|
||||
self.rbBox6.Bind(wx.EVT_RADIOBOX, self.OnSetting6Change)
|
||||
|
||||
mainSizer.Add(rbSizerRow2, 1, wx.ALL | wx.EXPAND, 0)
|
||||
|
||||
# Row 3
|
||||
rbSizerRow3 = wx.BoxSizer(wx.HORIZONTAL)
|
||||
|
||||
self.rbBox7 = wx.RadioBox(panel, -1, "Project onto Fit", wx.DefaultPosition, wx.DefaultSize, ['Disabled', 'Enabled'], 1, wx.RA_SPECIFY_COLS)
|
||||
self.rbBox7.SetSelection(self.settings.get('project'))
|
||||
rbSizerRow3.Add(self.rbBox7, 1, wx.TOP | wx.RIGHT, 5)
|
||||
self.rbBox7.Bind(wx.EVT_RADIOBOX, self.OnSetting7Change)
|
||||
|
||||
mainSizer.Add(rbSizerRow3, 1, wx.ALL | wx.EXPAND, 0)
|
||||
|
||||
panel.SetSizer(mainSizer)
|
||||
panel.Layout()
|
||||
|
||||
def OnSetting1Change(self, event):
|
||||
self.settings.set('ammoPattern', event.GetInt())
|
||||
|
||||
def OnSetting2Change(self, event):
|
||||
self.settings.set('changeAffectingSkills', event.GetInt())
|
||||
|
||||
def OnSetting3Change(self, event):
|
||||
self.settings.set('factorReload', event.GetInt())
|
||||
|
||||
def OnSetting4Change(self, event):
|
||||
self.settings.set('metaSwap', event.GetInt())
|
||||
|
||||
def OnSetting5Change(self, event):
|
||||
self.settings.set('moduleAmmoPicker', event.GetInt())
|
||||
|
||||
def OnSetting6Change(self, event):
|
||||
self.settings.set('moduleGlobalAmmoPicker', event.GetInt())
|
||||
|
||||
def OnSetting7Change(self, event):
|
||||
self.settings.set('project', event.GetInt())
|
||||
|
||||
def getImage(self):
|
||||
return BitmapLoader.getBitmap("pref-gauges_big", "gui")
|
||||
|
||||
|
||||
PFContextMenuPref.register()
|
||||
112
gui/builtinPreferenceViews/pyfaDatabasePreferences.py
Normal file
112
gui/builtinPreferenceViews/pyfaDatabasePreferences.py
Normal file
@@ -0,0 +1,112 @@
|
||||
import wx
|
||||
|
||||
from gui.preferenceView import PreferenceView
|
||||
from gui.bitmapLoader import BitmapLoader
|
||||
import config
|
||||
|
||||
import logging
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class PFGeneralPref(PreferenceView):
|
||||
title = "Database"
|
||||
|
||||
def populatePanel(self, panel):
|
||||
self.dirtySettings = False
|
||||
# self.openFitsSettings = service.SettingsProvider.getInstance().getSettings("pyfaPrevOpenFits", {"enabled": False, "pyfaOpenFits": []})
|
||||
|
||||
mainSizer = wx.BoxSizer(wx.VERTICAL)
|
||||
|
||||
self.stTitle = wx.StaticText(panel, wx.ID_ANY, self.title, wx.DefaultPosition, wx.DefaultSize, 0)
|
||||
self.stTitle.Wrap(-1)
|
||||
self.stTitle.SetFont(wx.Font(12, 70, 90, 90, False, wx.EmptyString))
|
||||
mainSizer.Add(self.stTitle, 0, wx.ALL, 5)
|
||||
|
||||
self.stSubTitle = wx.StaticText(panel, wx.ID_ANY, u"(Cannot be changed while pyfa is running. Set via command line switches.)",
|
||||
wx.DefaultPosition, wx.DefaultSize, 0)
|
||||
self.stSubTitle.Wrap(-1)
|
||||
mainSizer.Add(self.stSubTitle, 0, wx.ALL, 3)
|
||||
|
||||
self.m_staticline1 = wx.StaticLine(panel, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL)
|
||||
mainSizer.Add(self.m_staticline1, 0, wx.EXPAND | wx.TOP | wx.BOTTOM, 5)
|
||||
|
||||
# Save in Root
|
||||
self.cbsaveInRoot = wx.CheckBox(panel, wx.ID_ANY, u"Using Executable Path for Saved Fit Database and Settings", wx.DefaultPosition, wx.DefaultSize, 0)
|
||||
mainSizer.Add(self.cbsaveInRoot, 0, wx.ALL | wx.EXPAND, 5)
|
||||
|
||||
# Database path
|
||||
self.stSetUserPath = wx.StaticText(panel, wx.ID_ANY, u"pyfa User Path:", wx.DefaultPosition, wx.DefaultSize, 0)
|
||||
self.stSetUserPath.Wrap(-1)
|
||||
mainSizer.Add(self.stSetUserPath, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5)
|
||||
self.inputUserPath = wx.TextCtrl(panel, wx.ID_ANY, config.savePath, wx.DefaultPosition, wx.DefaultSize, 0)
|
||||
self.inputUserPath.SetEditable(False)
|
||||
self.inputUserPath.SetBackgroundColour((200, 200, 200))
|
||||
mainSizer.Add(self.inputUserPath, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL | wx.EXPAND, 5)
|
||||
|
||||
# Save DB
|
||||
self.stFitDB = wx.StaticText(panel, wx.ID_ANY, u"Fitting Database:", wx.DefaultPosition, wx.DefaultSize, 0)
|
||||
self.stFitDB.Wrap(-1)
|
||||
mainSizer.Add(self.stFitDB, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5)
|
||||
|
||||
self.inputFitDB = wx.TextCtrl(panel, wx.ID_ANY, config.saveDB, wx.DefaultPosition, wx.DefaultSize, 0)
|
||||
self.inputFitDB.SetEditable(False)
|
||||
self.inputFitDB.SetBackgroundColour((200, 200, 200))
|
||||
mainSizer.Add(self.inputFitDB, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL | wx.EXPAND, 5)
|
||||
|
||||
# Game Data DB
|
||||
self.stGameDB = wx.StaticText(panel, wx.ID_ANY, u"Game Database:", wx.DefaultPosition, wx.DefaultSize, 0)
|
||||
self.stGameDB.Wrap(-1)
|
||||
mainSizer.Add(self.stGameDB, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5)
|
||||
|
||||
self.inputGameDB = wx.TextCtrl(panel, wx.ID_ANY, config.gameDB, wx.DefaultPosition, wx.DefaultSize, 0)
|
||||
self.inputGameDB.SetEditable(False)
|
||||
self.inputGameDB.SetBackgroundColour((200, 200, 200))
|
||||
mainSizer.Add(self.inputGameDB, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL | wx.EXPAND, 5)
|
||||
|
||||
self.cbsaveInRoot.SetValue(config.saveInRoot)
|
||||
self.cbsaveInRoot.Bind(wx.EVT_CHECKBOX, self.onCBsaveInRoot)
|
||||
|
||||
self.inputUserPath.Bind(wx.EVT_LEAVE_WINDOW, self.OnWindowLeave)
|
||||
self.inputFitDB.Bind(wx.EVT_LEAVE_WINDOW, self.OnWindowLeave)
|
||||
self.inputGameDB.Bind(wx.EVT_LEAVE_WINDOW, self.OnWindowLeave)
|
||||
|
||||
panel.SetSizer(mainSizer)
|
||||
panel.Layout()
|
||||
|
||||
def onCBsaveInRoot(self, event):
|
||||
# We don't want users to be able to actually change this,
|
||||
# so if they try and change it, set it back to the current setting
|
||||
self.cbsaveInRoot.SetValue(config.saveInRoot)
|
||||
|
||||
# If we ever enable it might need this.
|
||||
'''
|
||||
config.saveInRoot = self.cbsaveInRoot.GetValue()
|
||||
'''
|
||||
|
||||
def getImage(self):
|
||||
return BitmapLoader.getBitmap("prefs_settings", "gui")
|
||||
|
||||
def OnWindowLeave(self, event):
|
||||
# We don't want to do anything when they leave,
|
||||
# but in the future we'd want to make sure settings
|
||||
# changed get saved.
|
||||
pass
|
||||
|
||||
'''
|
||||
#Set database path
|
||||
config.defPaths(self.inputFitDBPath.GetValue())
|
||||
|
||||
logger.debug("Running database import")
|
||||
if self.cbimportDefaults is True:
|
||||
# Import default database values
|
||||
# Import values that must exist otherwise Pyfa breaks
|
||||
DefaultDatabaseValues.importRequiredDefaults()
|
||||
# Import default values for damage profiles
|
||||
DefaultDatabaseValues.importDamageProfileDefaults()
|
||||
# Import default values for target resist profiles
|
||||
DefaultDatabaseValues.importResistProfileDefaults()
|
||||
'''
|
||||
|
||||
|
||||
PFGeneralPref.register()
|
||||
84
gui/builtinPreferenceViews/pyfaEnginePreferences.py
Normal file
84
gui/builtinPreferenceViews/pyfaEnginePreferences.py
Normal file
@@ -0,0 +1,84 @@
|
||||
import logging
|
||||
|
||||
import wx
|
||||
|
||||
from service.fit import Fit
|
||||
from gui.bitmapLoader import BitmapLoader
|
||||
from gui.preferenceView import PreferenceView
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class PFFittingEnginePref(PreferenceView):
|
||||
title = "Fitting Engine"
|
||||
|
||||
def __init__(self):
|
||||
self.dirtySettings = False
|
||||
|
||||
def refreshPanel(self, fit):
|
||||
pass
|
||||
|
||||
# noinspection PyAttributeOutsideInit
|
||||
def populatePanel(self, panel):
|
||||
# self.openFitsSettings = service.SettingsProvider.getInstance().getSettings("pyfaPrevOpenFits", {"enabled": False, "pyfaOpenFits": []})
|
||||
|
||||
mainSizer = wx.BoxSizer(wx.VERTICAL)
|
||||
|
||||
self.stTitle = wx.StaticText(panel, wx.ID_ANY, self.title, wx.DefaultPosition, wx.DefaultSize, 0)
|
||||
self.stTitle.Wrap(-1)
|
||||
self.stTitle.SetFont(wx.Font(12, 70, 90, 90, False, wx.EmptyString))
|
||||
mainSizer.Add(self.stTitle, 0, wx.ALL, 5)
|
||||
|
||||
self.m_staticline1 = wx.StaticLine(panel, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL)
|
||||
mainSizer.Add(self.m_staticline1, 0, wx.EXPAND | wx.TOP | wx.BOTTOM, 5)
|
||||
|
||||
self.cbGlobalForceReload = wx.CheckBox(panel, wx.ID_ANY, u"Factor in reload time when calculating capacitor usage, damage, and tank.",
|
||||
wx.DefaultPosition, wx.DefaultSize, 0)
|
||||
mainSizer.Add(self.cbGlobalForceReload, 0, wx.ALL | wx.EXPAND, 5)
|
||||
|
||||
# Future code once new cap sim is implemented
|
||||
'''
|
||||
self.cbGlobalForceReactivationTimer = wx.CheckBox( panel, wx.ID_ANY, u"Factor in reactivation timer", wx.DefaultPosition, wx.DefaultSize, 0 )
|
||||
mainSizer.Add( self.cbGlobalForceReactivationTimer, 0, wx.ALL|wx.EXPAND, 5 )
|
||||
|
||||
text = u" Ignores reactivation timer when calculating capacitor usage,\n damage, and tank."
|
||||
self.cbGlobalForceReactivationTimerText = wx.StaticText( panel, wx.ID_ANY, text, wx.DefaultPosition, wx.DefaultSize, 0 )
|
||||
self.cbGlobalForceReactivationTimerText.Wrap( -1 )
|
||||
self.cbGlobalForceReactivationTimerText.SetFont( wx.Font( 10, 70, 90, 90, False, wx.EmptyString ) )
|
||||
mainSizer.Add( self.cbGlobalForceReactivationTimerText, 0, wx.ALL, 5 )
|
||||
'''
|
||||
|
||||
# Future code for mining laser crystal
|
||||
'''
|
||||
self.cbGlobalMiningSpecialtyCrystal = wx.CheckBox( panel, wx.ID_ANY, u"Factor in reactivation timer", wx.DefaultPosition, wx.DefaultSize, 0 )
|
||||
mainSizer.Add( self.cbGlobalMiningSpecialtyCrystal, 0, wx.ALL|wx.EXPAND, 5 )
|
||||
|
||||
text = u" If enabled, displays the Specialty Crystal mining amount.\n This is the amount mined when using crystals and mining the matching asteroid."
|
||||
self.cbGlobalMiningSpecialtyCrystalText = wx.StaticText( panel, wx.ID_ANY, text, wx.DefaultPosition, wx.DefaultSize, 0 )
|
||||
self.cbGlobalMiningSpecialtyCrystalText.Wrap( -1 )
|
||||
self.cbGlobalMiningSpecialtyCrystalText.SetFont( wx.Font( 10, 70, 90, 90, False, wx.EmptyString ) )
|
||||
mainSizer.Add( self.cbGlobalMiningSpecialtyCrystalText, 0, wx.ALL, 5 )
|
||||
'''
|
||||
|
||||
self.sFit = Fit.getInstance()
|
||||
|
||||
self.cbGlobalForceReload.SetValue(self.sFit.serviceFittingOptions["useGlobalForceReload"])
|
||||
|
||||
self.cbGlobalForceReload.Bind(wx.EVT_CHECKBOX, self.OnCBGlobalForceReloadStateChange)
|
||||
|
||||
panel.SetSizer(mainSizer)
|
||||
panel.Layout()
|
||||
|
||||
def OnCBGlobalForceReloadStateChange(self, event):
|
||||
self.sFit.serviceFittingOptions["useGlobalForceReload"] = self.cbGlobalForceReload.GetValue()
|
||||
|
||||
def getImage(self):
|
||||
return BitmapLoader.getBitmap("prefs_settings", "gui")
|
||||
|
||||
def OnWindowLeave(self, event):
|
||||
# We don't want to do anything when they leave,
|
||||
# but in the future we might.
|
||||
pass
|
||||
|
||||
|
||||
PFFittingEnginePref.register()
|
||||
@@ -40,10 +40,6 @@ class PFGeneralPref(PreferenceView):
|
||||
wx.DefaultSize, 0)
|
||||
mainSizer.Add(self.cbGlobalDmgPattern, 0, wx.ALL | wx.EXPAND, 5)
|
||||
|
||||
self.cbGlobalForceReload = wx.CheckBox(panel, wx.ID_ANY, u"Factor in reload time", wx.DefaultPosition,
|
||||
wx.DefaultSize, 0)
|
||||
mainSizer.Add(self.cbGlobalForceReload, 0, wx.ALL | wx.EXPAND, 5)
|
||||
|
||||
self.cbCompactSkills = wx.CheckBox(panel, wx.ID_ANY, u"Compact skills needed tooltip", wx.DefaultPosition,
|
||||
wx.DefaultSize, 0)
|
||||
mainSizer.Add(self.cbCompactSkills, 0, wx.ALL | wx.EXPAND, 5)
|
||||
@@ -97,7 +93,6 @@ class PFGeneralPref(PreferenceView):
|
||||
|
||||
self.cbGlobalChar.SetValue(self.sFit.serviceFittingOptions["useGlobalCharacter"])
|
||||
self.cbGlobalDmgPattern.SetValue(self.sFit.serviceFittingOptions["useGlobalDamagePattern"])
|
||||
self.cbGlobalForceReload.SetValue(self.sFit.serviceFittingOptions["useGlobalForceReload"])
|
||||
self.cbFitColorSlots.SetValue(self.sFit.serviceFittingOptions["colorFitBySlot"] or False)
|
||||
self.cbRackSlots.SetValue(self.sFit.serviceFittingOptions["rackSlots"] or False)
|
||||
self.cbRackLabels.SetValue(self.sFit.serviceFittingOptions["rackLabels"] or False)
|
||||
@@ -112,7 +107,6 @@ class PFGeneralPref(PreferenceView):
|
||||
|
||||
self.cbGlobalChar.Bind(wx.EVT_CHECKBOX, self.OnCBGlobalCharStateChange)
|
||||
self.cbGlobalDmgPattern.Bind(wx.EVT_CHECKBOX, self.OnCBGlobalDmgPatternStateChange)
|
||||
self.cbGlobalForceReload.Bind(wx.EVT_CHECKBOX, self.OnCBGlobalForceReloadStateChange)
|
||||
self.cbFitColorSlots.Bind(wx.EVT_CHECKBOX, self.onCBGlobalColorBySlot)
|
||||
self.cbRackSlots.Bind(wx.EVT_CHECKBOX, self.onCBGlobalRackSlots)
|
||||
self.cbRackLabels.Bind(wx.EVT_CHECKBOX, self.onCBGlobalRackLabels)
|
||||
@@ -152,13 +146,6 @@ class PFGeneralPref(PreferenceView):
|
||||
wx.PostEvent(self.mainFrame, GE.FitChanged(fitID=fitID))
|
||||
event.Skip()
|
||||
|
||||
def OnCBGlobalForceReloadStateChange(self, event):
|
||||
self.sFit.serviceFittingOptions["useGlobalForceReload"] = self.cbGlobalForceReload.GetValue()
|
||||
fitID = self.mainFrame.getActiveFit()
|
||||
self.sFit.refreshFit(fitID)
|
||||
wx.PostEvent(self.mainFrame, GE.FitChanged(fitID=fitID))
|
||||
event.Skip()
|
||||
|
||||
def OnCBGlobalCharStateChange(self, event):
|
||||
self.sFit.serviceFittingOptions["useGlobalCharacter"] = self.cbGlobalChar.GetValue()
|
||||
event.Skip()
|
||||
|
||||
59
gui/builtinPreferenceViews/pyfaLoggingPreferences.py
Normal file
59
gui/builtinPreferenceViews/pyfaLoggingPreferences.py
Normal file
@@ -0,0 +1,59 @@
|
||||
import wx
|
||||
|
||||
from gui.preferenceView import PreferenceView
|
||||
from gui.bitmapLoader import BitmapLoader
|
||||
import config
|
||||
|
||||
|
||||
class PFGeneralPref(PreferenceView):
|
||||
title = "Logging"
|
||||
|
||||
def populatePanel(self, panel):
|
||||
self.dirtySettings = False
|
||||
# self.openFitsSettings = service.SettingsProvider.getInstance().getSettings("pyfaPrevOpenFits", {"enabled": False, "pyfaOpenFits": []})
|
||||
|
||||
mainSizer = wx.BoxSizer(wx.VERTICAL)
|
||||
|
||||
self.stTitle = wx.StaticText(panel, wx.ID_ANY, self.title, wx.DefaultPosition, wx.DefaultSize, 0)
|
||||
self.stTitle.Wrap(-1)
|
||||
self.stTitle.SetFont(wx.Font(12, 70, 90, 90, False, wx.EmptyString))
|
||||
mainSizer.Add(self.stTitle, 0, wx.ALL, 5)
|
||||
|
||||
self.stSubTitle = wx.StaticText(panel, wx.ID_ANY, u"(Cannot be changed while pyfa is running. Set via command line switches.)",
|
||||
wx.DefaultPosition, wx.DefaultSize, 0)
|
||||
self.stSubTitle.Wrap(-1)
|
||||
mainSizer.Add(self.stSubTitle, 0, wx.ALL, 3)
|
||||
|
||||
self.m_staticline1 = wx.StaticLine(panel, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL)
|
||||
mainSizer.Add(self.m_staticline1, 0, wx.EXPAND | wx.TOP | wx.BOTTOM, 5)
|
||||
|
||||
# Debug Logging
|
||||
self.cbdebugLogging = wx.CheckBox(panel, wx.ID_ANY, u"Debug Logging Enabled", wx.DefaultPosition, wx.DefaultSize, 0)
|
||||
mainSizer.Add(self.cbdebugLogging, 0, wx.ALL | wx.EXPAND, 5)
|
||||
|
||||
self.cbdebugLogging.SetValue(config.debug)
|
||||
self.cbdebugLogging.Bind(wx.EVT_CHECKBOX, self.onCBdebugLogging)
|
||||
|
||||
panel.SetSizer(mainSizer)
|
||||
panel.Layout()
|
||||
|
||||
def onCBdebugLogging(self, event):
|
||||
# We don't want users to be able to actually change this,
|
||||
# so if they try and change it, set it back to the current setting
|
||||
self.cbdebugLogging.SetValue(config.debug)
|
||||
|
||||
# In case we do, down there road, here's a bit of a start.
|
||||
'''
|
||||
if self.cbdebugLogging.GetValue() is True:
|
||||
self.cbdebugLogging.SetValue(False)
|
||||
config.Debug = self.cbdebugLogging.GetValue()
|
||||
else:
|
||||
self.cbdebugLogging.SetValue(True)
|
||||
config.Debug = self.cbdebugLogging.GetValue()
|
||||
'''
|
||||
|
||||
def getImage(self):
|
||||
return BitmapLoader.getBitmap("prefs_settings", "gui")
|
||||
|
||||
|
||||
PFGeneralPref.register()
|
||||
151
gui/builtinPreferenceViews/pyfaStatViewPreferences.py
Normal file
151
gui/builtinPreferenceViews/pyfaStatViewPreferences.py
Normal file
@@ -0,0 +1,151 @@
|
||||
# noinspection PyPackageRequirements
|
||||
import wx
|
||||
|
||||
from gui.preferenceView import PreferenceView
|
||||
from gui.bitmapLoader import BitmapLoader
|
||||
from service.settings import StatViewSettings
|
||||
|
||||
|
||||
class PFStatViewPref(PreferenceView):
|
||||
title = "Statistics Panel"
|
||||
|
||||
def __init__(self):
|
||||
self.dirtySettings = False
|
||||
self.settings = StatViewSettings.getInstance()
|
||||
|
||||
def refreshPanel(self, fit):
|
||||
pass
|
||||
|
||||
# noinspection PyAttributeOutsideInit
|
||||
def populatePanel(self, panel):
|
||||
mainSizer = wx.BoxSizer(wx.VERTICAL)
|
||||
|
||||
self.stTitle = wx.StaticText(panel, wx.ID_ANY, self.title, wx.DefaultPosition, wx.DefaultSize, 0)
|
||||
self.stTitle.Wrap(-1)
|
||||
self.stTitle.SetFont(wx.Font(12, 70, 90, 90, False, wx.EmptyString))
|
||||
|
||||
mainSizer.Add(self.stTitle, 0, wx.ALL, 5)
|
||||
|
||||
self.stSubTitle = wx.StaticText(panel, wx.ID_ANY,
|
||||
u"Changes require restart of pyfa to take effect.",
|
||||
wx.DefaultPosition, wx.DefaultSize, 0)
|
||||
self.stSubTitle.Wrap(-1)
|
||||
mainSizer.Add(self.stSubTitle, 0, wx.ALL, 3)
|
||||
|
||||
# Row 1
|
||||
self.m_staticline1 = wx.StaticLine(panel, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL)
|
||||
mainSizer.Add(self.m_staticline1, 0, wx.EXPAND | wx.ALL, 5)
|
||||
|
||||
rbSizerRow1 = wx.BoxSizer(wx.HORIZONTAL)
|
||||
|
||||
self.rbResources = wx.RadioBox(panel, -1, "Resources", wx.DefaultPosition, wx.DefaultSize, ['None', 'Minimal', 'Full'], 1, wx.RA_SPECIFY_COLS)
|
||||
# Disable minimal as we don't have a view for this yet
|
||||
self.rbResources.EnableItem(1, False)
|
||||
self.rbResources.SetSelection(self.settings.get('resources'))
|
||||
rbSizerRow1.Add(self.rbResources, 1, wx.TOP | wx.RIGHT, 5)
|
||||
self.rbResources.Bind(wx.EVT_RADIOBOX, self.OnResourcesChange)
|
||||
|
||||
self.rbResistances = wx.RadioBox(panel, -1, "Resistances", wx.DefaultPosition, wx.DefaultSize, ['None', 'Minimal', 'Full'], 1, wx.RA_SPECIFY_COLS)
|
||||
# Disable minimal as we don't have a view for this yet
|
||||
self.rbResistances.EnableItem(1, False)
|
||||
self.rbResistances.SetSelection(self.settings.get('resistances'))
|
||||
rbSizerRow1.Add(self.rbResistances, 1, wx.ALL, 5)
|
||||
self.rbResistances.Bind(wx.EVT_RADIOBOX, self.OnResistancesChange)
|
||||
|
||||
self.rbRecharge = wx.RadioBox(panel, -1, "Shield/Armor Tank", wx.DefaultPosition, wx.DefaultSize, ['None', 'Minimal', 'Full'], 1, wx.RA_SPECIFY_COLS)
|
||||
# Disable minimal as we don't have a view for this yet
|
||||
self.rbRecharge.EnableItem(1, False)
|
||||
self.rbRecharge.SetSelection(self.settings.get('recharge'))
|
||||
rbSizerRow1.Add(self.rbRecharge, 1, wx.ALL, 5)
|
||||
self.rbRecharge.Bind(wx.EVT_RADIOBOX, self.OnRechargeChange)
|
||||
|
||||
mainSizer.Add(rbSizerRow1, 1, wx.ALL | wx.EXPAND, 0)
|
||||
|
||||
# Row 2
|
||||
rbSizerRow2 = wx.BoxSizer(wx.HORIZONTAL)
|
||||
|
||||
self.rbFirepower = wx.RadioBox(panel, -1, "Firepower", wx.DefaultPosition, wx.DefaultSize, ['None', 'Minimal', 'Full'], 1, wx.RA_SPECIFY_COLS)
|
||||
# Disable minimal as we don't have a view for this yet
|
||||
self.rbFirepower.EnableItem(1, False)
|
||||
self.rbFirepower.SetSelection(self.settings.get('firepower'))
|
||||
rbSizerRow2.Add(self.rbFirepower, 1, wx.TOP | wx.RIGHT, 5)
|
||||
self.rbFirepower.Bind(wx.EVT_RADIOBOX, self.OnFirepowerChange)
|
||||
|
||||
self.rbCapacitor = wx.RadioBox(panel, -1, "Capacitor", wx.DefaultPosition, wx.DefaultSize, ['None', 'Minimal', 'Full'], 1, wx.RA_SPECIFY_COLS)
|
||||
# Disable minimal as we don't have a view for this yet
|
||||
self.rbCapacitor.EnableItem(1, False)
|
||||
self.rbCapacitor.SetSelection(self.settings.get('capacitor'))
|
||||
rbSizerRow2.Add(self.rbCapacitor, 1, wx.ALL, 5)
|
||||
self.rbCapacitor.Bind(wx.EVT_RADIOBOX, self.OnCapacitorChange)
|
||||
|
||||
self.rbMisc = wx.RadioBox(panel, -1, "Misc", wx.DefaultPosition, wx.DefaultSize, ['None', 'Minimal', 'Full'], 1, wx.RA_SPECIFY_COLS)
|
||||
# Disable full as we don't have a view for this yet
|
||||
self.rbMisc.EnableItem(2, False)
|
||||
self.rbMisc.SetSelection(self.settings.get('targetingmisc'))
|
||||
rbSizerRow2.Add(self.rbMisc, 1, wx.ALL, 5)
|
||||
self.rbMisc.Bind(wx.EVT_RADIOBOX, self.OnTargetingMiscChange)
|
||||
|
||||
mainSizer.Add(rbSizerRow2, 1, wx.ALL | wx.EXPAND, 0)
|
||||
|
||||
# Row 3
|
||||
rbSizerRow3 = wx.BoxSizer(wx.HORIZONTAL)
|
||||
|
||||
self.rbPrice = wx.RadioBox(panel, -1, "Price", wx.DefaultPosition, wx.DefaultSize, ['None', 'Minimal', 'Full'], 1, wx.RA_SPECIFY_COLS)
|
||||
# Disable minimal as we don't have a view for this yet
|
||||
self.rbPrice.EnableItem(1, False)
|
||||
self.rbPrice.SetSelection(self.settings.get('price'))
|
||||
rbSizerRow3.Add(self.rbPrice, 1, wx.TOP | wx.RIGHT, 5)
|
||||
self.rbPrice.Bind(wx.EVT_RADIOBOX, self.OnPriceChange)
|
||||
|
||||
# We don't have views for these.....yet
|
||||
'''
|
||||
self.rbMining = wx.RadioBox(panel, -1, "Mining", wx.DefaultPosition, wx.DefaultSize,
|
||||
['None', 'Minimal', 'Full'], 1, wx.RA_SPECIFY_COLS)
|
||||
self.rbMining.SetSelection(self.settings.get('miningyield'))
|
||||
rbSizerRow3.Add(self.rbMining, 1, wx.ALL, 5)
|
||||
self.rbMining.Bind(wx.EVT_RADIOBOX, self.OnMiningYieldChange)
|
||||
|
||||
self.rbDrones = wx.RadioBox(panel, -1, "Drones", wx.DefaultPosition, wx.DefaultSize,
|
||||
['None', 'Minimal', 'Full'], 1, wx.RA_SPECIFY_COLS)
|
||||
self.rbDrones.SetSelection(self.settings.get('drones'))
|
||||
rbSizerRow3.Add(self.rbDrones, 1, wx.ALL, 5)
|
||||
self.rbDrones.Bind(wx.EVT_RADIOBOX, self.OnDroneChange)
|
||||
'''
|
||||
|
||||
mainSizer.Add(rbSizerRow3, 1, wx.ALL | wx.EXPAND, 0)
|
||||
|
||||
panel.SetSizer(mainSizer)
|
||||
panel.Layout()
|
||||
|
||||
def OnResourcesChange(self, event):
|
||||
self.settings.set('resources', event.GetInt())
|
||||
|
||||
def OnResistancesChange(self, event):
|
||||
self.settings.set('resistances', event.GetInt())
|
||||
|
||||
def OnRechargeChange(self, event):
|
||||
self.settings.set('recharge', event.GetInt())
|
||||
|
||||
def OnFirepowerChange(self, event):
|
||||
self.settings.set('firepower', event.GetInt())
|
||||
|
||||
def OnCapacitorChange(self, event):
|
||||
self.settings.set('capacitor', event.GetInt())
|
||||
|
||||
def OnTargetingMiscChange(self, event):
|
||||
self.settings.set('targetingmisc', event.GetInt())
|
||||
|
||||
def OnPriceChange(self, event):
|
||||
self.settings.set('price', event.GetInt())
|
||||
|
||||
def OnMiningYieldChange(self, event):
|
||||
self.settings.set('miningyield', event.GetInt())
|
||||
|
||||
def OnDroneChange(self, event):
|
||||
self.settings.set('drones', event.GetInt())
|
||||
|
||||
def getImage(self):
|
||||
return BitmapLoader.getBitmap("pref-gauges_big", "gui")
|
||||
|
||||
|
||||
PFStatViewPref.register()
|
||||
@@ -44,7 +44,7 @@ class PFUpdatePref(PreferenceView):
|
||||
self.versionSizer = wx.BoxSizer(wx.VERTICAL)
|
||||
|
||||
self.versionTitle = wx.StaticText(panel, wx.ID_ANY, "Suppressing {0} Notifications".format(
|
||||
self.UpdateSettings.get('version')), wx.DefaultPosition, wx.DefaultSize, 0)
|
||||
self.UpdateSettings.get('version')), wx.DefaultPosition, wx.DefaultSize, 0)
|
||||
self.versionTitle.Wrap(-1)
|
||||
self.versionTitle.SetFont(wx.Font(12, 70, 90, 90, False, wx.EmptyString))
|
||||
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
__all__ = ["resourcesViewFull", "resistancesViewFull",
|
||||
"rechargeViewFull", "firepowerViewFull", "capacitorViewFull", "outgoingViewFull",
|
||||
"targetingMiscViewFull", "priceViewFull", "miningyieldViewFull"]
|
||||
__all__ = [
|
||||
"resourcesViewFull",
|
||||
"resistancesViewFull",
|
||||
"rechargeViewFull",
|
||||
"firepowerViewFull",
|
||||
"capacitorViewFull",
|
||||
"outgoingViewFull",
|
||||
"targetingMiscViewMinimal",
|
||||
"priceViewFull",
|
||||
]
|
||||
|
||||
251
gui/builtinStatsViews/targetingMiscViewMinimal.py
Normal file
251
gui/builtinStatsViews/targetingMiscViewMinimal.py
Normal file
@@ -0,0 +1,251 @@
|
||||
# =============================================================================
|
||||
# Copyright (C) 2010 Diego Duclos
|
||||
#
|
||||
# This file is part of pyfa.
|
||||
#
|
||||
# pyfa is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# pyfa is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with pyfa. If not, see <http://www.gnu.org/licenses/>.
|
||||
# =============================================================================
|
||||
|
||||
# noinspection PyPackageRequirements
|
||||
import wx
|
||||
from gui.statsView import StatsView
|
||||
from gui.utils.numberFormatter import formatAmount
|
||||
|
||||
try:
|
||||
from collections import OrderedDict
|
||||
except ImportError:
|
||||
from utils.compat import OrderedDict
|
||||
|
||||
|
||||
class TargetingMiscViewMinimal(StatsView):
|
||||
name = "targetingMiscViewMinimal"
|
||||
|
||||
def __init__(self, parent):
|
||||
StatsView.__init__(self)
|
||||
self.parent = parent
|
||||
self._cachedValues = []
|
||||
|
||||
def getHeaderText(self, fit):
|
||||
return "Targeting && Misc"
|
||||
|
||||
def getTextExtentW(self, text):
|
||||
width, height = self.parent.GetTextExtent(text)
|
||||
return width
|
||||
|
||||
def populatePanel(self, contentPanel, headerPanel):
|
||||
contentSizer = contentPanel.GetSizer()
|
||||
|
||||
self.panel = contentPanel
|
||||
self.headerPanel = headerPanel
|
||||
gridTargetingMisc = wx.FlexGridSizer(1, 3)
|
||||
contentSizer.Add(gridTargetingMisc, 0, wx.EXPAND | wx.ALL, 0)
|
||||
gridTargetingMisc.AddGrowableCol(0)
|
||||
gridTargetingMisc.AddGrowableCol(2)
|
||||
# Targeting
|
||||
|
||||
gridTargeting = wx.FlexGridSizer(5, 2)
|
||||
gridTargeting.AddGrowableCol(1)
|
||||
|
||||
gridTargetingMisc.Add(gridTargeting, 0, wx.ALIGN_LEFT | wx.ALL, 5)
|
||||
|
||||
labels = (("Targets", "Targets", ""),
|
||||
("Range", "Range", "km"),
|
||||
("Scan res.", "ScanRes", "mm"),
|
||||
("Sensor str.", "SensorStr", ""),
|
||||
("Drone range", "CtrlRange", "km"))
|
||||
|
||||
for header, labelShort, unit in labels:
|
||||
gridTargeting.Add(wx.StaticText(contentPanel, wx.ID_ANY, "%s: " % header), 0, wx.ALIGN_LEFT)
|
||||
|
||||
box = wx.BoxSizer(wx.HORIZONTAL)
|
||||
gridTargeting.Add(box, 0, wx.ALIGN_LEFT)
|
||||
|
||||
lbl = wx.StaticText(contentPanel, wx.ID_ANY, "0 %s" % unit)
|
||||
setattr(self, "label%s" % labelShort, lbl)
|
||||
box.Add(lbl, 0, wx.ALIGN_LEFT)
|
||||
|
||||
self._cachedValues.append({"main": 0})
|
||||
|
||||
# Misc
|
||||
gridTargetingMisc.Add(wx.StaticLine(contentPanel, wx.ID_ANY, style=wx.VERTICAL), 0, wx.EXPAND, 3)
|
||||
gridMisc = wx.FlexGridSizer(5, 2)
|
||||
gridMisc.AddGrowableCol(1)
|
||||
gridTargetingMisc.Add(gridMisc, 0, wx.ALIGN_LEFT | wx.ALL, 5)
|
||||
|
||||
labels = (("Speed", "Speed", "m/s"),
|
||||
("Align time", "AlignTime", "s"),
|
||||
("Signature", "SigRadius", "m"),
|
||||
("Warp Speed", "WarpSpeed", "AU/s"),
|
||||
("Cargo", "Cargo", u"m\u00B3"))
|
||||
|
||||
for header, labelShort, unit in labels:
|
||||
gridMisc.Add(wx.StaticText(contentPanel, wx.ID_ANY, "%s: " % header), 0, wx.ALIGN_LEFT)
|
||||
|
||||
box = wx.BoxSizer(wx.HORIZONTAL)
|
||||
gridMisc.Add(box, 0, wx.ALIGN_LEFT)
|
||||
|
||||
lbl = wx.StaticText(contentPanel, wx.ID_ANY, "0 %s" % unit)
|
||||
setattr(self, "labelFull%s" % labelShort, lbl)
|
||||
box.Add(lbl, 0, wx.ALIGN_LEFT)
|
||||
|
||||
self._cachedValues.append({"main": 0})
|
||||
|
||||
def refreshPanel(self, fit):
|
||||
# If we did anything interesting, we'd update our labels to reflect the new fit's stats here
|
||||
|
||||
cargoNamesOrder = OrderedDict((
|
||||
("fleetHangarCapacity", "Fleet hangar"),
|
||||
("shipMaintenanceBayCapacity", "Maintenance bay"),
|
||||
("specialAmmoHoldCapacity", "Ammo hold"),
|
||||
("specialFuelBayCapacity", "Fuel bay"),
|
||||
("specialShipHoldCapacity", "Ship hold"),
|
||||
("specialSmallShipHoldCapacity", "Small ship hold"),
|
||||
("specialMediumShipHoldCapacity", "Medium ship hold"),
|
||||
("specialLargeShipHoldCapacity", "Large ship hold"),
|
||||
("specialIndustrialShipHoldCapacity", "Industrial ship hold"),
|
||||
("specialOreHoldCapacity", "Ore hold"),
|
||||
("specialMineralHoldCapacity", "Mineral hold"),
|
||||
("specialMaterialBayCapacity", "Material bay"),
|
||||
("specialGasHoldCapacity", "Gas hold"),
|
||||
("specialSalvageHoldCapacity", "Salvage hold"),
|
||||
("specialCommandCenterHoldCapacity", "Command center hold"),
|
||||
("specialPlanetaryCommoditiesHoldCapacity", "Planetary goods hold"),
|
||||
("specialQuafeHoldCapacity", "Quafe hold")
|
||||
))
|
||||
|
||||
cargoValues = {
|
||||
"main": lambda: fit.ship.getModifiedItemAttr("capacity"),
|
||||
"fleetHangarCapacity": lambda: fit.ship.getModifiedItemAttr("fleetHangarCapacity"),
|
||||
"shipMaintenanceBayCapacity": lambda: fit.ship.getModifiedItemAttr("shipMaintenanceBayCapacity"),
|
||||
"specialAmmoHoldCapacity": lambda: fit.ship.getModifiedItemAttr("specialAmmoHoldCapacity"),
|
||||
"specialFuelBayCapacity": lambda: fit.ship.getModifiedItemAttr("specialFuelBayCapacity"),
|
||||
"specialShipHoldCapacity": lambda: fit.ship.getModifiedItemAttr("specialShipHoldCapacity"),
|
||||
"specialSmallShipHoldCapacity": lambda: fit.ship.getModifiedItemAttr("specialSmallShipHoldCapacity"),
|
||||
"specialMediumShipHoldCapacity": lambda: fit.ship.getModifiedItemAttr("specialMediumShipHoldCapacity"),
|
||||
"specialLargeShipHoldCapacity": lambda: fit.ship.getModifiedItemAttr("specialLargeShipHoldCapacity"),
|
||||
"specialIndustrialShipHoldCapacity": lambda: fit.ship.getModifiedItemAttr("specialIndustrialShipHoldCapacity"),
|
||||
"specialOreHoldCapacity": lambda: fit.ship.getModifiedItemAttr("specialOreHoldCapacity"),
|
||||
"specialMineralHoldCapacity": lambda: fit.ship.getModifiedItemAttr("specialMineralHoldCapacity"),
|
||||
"specialMaterialBayCapacity": lambda: fit.ship.getModifiedItemAttr("specialMaterialBayCapacity"),
|
||||
"specialGasHoldCapacity": lambda: fit.ship.getModifiedItemAttr("specialGasHoldCapacity"),
|
||||
"specialSalvageHoldCapacity": lambda: fit.ship.getModifiedItemAttr("specialSalvageHoldCapacity"),
|
||||
"specialCommandCenterHoldCapacity": lambda: fit.ship.getModifiedItemAttr("specialCommandCenterHoldCapacity"),
|
||||
"specialPlanetaryCommoditiesHoldCapacity": lambda: fit.ship.getModifiedItemAttr("specialPlanetaryCommoditiesHoldCapacity"),
|
||||
"specialQuafeHoldCapacity": lambda: fit.ship.getModifiedItemAttr("specialQuafeHoldCapacity")
|
||||
}
|
||||
|
||||
stats = (("labelTargets", {"main": lambda: fit.maxTargets}, 3, 0, 0, ""),
|
||||
("labelRange", {"main": lambda: fit.maxTargetRange / 1000}, 3, 0, 0, "km"),
|
||||
("labelScanRes", {"main": lambda: fit.ship.getModifiedItemAttr("scanResolution")}, 3, 0, 0, "mm"),
|
||||
("labelSensorStr", {"main": lambda: fit.scanStrength}, 3, 0, 0, ""),
|
||||
("labelCtrlRange", {"main": lambda: fit.extraAttributes["droneControlRange"] / 1000}, 3, 0, 0, "km"),
|
||||
("labelFullSpeed", {"main": lambda: fit.maxSpeed}, 3, 0, 0, "m/s"),
|
||||
("labelFullAlignTime", {"main": lambda: fit.alignTime}, 3, 0, 0, "s"),
|
||||
("labelFullSigRadius", {"main": lambda: fit.ship.getModifiedItemAttr("signatureRadius")}, 3, 0, 9, ""),
|
||||
("labelFullWarpSpeed", {"main": lambda: fit.warpSpeed}, 3, 0, 0, "AU/s"),
|
||||
("labelFullCargo", cargoValues, 4, 0, 9, u"m\u00B3"))
|
||||
|
||||
counter = 0
|
||||
RADII = [("Pod", 25), ("Interceptor", 33), ("Frigate", 38),
|
||||
("Destroyer", 83), ("Cruiser", 130),
|
||||
("Battlecruiser", 265), ("Battleship", 420),
|
||||
("Carrier", 3000)]
|
||||
for labelName, valueDict, prec, lowest, highest, unit in stats:
|
||||
label = getattr(self, labelName)
|
||||
newValues = {}
|
||||
for valueAlias, value in valueDict.items():
|
||||
value = value() if fit is not None else 0
|
||||
value = value if value is not None else 0
|
||||
newValues[valueAlias] = value
|
||||
if self._cachedValues[counter] != newValues:
|
||||
mainValue = newValues["main"]
|
||||
otherValues = dict((k, newValues[k]) for k in filter(lambda k: k != "main", newValues))
|
||||
if labelName == "labelFullCargo":
|
||||
# Get sum of all cargoholds except for maintenance bay
|
||||
additionalCargo = sum(otherValues.values())
|
||||
if additionalCargo > 0:
|
||||
label.SetLabel("%s+%s %s" % (formatAmount(mainValue, prec, lowest, highest),
|
||||
formatAmount(additionalCargo, prec, lowest, highest),
|
||||
unit))
|
||||
else:
|
||||
label.SetLabel("%s %s" % (formatAmount(mainValue, prec, lowest, highest), unit))
|
||||
else:
|
||||
label.SetLabel("%s %s" % (formatAmount(mainValue, prec, lowest, highest), unit))
|
||||
# Tooltip stuff
|
||||
if fit:
|
||||
if labelName == "labelScanRes":
|
||||
lockTime = "%s\n" % "Lock Times".center(30)
|
||||
for size, radius in RADII:
|
||||
left = "%.1fs" % fit.calculateLockTime(radius)
|
||||
right = "%s [%d]" % (size, radius)
|
||||
lockTime += "%5s\t%s\n" % (left, right)
|
||||
label.SetToolTip(wx.ToolTip(lockTime))
|
||||
elif labelName == "labelFullSigRadius":
|
||||
label.SetToolTip(wx.ToolTip("Probe Size: %.3f" % (fit.probeSize or 0)))
|
||||
elif labelName == "labelFullWarpSpeed":
|
||||
label.SetToolTip(wx.ToolTip("Max Warp Distance: %.1f AU" % fit.maxWarpDistance))
|
||||
elif labelName == "labelSensorStr":
|
||||
if fit.jamChance > 0:
|
||||
label.SetToolTip(wx.ToolTip("Type: %s\n%.1f%% Chance of Jam" % (fit.scanType, fit.jamChance)))
|
||||
else:
|
||||
label.SetToolTip(wx.ToolTip("Type: %s" % fit.scanType))
|
||||
elif labelName == "labelFullAlignTime":
|
||||
alignTime = "Align:\t%.3fs" % mainValue
|
||||
mass = 'Mass:\t{:,.0f}kg'.format(fit.ship.getModifiedItemAttr("mass"))
|
||||
agility = "Agility:\t%.3fx" % (fit.ship.getModifiedItemAttr("agility") or 0)
|
||||
label.SetToolTip(wx.ToolTip("%s\n%s\n%s" % (alignTime, mass, agility)))
|
||||
elif labelName == "labelFullCargo":
|
||||
tipLines = [u"Cargohold: {:,.2f}m\u00B3 / {:,.2f}m\u00B3".format(fit.cargoBayUsed, newValues["main"])]
|
||||
for attrName, tipAlias in cargoNamesOrder.items():
|
||||
if newValues[attrName] > 0:
|
||||
tipLines.append(u"{}: {:,.2f}m\u00B3".format(tipAlias, newValues[attrName]))
|
||||
label.SetToolTip(wx.ToolTip(u"\n".join(tipLines)))
|
||||
else:
|
||||
label.SetToolTip(wx.ToolTip("%.1f" % mainValue))
|
||||
else:
|
||||
label.SetToolTip(wx.ToolTip(""))
|
||||
self._cachedValues[counter] = newValues
|
||||
elif labelName == "labelFullWarpSpeed":
|
||||
if fit:
|
||||
label.SetToolTip(wx.ToolTip("Max Warp Distance: %.1f AU" % fit.maxWarpDistance))
|
||||
else:
|
||||
label.SetToolTip(wx.ToolTip(""))
|
||||
elif labelName == "labelSensorStr":
|
||||
if fit:
|
||||
if fit.jamChance > 0:
|
||||
label.SetToolTip(wx.ToolTip("Type: %s\n%.1f%% Chance of Jam" % (fit.scanType, fit.jamChance)))
|
||||
else:
|
||||
label.SetToolTip(wx.ToolTip("Type: %s" % fit.scanType))
|
||||
else:
|
||||
label.SetToolTip(wx.ToolTip(""))
|
||||
elif labelName == "labelFullCargo":
|
||||
if fit:
|
||||
cachedCargo = self._cachedValues[counter]
|
||||
# if you add stuff to cargo, the capacity doesn't change and thus it is still cached
|
||||
# This assures us that we force refresh of cargo tooltip
|
||||
tipLines = [u"Cargohold: {:,.2f}m\u00B3 / {:,.2f}m\u00B3".format(fit.cargoBayUsed, cachedCargo["main"])]
|
||||
for attrName, tipAlias in cargoNamesOrder.items():
|
||||
if cachedCargo[attrName] > 0:
|
||||
tipLines.append(u"{}: {:,.2f}m\u00B3".format(tipAlias, cachedCargo[attrName]))
|
||||
label.SetToolTip(wx.ToolTip(u"\n".join(tipLines)))
|
||||
else:
|
||||
label.SetToolTip(wx.ToolTip(""))
|
||||
|
||||
counter += 1
|
||||
|
||||
self.panel.Layout()
|
||||
self.headerPanel.Layout()
|
||||
|
||||
|
||||
TargetingMiscViewMinimal.register()
|
||||
@@ -66,12 +66,12 @@ class PreferenceDialog(wx.Dialog):
|
||||
|
||||
# Set the height based on a condition. Can all the panels fit in the current height?
|
||||
# If not, use the .GetBestVirtualSize() to ensure that all content is available.
|
||||
minHeight = 360
|
||||
minHeight = 550
|
||||
bestFit = self.GetBestVirtualSize()
|
||||
if minHeight > bestFit[1]:
|
||||
self.SetSizeWH(450, minHeight)
|
||||
self.SetSizeWH(650, minHeight)
|
||||
else:
|
||||
self.SetSizeWH(450, bestFit[1])
|
||||
self.SetSizeWH(650, bestFit[1])
|
||||
|
||||
self.Layout()
|
||||
|
||||
|
||||
@@ -44,5 +44,10 @@ from gui.builtinPreferenceViews import ( # noqa: E402, F401
|
||||
pyfaNetworkPreferences,
|
||||
pyfaHTMLExportPreferences,
|
||||
pyfaCrestPreferences,
|
||||
pyfaUpdatePreferences
|
||||
pyfaContextMenuPreferences,
|
||||
pyfaStatViewPreferences,
|
||||
pyfaUpdatePreferences,
|
||||
pyfaEnginePreferences,
|
||||
pyfaDatabasePreferences,
|
||||
pyfaLoggingPreferences
|
||||
)
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
import wx
|
||||
|
||||
from service.fit import Fit
|
||||
from service.settings import StatViewSettings
|
||||
import gui.mainFrame
|
||||
import gui.builtinStatsViews
|
||||
import gui.globalEvents as GE
|
||||
@@ -28,12 +29,44 @@ import gui.globalEvents as GE
|
||||
from gui.statsView import StatsView
|
||||
from gui.contextMenu import ContextMenu
|
||||
from gui.pyfatogglepanel import TogglePanel
|
||||
from logbook import Logger
|
||||
|
||||
pyfalog = Logger(__name__)
|
||||
|
||||
|
||||
class StatsPane(wx.Panel):
|
||||
DEFAULT_VIEWS = ["resourcesViewFull", "resistancesViewFull", "rechargeViewFull", "firepowerViewFull",
|
||||
"outgoingViewFull", "capacitorViewFull", "targetingmiscViewFull",
|
||||
"priceViewFull"]
|
||||
AVAILIBLE_VIEWS = [
|
||||
"resources",
|
||||
"resistances",
|
||||
"recharge",
|
||||
"firepower",
|
||||
"outgoingView",
|
||||
"capacitor",
|
||||
"targetingMisc",
|
||||
"price",
|
||||
]
|
||||
|
||||
# Don't have these....yet....
|
||||
'''
|
||||
"miningyield", "drones"
|
||||
]
|
||||
'''
|
||||
|
||||
DEFAULT_VIEWS = []
|
||||
|
||||
settings = StatViewSettings.getInstance()
|
||||
|
||||
for aView in AVAILIBLE_VIEWS:
|
||||
if settings.get(aView) == 2:
|
||||
DEFAULT_VIEWS.extend(["%sViewFull" % aView])
|
||||
pyfalog.debug("Setting full view for: {0}", aView)
|
||||
elif settings.get(aView) == 1:
|
||||
DEFAULT_VIEWS.extend(["%sViewMinimal" % aView])
|
||||
pyfalog.debug("Setting minimal view for: {0}", aView)
|
||||
elif settings.get(aView) == 0:
|
||||
pyfalog.debug("Setting disabled view for: {0}", aView)
|
||||
else:
|
||||
pyfalog.error("Unknown setting for view: {0}", aView)
|
||||
|
||||
def fitChanged(self, event):
|
||||
sFit = Fit.getInstance()
|
||||
@@ -66,7 +99,12 @@ class StatsPane(wx.Panel):
|
||||
contentPanel = tp.GetContentPane()
|
||||
contentPanel.viewName = viewName
|
||||
|
||||
view = StatsView.getView(viewName)(self)
|
||||
try:
|
||||
view = StatsView.getView(viewName)(self)
|
||||
pyfalog.debug("Load view: {0}", viewName)
|
||||
except KeyError:
|
||||
pyfalog.error("Attempted to load an invalid view: {0}", viewName)
|
||||
|
||||
self.nameViewMap[viewName] = view
|
||||
self.views.append(view)
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ from gui.builtinStatsViews import ( # noqa: E402, F401
|
||||
miningyieldViewFull,
|
||||
capacitorViewFull,
|
||||
rechargeViewFull,
|
||||
targetingMiscViewFull,
|
||||
targetingMiscViewMinimal,
|
||||
priceViewFull,
|
||||
outgoingViewFull,
|
||||
)
|
||||
|
||||
@@ -22,6 +22,9 @@ import os.path
|
||||
import urllib2
|
||||
|
||||
import config
|
||||
from logbook import Logger
|
||||
|
||||
pyfalog = Logger(__name__)
|
||||
|
||||
|
||||
class SettingsProvider(object):
|
||||
@@ -87,7 +90,8 @@ class Settings(object):
|
||||
def __getitem__(self, k):
|
||||
try:
|
||||
return self.info[k]
|
||||
except KeyError:
|
||||
except KeyError as e:
|
||||
pyfalog.warning("Failed to get setting for '{0}'. Exception: {1}", k, e)
|
||||
return None
|
||||
|
||||
def __setitem__(self, k, v):
|
||||
@@ -133,17 +137,17 @@ class NetworkSettings(object):
|
||||
def __init__(self):
|
||||
|
||||
serviceNetworkDefaultSettings = {
|
||||
"mode": self.PROXY_MODE_AUTODETECT,
|
||||
"type": "https",
|
||||
"address": "",
|
||||
"port": "",
|
||||
"access": 15,
|
||||
"login": None,
|
||||
"mode" : self.PROXY_MODE_AUTODETECT,
|
||||
"type" : "https",
|
||||
"address" : "",
|
||||
"port" : "",
|
||||
"access" : 15,
|
||||
"login" : None,
|
||||
"password": None
|
||||
}
|
||||
|
||||
self.serviceNetworkSettings = SettingsProvider.getInstance().getSettings(
|
||||
"pyfaServiceNetworkSettings", serviceNetworkDefaultSettings)
|
||||
"pyfaServiceNetworkSettings", serviceNetworkDefaultSettings)
|
||||
|
||||
def isEnabled(self, type):
|
||||
if type & self.serviceNetworkSettings["access"]:
|
||||
@@ -256,12 +260,12 @@ class HTMLExportSettings(object):
|
||||
def __init__(self):
|
||||
serviceHTMLExportDefaultSettings = {
|
||||
"enabled": False,
|
||||
"path": config.pyfaPath + os.sep + 'pyfaFits.html',
|
||||
"path" : config.pyfaPath + os.sep + 'pyfaFits.html',
|
||||
"minimal": False
|
||||
}
|
||||
self.serviceHTMLExportSettings = SettingsProvider.getInstance().getSettings(
|
||||
"pyfaServiceHTMLExportSettings",
|
||||
serviceHTMLExportDefaultSettings
|
||||
"pyfaServiceHTMLExportSettings",
|
||||
serviceHTMLExportDefaultSettings
|
||||
)
|
||||
|
||||
def getEnabled(self):
|
||||
@@ -303,8 +307,8 @@ class UpdateSettings(object):
|
||||
# version - Set to release tag that user does not want notifications for
|
||||
serviceUpdateDefaultSettings = {"prerelease": True, 'version': None}
|
||||
self.serviceUpdateSettings = SettingsProvider.getInstance().getSettings(
|
||||
"pyfaServiceUpdateSettings",
|
||||
serviceUpdateDefaultSettings
|
||||
"pyfaServiceUpdateSettings",
|
||||
serviceUpdateDefaultSettings
|
||||
)
|
||||
|
||||
def get(self, type):
|
||||
@@ -331,8 +335,8 @@ class CRESTSettings(object):
|
||||
serviceCRESTDefaultSettings = {"mode": 0, "server": 0, "clientID": "", "clientSecret": "", "timeout": 60}
|
||||
|
||||
self.serviceCRESTSettings = SettingsProvider.getInstance().getSettings(
|
||||
"pyfaServiceCRESTSettings",
|
||||
serviceCRESTDefaultSettings
|
||||
"pyfaServiceCRESTSettings",
|
||||
serviceCRESTDefaultSettings
|
||||
)
|
||||
|
||||
def get(self, type):
|
||||
@@ -341,4 +345,94 @@ class CRESTSettings(object):
|
||||
def set(self, type, value):
|
||||
self.serviceCRESTSettings[type] = value
|
||||
|
||||
|
||||
class StatViewSettings(object):
|
||||
_instance = None
|
||||
|
||||
@classmethod
|
||||
def getInstance(cls):
|
||||
if cls._instance is None:
|
||||
cls._instance = StatViewSettings()
|
||||
|
||||
return cls._instance
|
||||
|
||||
def __init__(self):
|
||||
# mode
|
||||
# 0 - Do not show
|
||||
# 1 - Minimal/Text Only View
|
||||
# 2 - Full View
|
||||
serviceStatViewDefaultSettings = {
|
||||
"resources" : 2,
|
||||
"resistances" : 2,
|
||||
"recharge" : 2,
|
||||
"firepower" : 2,
|
||||
"capacitor" : 2,
|
||||
"targetingMisc": 1,
|
||||
"price" : 2,
|
||||
"miningyield" : 2,
|
||||
"drones" : 2
|
||||
}
|
||||
|
||||
# We don't have these....yet
|
||||
'''
|
||||
"miningyield": 2,
|
||||
"drones": 2
|
||||
'''
|
||||
|
||||
self.serviceStatViewDefaultSettings = SettingsProvider.getInstance().getSettings("pyfaServiceStatViewSettings", serviceStatViewDefaultSettings)
|
||||
|
||||
def get(self, type):
|
||||
return self.serviceStatViewDefaultSettings[type]
|
||||
|
||||
def set(self, type, value):
|
||||
self.serviceStatViewDefaultSettings[type] = value
|
||||
|
||||
|
||||
class ContextMenuSettings(object):
|
||||
_instance = None
|
||||
|
||||
@classmethod
|
||||
def getInstance(cls):
|
||||
if cls._instance is None:
|
||||
cls._instance = ContextMenuSettings()
|
||||
|
||||
return cls._instance
|
||||
|
||||
def __init__(self):
|
||||
# mode
|
||||
# 0 - Do not show
|
||||
# 1 - Show
|
||||
ContextMenuDefaultSettings = {
|
||||
"ammoPattern" : 1,
|
||||
"amount" : 1,
|
||||
"cargo" : 1,
|
||||
"changeAffectingSkills" : 1,
|
||||
"damagePattern" : 1,
|
||||
"droneRemoveStack" : 1,
|
||||
"droneSplit" : 1,
|
||||
"factorReload" : 1,
|
||||
"fighterAbilities" : 1,
|
||||
"implantSet" : 1,
|
||||
"itemStats" : 1,
|
||||
"marketJump" : 1,
|
||||
"metaSwap" : 1,
|
||||
"moduleAmmoPicker" : 1,
|
||||
"moduleGlobalAmmoPicker": 1,
|
||||
"openFit" : 1,
|
||||
"priceClear" : 1,
|
||||
"project" : 1,
|
||||
"shipJump" : 1,
|
||||
"tacticalMode" : 1,
|
||||
"targetResists" : 1,
|
||||
"whProjector" : 1,
|
||||
}
|
||||
|
||||
self.ContextMenuDefaultSettings = SettingsProvider.getInstance().getSettings("pyfaContextMenuSettings", ContextMenuDefaultSettings)
|
||||
|
||||
def get(self, type):
|
||||
return self.ContextMenuDefaultSettings[type]
|
||||
|
||||
def set(self, type, value):
|
||||
self.ContextMenuDefaultSettings[type] = value
|
||||
|
||||
# @todo: migrate fit settings (from fit service) here?
|
||||
|
||||
Reference in New Issue
Block a user