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

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