Refactor how RR panel labels are processed a little
This commit is contained in:
@@ -52,25 +52,20 @@ class OutgoingViewFull(StatsView):
|
|||||||
counter = 0
|
counter = 0
|
||||||
|
|
||||||
rr_list = [
|
rr_list = [
|
||||||
("RemoteCapacitor", "Capacitor:", "capacitorInfo", "Capacitor restored"),
|
("labelRemoteCapacitor", "Capacitor:", "0 GJ/s", "capacitorInfo", "Capacitor restored"),
|
||||||
("RemoteShield", "Shield:", "shieldActive", "Shield restored"),
|
("labelRemoteShield", "Shield:", "0 HP/s", "shieldActive", "Shield restored"),
|
||||||
("RemoteArmor", "Armor:", "armorActive", "Armor restored"),
|
("labelRemoteArmor", "Armor:", "0 HP/s", "armorActive", "Armor restored"),
|
||||||
("RemoteHull", "Hull:", "hullActive", "Hull 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 = wx.BoxSizer(wx.VERTICAL)
|
||||||
|
|
||||||
baseBox.Add(BitmapLoader.getStaticBitmap("%s_big" % image, parent, "gui"), 0, wx.ALIGN_CENTER)
|
baseBox.Add(BitmapLoader.getStaticBitmap("%s_big" % image, parent, "gui"), 0, wx.ALIGN_CENTER)
|
||||||
|
|
||||||
if "Capacitor" in outgoingType:
|
lbl = wx.StaticText(parent, wx.ID_ANY, labelAmount)
|
||||||
lbl = wx.StaticText(parent, wx.ID_ANY, "0 GJ/s")
|
|
||||||
else:
|
|
||||||
lbl = wx.StaticText(parent, wx.ID_ANY, "0 HP/s")
|
|
||||||
|
|
||||||
lbl.SetToolTip(wx.ToolTip(tooltip))
|
lbl.SetToolTip(wx.ToolTip(tooltip))
|
||||||
|
setattr(self, labelName, lbl)
|
||||||
setattr(self, "label%s" % outgoingType, lbl)
|
|
||||||
|
|
||||||
baseBox.Add(lbl, 0, wx.ALIGN_CENTER)
|
baseBox.Add(lbl, 0, wx.ALIGN_CENTER)
|
||||||
self._cachedValues.append(0)
|
self._cachedValues.append(0)
|
||||||
|
|||||||
@@ -51,25 +51,20 @@ class OutgoingViewMinimal(StatsView):
|
|||||||
counter = 0
|
counter = 0
|
||||||
|
|
||||||
rr_list = [
|
rr_list = [
|
||||||
("RemoteCapacitor", "Capacitor:", "capacitorInfo", "Capacitor restored"),
|
("labelRemoteCapacitor", "Capacitor:", "0 GJ/s", "capacitorInfo", "Capacitor restored"),
|
||||||
("RemoteShield", "Shield:", "shieldActive", "Shield restored"),
|
("labelRemoteShield", "Shield:", "0 HP/s", "shieldActive", "Shield restored"),
|
||||||
("RemoteArmor", "Armor:", "armorActive", "Armor restored"),
|
("labelRemoteArmor", "Armor:", "0 HP/s", "armorActive", "Armor restored"),
|
||||||
("RemoteHull", "Hull:", "hullActive", "Hull 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 = wx.BoxSizer(wx.VERTICAL)
|
||||||
|
|
||||||
baseBox.Add(wx.StaticText(contentPanel, wx.ID_ANY, label), 0, wx.ALIGN_CENTER)
|
baseBox.Add(wx.StaticText(contentPanel, wx.ID_ANY, labelDesc), 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))
|
lbl.SetToolTip(wx.ToolTip(tooltip))
|
||||||
|
setattr(self, labelName, lbl)
|
||||||
setattr(self, "label%s" % outgoingType, lbl)
|
|
||||||
|
|
||||||
baseBox.Add(lbl, 0, wx.ALIGN_CENTER)
|
baseBox.Add(lbl, 0, wx.ALIGN_CENTER)
|
||||||
self._cachedValues.append(0)
|
self._cachedValues.append(0)
|
||||||
|
|||||||
Reference in New Issue
Block a user