MCPcopy Index your code
hub / github.com/pyfa-org/Pyfa / populatePanel

Method populatePanel

gui/builtinStatsViews/rechargeViewFull.py:61–110  ·  view source on GitHub ↗
(self, contentPanel, headerPanel)

Source from the content-addressed store, hash-verified

59 self.refreshPanel(sFit.getFit(self.mainFrame.getActiveFit()))
60
61 def populatePanel(self, contentPanel, headerPanel):
62 contentSizer = contentPanel.GetSizer()
63
64 self.panel = contentPanel
65 self.headerPanel = headerPanel
66 sizerTankStats = wx.FlexGridSizer(3, 5, 0, 0)
67 for i in range(4):
68 sizerTankStats.AddGrowableCol(i + 1)
69
70 contentSizer.Add(sizerTankStats, 0, wx.EXPAND, 0)
71
72 # Add an empty label first for correct alignment.
73 sizerTankStats.Add(wx.StaticText(contentPanel, wx.ID_ANY, ""), 0)
74 toolTipText = {
75 "shieldPassive": _t("Passive shield recharge"),
76 "shieldActive": _t("Active shield boost"),
77 "armorActive": _t("Armor repair amount"),
78 "hullActive": _t("Hull repair amount")}
79 for tankType in ("shieldPassive", "shieldActive", "armorActive", "hullActive"):
80 bitmap = BitmapLoader.getStaticBitmap("%s_big" % tankType, contentPanel, "gui")
81 tooltip = wx.ToolTip(toolTipText[tankType])
82 bitmap.SetToolTip(tooltip)
83 sizerTankStats.Add(bitmap, 0, wx.ALIGN_CENTER)
84
85 toolTipText = {
86 "reinforced": _t("Reinforced"),
87 "sustained": _t("Sustained")}
88 for stability in ("reinforced", "sustained"):
89 bitmap = BitmapLoader.getStaticBitmap("regen%s_big" % stability.capitalize(), contentPanel, "gui")
90 tooltip = wx.ToolTip(toolTipText[stability])
91 bitmap.SetToolTip(tooltip)
92 sizerTankStats.Add(bitmap, 0, wx.ALIGN_CENTER)
93 for tankType in ("shieldPassive", "shieldActive", "armorActive", "hullActive"):
94 if stability == "reinforced" and tankType == "shieldPassive":
95 sizerTankStats.Add(wx.StaticText(contentPanel, wx.ID_ANY, ""))
96 continue
97
98 tankTypeCap = tankType[0].capitalize() + tankType[1:]
99 lbl = wx.StaticText(contentPanel, wx.ID_ANY, "0.0", style=wx.ALIGN_RIGHT)
100 setattr(self, "labelTank%s%s" % (stability.capitalize(), tankTypeCap), lbl)
101 box = wx.BoxSizer(wx.HORIZONTAL)
102 box.Add(lbl, 0, wx.EXPAND)
103
104 unitlbl = wx.StaticText(contentPanel, wx.ID_ANY, " EHP/s")
105 setattr(self, "unitLabelTank%s%s" % (stability.capitalize(), tankTypeCap), unitlbl)
106 box.Add(unitlbl, 0, wx.EXPAND)
107
108 sizerTankStats.Add(box, 0, wx.ALIGN_CENTRE)
109
110 contentPanel.Layout()
111
112 def refreshPanel(self, fit):
113 # If we did anything interesting, we'd update our labels to reflect the new fit's stats here

Callers

nothing calls this directly

Calls 2

getStaticBitmapMethod · 0.80
_tFunction · 0.50

Tested by

no test coverage detected