From 3265b1db8a8ad0e1be5eee7757310e3a5c3f6324 Mon Sep 17 00:00:00 2001 From: HomeWorld Date: Fri, 3 Sep 2010 10:18:09 +0300 Subject: [PATCH] Fixed a rare occurance where an attribute from stats can be None, do the sanity check first before throwing the value to shorten func; cleaned up some commented lines --- gui/statsPane.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/gui/statsPane.py b/gui/statsPane.py index 7f15f257f..11b9836de 100644 --- a/gui/statsPane.py +++ b/gui/statsPane.py @@ -94,12 +94,9 @@ class StatsPane(wx.Panel): for labelName, value, rounding in stats: label = getattr(self, labelName) - label.SetLabel(shorten(value() if fit is not None else 0, rounding)) - -# resMax = (("cpuTotal", lambda: fit.ship.getModifiedItemAttr("cpuOutput")), -# ("pgTotal", lambda: fit.ship.getModifiedItemAttr("powerOutput")), -# ("droneBayTotal", lambda: fit.ship.getModifiedItemAttr("droneCapacity")), -# ("droneBandwidthTotal", lambda: fit.ship.getModifiedItemAttr("droneBandwidth"))) + value = value() if fit is not None else 0 + value = value if value is not None else 0 + label.SetLabel(shorten(value, rounding)) # cap stuff capState = fit.capState if fit is not None else 0