def activate(self, fullContext, selection, i): srcContext = fullContext[0] if srcContext == "fittingShip": fitID = self.mainFrame.getActiveFit() sFit = service.Fit.getInstance() stuff = sFit.getFit(fitID).ship else: stuff = selection[0] if srcContext == "fittingModule" and stuff.isEmpty: return mstate = wx.GetMouseState() reuse = False if mstate.CmdDown(): reuse = True if self.mainFrame.GetActiveStatsWindow() == None and reuse: ItemStatsDialog(stuff, fullContext) elif reuse: lastWnd = self.mainFrame.GetActiveStatsWindow() pos = lastWnd.GetPosition() maximized = lastWnd.IsMaximized() if not maximized: size = lastWnd.GetSize() else: size = wx.DefaultSize pos = wx.DefaultPosition ItemStatsDialog(stuff, fullContext, pos, size, maximized) lastWnd.closeEvent(None) else: ItemStatsDialog(stuff, fullContext)
def activate(self, fullContext, mainItem, i): srcContext = fullContext[0] if srcContext == "fittingShip": fitID = self.mainFrame.getActiveFit() sFit = Fit.getInstance() stuff = sFit.getFit(fitID).ship elif srcContext == "fittingMode": stuff = mainItem.item else: stuff = mainItem if srcContext == "fittingModule" and stuff.isEmpty: return mstate = wx.GetMouseState() reuse = False if mstate.GetModifiers() == wx.MOD_SHIFT: reuse = True if self.mainFrame.GetActiveStatsWindow() is None and reuse: ItemStatsDialog(stuff, fullContext) elif reuse: lastWnd = self.mainFrame.GetActiveStatsWindow() pos = lastWnd.GetPosition() maximized = lastWnd.IsMaximized() if not maximized: size = lastWnd.GetSize() else: size = wx.DefaultSize pos = wx.DefaultPosition ItemStatsDialog(stuff, fullContext, pos, size, maximized) lastWnd.Close() else: ItemStatsDialog(stuff, fullContext)
def activate(self, context, selection, i): if context == "ship": fitID = self.mainFrame.getActiveFit() cFit = service.Fit.getInstance() stuff = cFit.getFit(fitID).ship else: stuff = selection[0] if context == "module" and stuff.isEmpty: return dlg = ItemStatsDialog( stuff, context.capitalize() if context not in self.REPLACES else self.REPLACES[context])