Initial rollup of #868

This commit is contained in:
Ebag333
2017-02-16 07:38:43 -08:00
parent 1c273210e9
commit 5aa5732606
9 changed files with 98 additions and 22 deletions

View File

@@ -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")

View File

@@ -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()

View File

@@ -1,3 +1,9 @@
__all__ = ["resourcesViewFull", "resistancesViewFull",
"rechargeViewFull", "firepowerViewFull", "capacitorViewFull",
"targetingMiscViewFull", "priceViewFull", "miningyieldViewFull"]
__all__ = [
"resourcesViewFull",
"resistancesViewFull",
"rechargeViewFull",
"firepowerViewFull",
"capacitorViewFull",
"targetingMiscViewMinimal",
"priceViewFull",
]

View File

@@ -21,6 +21,7 @@
import wx
from service.fit import Fit
from service.settings import Settings
import gui.mainFrame
import gui.builtinStatsViews
import gui.globalEvents as GE
@@ -31,9 +32,37 @@ from gui.pyfatogglepanel import TogglePanel
class StatsPane(wx.Panel):
DEFAULT_VIEWS = ["resourcesViewFull", "resistancesViewFull", "rechargeViewFull", "firepowerViewFull",
"capacitorViewFull", "targetingmiscViewFull",
"priceViewFull"]
AVAILIBLE_VIEWS = [
"resources",
"resistances",
"recharge",
"firepower",
"capacitor",
"targetingmisc",
"price",
]
# Don't have these....yet....
'''
"miningyield", "drones"
]
'''
DEFAULT_VIEWS = []
settings = Settings.statViewSettings.getInstance()
for aView in AVAILIBLE_VIEWS:
if settings.get(aView) == 2:
DEFAULT_VIEWS.extend(["%sViewFull" % aView])
if settings.get(aView) == 1:
DEFAULT_VIEWS.extend(["%sViewMinimal" % aView])
# If it's 0, it's disabled and we don't do anything.
# TODO
# Add logging
def fitChanged(self, event):
sFit = Fit.getInstance()
@@ -66,7 +95,12 @@ class StatsPane(wx.Panel):
contentPanel = tp.GetContentPane()
contentPanel.viewName = viewName
view = StatsView.getView(viewName)(self)
try:
view = StatsView.getView(viewName)(self)
except KeyError:
# View doesn't exist. Skip to next view
continue
self.nameViewMap[viewName] = view
self.views.append(view)

View File

@@ -341,4 +341,45 @@ 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
# @todo: migrate fit settings (from fit service) here?