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

Method fitRemoved

gui/builtinViews/fittingView.py:302–330  ·  view source on GitHub ↗

If fit is removed and active, the page is deleted. We also refresh the fit of the new current page in case delete fit caused change in stats (projected) todo: move this to the notebook, not the page. We don't want the page being responsible for deleting itself

(self, event)

Source from the content-addressed store, hash-verified

300 event.Skip()
301
302 def fitRemoved(self, event):
303 """
304 If fit is removed and active, the page is deleted.
305 We also refresh the fit of the new current page in case
306 delete fit caused change in stats (projected)
307 todo: move this to the notebook, not the page. We don't want the page being responsible for deleting itself
308 """
309 pyfalog.debug("FittingView::fitRemoved")
310 if not self:
311 event.Skip()
312 return
313 if event.fitID == self.getActiveFit():
314 pyfalog.debug(" Deleted fit is currently active")
315 self.parent.DeletePage(self.parent.GetPageIndex(self))
316
317 try:
318 # Sometimes there is no active page after deletion, hence the try block
319 sFit = Fit.getInstance()
320
321 # stopgap for #1384
322 fit = sFit.getFit(self.getActiveFit())
323 if fit:
324 sFit.refreshFit(self.getActiveFit())
325 wx.PostEvent(self.mainFrame, GE.FitChanged(fitIDs=(self.activeFitID,)))
326 except RuntimeError:
327 pyfalog.warning("Caught dead object")
328 pass
329
330 event.Skip()
331
332 def fitRenamed(self, event):
333 if not self:

Callers

nothing calls this directly

Calls 6

getActiveFitMethod · 0.95
GetPageIndexMethod · 0.80
getFitMethod · 0.80
refreshFitMethod · 0.80
DeletePageMethod · 0.45
getInstanceMethod · 0.45

Tested by

no test coverage detected