def _onOpenFit(fitId, inNewTab): mainFrame = gui.mainFrame.MainFrame.getInstance() if not fitId is None: if inNewTab: wx.PostEvent(mainFrame, FitSelected(fitID=fitId, startup=2)) else: wx.PostEvent(mainFrame, FitSelected(fitID=fitId))
def run(self): time.sleep(0.5) # Give GUI some time to finish drawing # `startup` tells FitSpawner that we are loading fits are startup, and # has 3 values: # False = Set as default in FitSpawner itself, never set here # 1 = Create new fit page, but do not calculate page # 2 = Create new page and calculate # We use 1 for all fits except the last one where we use 2 so that we # have correct calculations displayed at startup for fitID in self.fits[:-1]: wx.PostEvent(self.mainFrame, FitSelected(fitID=fitID, startup=1)) wx.PostEvent(self.mainFrame, FitSelected(fitID=self.fits[-1], startup=2)) wx.CallAfter(self.callback)
def run(self): # wait 1 second just in case a lot of modifications get made if self.stopRunning: return for fit in self.fits: time.sleep(1) e = FitSelected(fitID=fit) wx.PostEvent(self.mainFrame, e)
def _openAfterImport(self, fits): if len(fits) > 0: if len(fits) == 1: fit = fits[0] wx.PostEvent(self, FitSelected(fitID=fit.ID, from_import=True)) wx.PostEvent(self.shipBrowser, Stage3Selected(shipID=fit.shipID, back=True)) else: fits.sort(key=lambda _fit: (_fit.ship.item.name, _fit.name)) results = [] for fit in fits: results.append((fit.ID, fit.name, fit.modifiedCoalesce, fit.ship.item, fit.notes)) wx.PostEvent(self.shipBrowser, ImportSelected(fits=results, back=True))
def handleDrag(self, type, fitID): # Those are drags coming from pyfa sources, NOT builtin wx drags if type == "fit": wx.PostEvent(self.mainFrame, FitSelected(fitID=fitID))
def activate(self, fullContext, selection, i): fit = selection[0] wx.PostEvent(self.mainFrame, FitSelected(fitID=fit.ID, startup=2))
def activate(self, callingWindow, fullContext, mainItem, i): if isinstance(mainItem, BaseWrapper): mainItem = mainItem.item wx.PostEvent(self.mainFrame, FitSelected(fitID=mainItem.ID, startup=2))
def activate(self, fullContext, mainItem, i): wx.PostEvent(self.mainFrame, FitSelected(fitID=mainItem.ID, startup=2))