Fix capitalization and set up some logging to help catch errors.

This commit is contained in:
Ebag333
2017-02-26 11:09:56 -08:00
parent a43de00153
commit fbf35edae2
4 changed files with 21 additions and 14 deletions

View File

@@ -29,7 +29,7 @@ except ImportError:
class TargetingMiscViewMinimal(StatsView):
name = "targetingmiscViewMinimal"
name = "targetingMiscViewMinimal"
def __init__(self, parent):
StatsView.__init__(self)

View File

@@ -29,6 +29,9 @@ 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):
@@ -38,7 +41,7 @@ class StatsPane(wx.Panel):
"recharge",
"firepower",
"capacitor",
"targetingmisc",
"targetingMisc",
"price",
]
@@ -55,14 +58,14 @@ class StatsPane(wx.Panel):
for aView in AVAILIBLE_VIEWS:
if settings.get(aView) == 2:
DEFAULT_VIEWS.extend(["%sViewFull" % aView])
if settings.get(aView) == 1:
pyfalog.debug("Setting full view for: {0}", aView)
elif 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
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()
@@ -97,9 +100,9 @@ class StatsPane(wx.Panel):
try:
view = StatsView.getView(viewName)(self)
pyfalog.debug("Load view: {0}", viewName)
except KeyError:
# View doesn't exist. Skip to next view
continue
pyfalog.error("Attempted to load an invalid view: {0}", viewName)
self.nameViewMap[viewName] = view
self.views.append(view)

View File

@@ -50,6 +50,6 @@ from gui.builtinStatsViews import ( # noqa: E402, F401
miningyieldViewFull,
capacitorViewFull,
rechargeViewFull,
targetingMiscViewFull,
targetingMiscViewMinimal,
priceViewFull,
)

View File

@@ -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):
@@ -363,7 +367,7 @@ class StatViewSettings(object):
"recharge" : 2,
"firepower" : 2,
"capacitor" : 2,
"targetingmisc": 1,
"targetingMisc": 1,
"price" : 2,
"miningyield" : 2,
"drones" : 2