From 12227cd01624c41f77bed322eb2f074dcbe04426 Mon Sep 17 00:00:00 2001 From: DarkPhoenix Date: Wed, 12 Dec 2018 08:53:25 +0300 Subject: [PATCH] Refactor how RR panel labels are processed a little --- gui/builtinStatsViews/outgoingViewFull.py | 19 +++++++----------- gui/builtinStatsViews/outgoingViewMinimal.py | 21 ++++++++------------ 2 files changed, 15 insertions(+), 25 deletions(-) diff --git a/gui/builtinStatsViews/outgoingViewFull.py b/gui/builtinStatsViews/outgoingViewFull.py index 5d8d7cbb0..b05e46a67 100644 --- a/gui/builtinStatsViews/outgoingViewFull.py +++ b/gui/builtinStatsViews/outgoingViewFull.py @@ -52,25 +52,20 @@ class OutgoingViewFull(StatsView): counter = 0 rr_list = [ - ("RemoteCapacitor", "Capacitor:", "capacitorInfo", "Capacitor restored"), - ("RemoteShield", "Shield:", "shieldActive", "Shield restored"), - ("RemoteArmor", "Armor:", "armorActive", "Armor restored"), - ("RemoteHull", "Hull:", "hullActive", "Hull restored"), + ("labelRemoteCapacitor", "Capacitor:", "0 GJ/s", "capacitorInfo", "Capacitor restored"), + ("labelRemoteShield", "Shield:", "0 HP/s", "shieldActive", "Shield restored"), + ("labelRemoteArmor", "Armor:", "0 HP/s", "armorActive", "Armor restored"), + ("labelRemoteHull", "Hull:", "0 HP/s", "hullActive", "Hull restored"), ] - for outgoingType, label, image, tooltip in rr_list: + for labelName, labelDesc, labelAmount, image, tooltip in rr_list: baseBox = wx.BoxSizer(wx.VERTICAL) baseBox.Add(BitmapLoader.getStaticBitmap("%s_big" % image, parent, "gui"), 0, wx.ALIGN_CENTER) - if "Capacitor" in outgoingType: - lbl = wx.StaticText(parent, wx.ID_ANY, "0 GJ/s") - else: - lbl = wx.StaticText(parent, wx.ID_ANY, "0 HP/s") - + lbl = wx.StaticText(parent, wx.ID_ANY, labelAmount) lbl.SetToolTip(wx.ToolTip(tooltip)) - - setattr(self, "label%s" % outgoingType, lbl) + setattr(self, labelName, lbl) baseBox.Add(lbl, 0, wx.ALIGN_CENTER) self._cachedValues.append(0) diff --git a/gui/builtinStatsViews/outgoingViewMinimal.py b/gui/builtinStatsViews/outgoingViewMinimal.py index 7b0aa1431..08bfae479 100644 --- a/gui/builtinStatsViews/outgoingViewMinimal.py +++ b/gui/builtinStatsViews/outgoingViewMinimal.py @@ -51,25 +51,20 @@ class OutgoingViewMinimal(StatsView): counter = 0 rr_list = [ - ("RemoteCapacitor", "Capacitor:", "capacitorInfo", "Capacitor restored"), - ("RemoteShield", "Shield:", "shieldActive", "Shield restored"), - ("RemoteArmor", "Armor:", "armorActive", "Armor restored"), - ("RemoteHull", "Hull:", "hullActive", "Hull restored"), + ("labelRemoteCapacitor", "Capacitor:", "0 GJ/s", "capacitorInfo", "Capacitor restored"), + ("labelRemoteShield", "Shield:", "0 HP/s", "shieldActive", "Shield restored"), + ("labelRemoteArmor", "Armor:", "0 HP/s", "armorActive", "Armor restored"), + ("labelRemoteHull", "Hull:", "0 HP/s", "hullActive", "Hull restored"), ] - for outgoingType, label, image, tooltip in rr_list: + for labelName, labelDesc, labelAmount, image, tooltip in rr_list: baseBox = wx.BoxSizer(wx.VERTICAL) - baseBox.Add(wx.StaticText(contentPanel, wx.ID_ANY, label), 0, wx.ALIGN_CENTER) - - if "Capacitor" in outgoingType: - lbl = wx.StaticText(parent, wx.ID_ANY, "0 GJ/s") - else: - lbl = wx.StaticText(parent, wx.ID_ANY, "0 HP/s") + baseBox.Add(wx.StaticText(contentPanel, wx.ID_ANY, labelDesc), 0, wx.ALIGN_CENTER) + lbl = wx.StaticText(parent, wx.ID_ANY, labelAmount) lbl.SetToolTip(wx.ToolTip(tooltip)) - - setattr(self, "label%s" % outgoingType, lbl) + setattr(self, labelName, lbl) baseBox.Add(lbl, 0, wx.ALIGN_CENTER) self._cachedValues.append(0)