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

Method fitChanged

gui/builtinAdditionPanes/cargoView.py:168–201  ·  view source on GitHub ↗
(self, event)

Source from the content-addressed store, hash-verified

166 copy=wx.GetMouseState().GetModifiers() == wx.MOD_CONTROL))
167
168 def fitChanged(self, event):
169 event.Skip()
170 activeFitID = self.mainFrame.getActiveFit()
171 if activeFitID is not None and activeFitID not in event.fitIDs:
172 return
173
174 sFit = Fit.getInstance()
175 fit = sFit.getFit(activeFitID)
176
177 # self.Parent.Parent.DisablePage(self, not fit or fit.isStructure)
178
179 # Clear list and get out if current fitId is None
180 if activeFitID is None and self.lastFitId is not None:
181 self.DeleteAllItems()
182 self.lastFitId = None
183 return
184
185 self.original = fit.cargo if fit is not None else None
186 self.cargo = fit.cargo[:] if fit is not None else None
187 if self.cargo is not None:
188 self.cargo.sort(key=lambda c: (c.item.group.category.name, c.item.group.name, c.item.name))
189
190 if activeFitID != self.lastFitId:
191 self.lastFitId = activeFitID
192
193 item = self.GetNextItem(-1, wx.LIST_NEXT_ALL, wx.LIST_STATE_DONTCARE)
194
195 if item != -1:
196 self.EnsureVisible(item)
197
198 self.unselectAll()
199
200 self.populate(self.cargo)
201 self.refresh(self.cargo)
202
203 def onLeftDoubleClick(self, event):
204 row, _ = self.HitTest(event.Position)

Callers

nothing calls this directly

Calls 7

getFitMethod · 0.80
unselectAllMethod · 0.80
getActiveFitMethod · 0.45
getInstanceMethod · 0.45
sortMethod · 0.45
populateMethod · 0.45
refreshMethod · 0.45

Tested by

no test coverage detected