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

Method fitChanged

gui/builtinAdditionPanes/fighterView.py:101–129  ·  view source on GitHub ↗
(self, event)

Source from the content-addressed store, hash-verified

99 self.mainFrame.Bind(GE.FIT_CHANGED, self.fitChanged)
100
101 def fitChanged(self, event):
102 event.Skip()
103 activeFitID = self.mainFrame.getActiveFit()
104 if activeFitID is not None and activeFitID not in event.fitIDs:
105 return
106
107 sFit = Fit.getInstance()
108 fit = sFit.getFit(activeFitID)
109
110 if fit:
111 for x, _ in self.labels:
112 if fit.isStructure:
113 slot = getattr(FittingSlot, "FS_{}".format(x.upper()))
114 else:
115 slot = getattr(FittingSlot, "F_{}".format(x.upper()))
116 used = fit.getSlotsUsed(slot)
117 total = fit.getNumSlots(slot)
118 color = wx.Colour(204, 51, 51) if used > total else wx.SystemSettings.GetColour(
119 wx.SYS_COLOUR_WINDOWTEXT)
120
121 lbl = getattr(self, "label%sUsed" % x.capitalize())
122 lbl.SetLabel(str(int(used)))
123 lbl.SetForegroundColour(color)
124
125 lbl = getattr(self, "label%sTotal" % x.capitalize())
126 lbl.SetLabel(str(int(total)))
127 lbl.SetForegroundColour(color)
128
129 self.Refresh()
130
131 def getTabExtraText(self):
132 fitID = self.mainFrame.getActiveFit()

Callers

nothing calls this directly

Calls 7

getFitMethod · 0.80
getSlotsUsedMethod · 0.80
getNumSlotsMethod · 0.80
SetLabelMethod · 0.80
getActiveFitMethod · 0.45
getInstanceMethod · 0.45
RefreshMethod · 0.45

Tested by

no test coverage detected