def switchToMiningYieldView(self, event): # Getting the active fit mainFrame = gui.mainFrame.MainFrame.getInstance() sFit = service.Fit.getInstance() fit = sFit.getFit(mainFrame.getActiveFit()) # Remove ourselves from statsPane's view list self.parent.views.remove(self) self._cachedValues = [] # And no longer display us self.panel.GetSizer().Clear(True) self.panel.GetSizer().Layout() # Remove effective label hsizer = self.headerPanel.GetSizer() hsizer.Remove(self.stEff) self.stEff.Destroy() # Get the new view view = StatsView.getView("miningyieldViewFull")(self.parent) view.populatePanel(self.panel, self.headerPanel) # Populate us in statsPane's view list self.parent.views.append(view) # Get the TogglePanel tp = self.panel.GetParent() tp.SetLabel(view.getHeaderText(fit)) view.refreshPanel(fit)
def switchToMiningYieldView(self, event): # Getting the active fit mainFrame = gui.mainFrame.MainFrame.getInstance() sFit = Fit.getInstance() fit = sFit.getFit(mainFrame.getActiveFit()) # Remove ourselves from statsPane's view list self.parent.views.remove(self) self._cachedValues = [] # And no longer display us self.panel.GetSizer().Clear(True) self.panel.GetSizer().Layout() # Remove effective label hsizer = self.headerPanel.Parent.GetHeaderContentSizer() for i, c in enumerate(hsizer.Children): if c.GetWindow() is self.stEff: hsizer.Remove(i) self.stEff.Destroy() break # Get the new view view = StatsView.getView("miningyieldViewFull")(self.parent) view.populatePanel(self.panel, self.headerPanel) # Populate us in statsPane's view list self.parent.views.append(view) # Get the TogglePanel tp = self.panel.GetParent() tp.SetLabel(view.getHeaderText(fit)) view.refreshPanel(fit)
def activate(self, fullContext, selection, i): thing = selection[0] mainFrame = gui.mainFrame.MainFrame.getInstance() fitID = mainFrame.getActiveFit() if isinstance(thing, es_Fit): value = thing.getProjectionInfo(fitID).amount else: value = thing.amount dlg = AmountChanger(self.mainFrame, value) if dlg.ShowModal() == wx.ID_OK: if dlg.input.GetLineText(0).strip() == '': return sFit = Fit.getInstance() cleanInput = re.sub(r'[^0-9.]', '', dlg.input.GetLineText(0).strip()) if isinstance(thing, es_Cargo): sFit.addCargo(fitID, thing.item.ID, int(float(cleanInput)), replace=True) elif isinstance(thing, es_Fit): sFit.changeAmount(fitID, thing, int(float(cleanInput))) elif isinstance(thing, es_Fighter): sFit.changeActiveFighters(fitID, thing, int(float(cleanInput))) wx.PostEvent(mainFrame, GE.FitChanged(fitID=fitID))
def IsWidgetSelectedByContext(self, widget): mainFrame = gui.mainFrame.MainFrame.getInstance() stage = self.Parent.GetActiveStage() fit = mainFrame.getActiveFit() if stage == 3 or stage == 4: if self._wList[widget].GetType() == 3: if fit == self._wList[widget].fitID: return True return False
def split(self, event): sFit = Fit.getInstance() mainFrame = gui.mainFrame.MainFrame.getInstance() fitID = mainFrame.getActiveFit() if self.context == "droneItem": sFit.splitDroneStack(fitID, self.drone, self.spinner.GetValue()) else: sFit.splitProjectedDroneStack(fitID, self.drone, self.spinner.GetValue()) wx.PostEvent(mainFrame, GE.FitChanged(fitID=fitID)) event.Skip()
def change(self, event): sFit = service.Fit.getInstance() mainFrame = gui.mainFrame.MainFrame.getInstance() fitID = mainFrame.getActiveFit() sFit.addCargo(fitID, self.cargo.item.ID, int(self.input.GetLineText(0)), replace=True) wx.PostEvent(mainFrame, GE.FitChanged(fitID=fitID)) event.Skip() self.Destroy()
def activate(self, fullContext, selection, i): thing = selection[0] mainFrame = gui.mainFrame.MainFrame.getInstance() fitID = mainFrame.getActiveFit() srcContext = fullContext[0] if isinstance(thing, es_Fit): value = thing.getProjectionInfo(fitID).amount elif isinstance(thing, es_Fighter): value = thing.amountActive else: value = thing.amount dlg = AmountChanger(self.mainFrame, value, (0, 20)) if isinstance( thing, es_Fit) else AmountChanger(self.mainFrame, value) if dlg.ShowModal() == wx.ID_OK: if dlg.input.GetLineText(0).strip() == '': return sFit = Fit.getInstance() fit = sFit.getFit(fitID) cleanInput = int( float(re.sub(r'[^0-9.]', '', dlg.input.GetLineText(0).strip()))) if isinstance(thing, es_Cargo): self.mainFrame.command.Submit( cmd.GuiChangeCargoAmountCommand(fitID, thing.itemID, cleanInput)) elif isinstance(thing, Drone): if srcContext == "projectedDrone": self.mainFrame.command.Submit( cmd.GuiChangeProjectedDroneAmountCommand( fitID, thing.itemID, cleanInput)) else: self.mainFrame.command.Submit( cmd.GuiChangeLocalDroneAmountCommand( fitID, fit.drones.index(thing), cleanInput)) elif isinstance(thing, es_Fit): self.mainFrame.command.Submit( cmd.GuiChangeProjectedFitAmountCommand( fitID, thing.ID, cleanInput)) elif isinstance(thing, es_Fighter): if srcContext == "projectedFighter": self.mainFrame.command.Submit( cmd.GuiChangeProjectedFighterAmountCommand( fitID, fit.projectedFighters.index(thing), cleanInput)) else: self.mainFrame.command.Submit( cmd.GuiChangeLocalFighterAmountCommand( fitID, fit.fighters.index(thing), cleanInput))
def change(self, event): sFit = service.Fit.getInstance() mainFrame = gui.mainFrame.MainFrame.getInstance() fitID = mainFrame.getActiveFit() if isinstance(self.thing, eos.types.Cargo): sFit.addCargo(fitID, self.thing.item.ID, int(self.input.GetLineText(0)), replace=True) elif isinstance(self.thing, eos.types.Fit): sFit.changeAmount(fitID, self.thing, int(self.input.GetLineText(0))) wx.PostEvent(mainFrame, GE.FitChanged(fitID=fitID)) event.Skip() self.Close()
def activate(self, fullContext, selection, i): thing = selection[0] mainFrame = gui.mainFrame.MainFrame.getInstance() fitID = mainFrame.getActiveFit() srcContext = fullContext[0] if isinstance(thing, es_Fit): value = thing.getProjectionInfo(fitID).amount else: value = thing.amount dlg = AmountChanger(self.mainFrame, value) if dlg.ShowModal() == wx.ID_OK: if dlg.input.GetLineText(0).strip() == '': return sFit = Fit.getInstance() fit = sFit.getFit(fitID) cleanInput = re.sub(r'[^0-9.]', '', dlg.input.GetLineText(0).strip()) if isinstance(thing, es_Cargo): self.mainFrame.command.Submit( cmd.GuiChangeCargoQty(fitID, fit.cargo.index(thing), int(float(cleanInput)))) return # no need for post event here elif isinstance(thing, Drone): if srcContext == "droneItem": self.mainFrame.command.Submit( cmd.GuiChangeDroneQty(fitID, fit.drones.index(thing), int(float(cleanInput)))) else: self.mainFrame.command.Submit( cmd.GuiChangeProjectedDroneQty( fitID, fit.projectedDrones.index(thing), int(float(cleanInput)))) elif isinstance(thing, es_Fit): self.mainFrame.command.Submit( cmd.GuiChangeProjectedFitQty(fitID, thing.ID, int(float(cleanInput)))) return elif isinstance(thing, es_Fighter): self.mainFrame.command.Submit( cmd.GuiChangeFighterQty(fitID, fit.fighters.index(thing), int(float(cleanInput)))) return wx.PostEvent(mainFrame, GE.FitChanged(fitID=fitID))
def change(self, event): sFit = service.Fit.getInstance() mainFrame = gui.mainFrame.MainFrame.getInstance() fitID = mainFrame.getActiveFit() if isinstance(self.thing, eos.types.Cargo): sFit.addCargo(fitID, self.thing.item.ID, int(self.input.GetLineText(0)), replace=True) elif isinstance(self.thing, eos.types.Fit): sFit.changeAmount(fitID, self.thing, int(self.input.GetLineText(0))) elif isinstance(self.thing, eos.types.Fighter): sFit.changeActiveFighters(fitID, self.thing, int(self.input.GetLineText(0))) wx.PostEvent(mainFrame, GE.FitChanged(fitID=fitID)) event.Skip() self.Close()
def callLater(self): self.timer = None sFit = Fit.getInstance() # recalc the fit that this module affects. This is not necessarily the currently active fit sFit.refreshFit(self.activeFit) mainFrame = gui.mainFrame.MainFrame.getInstance() activeFit = mainFrame.getActiveFit() if activeFit != self.activeFit: # if we're no longer on the fit this module is affecting, simulate a "switch fit" so that the active fit # can be recalculated (if needed) sFit.switchFit(activeFit) # Send signal to GUI to update stats with current active fit wx.PostEvent(mainFrame, GE.FitChanged(fitID=activeFit))
def callLater(self): self.timer = None sFit = Fit.getInstance() # recalc the fit that this module affects. This is not necessarily the currently active fit sFit.refreshFit(self.carryingFitID) mainFrame = gui.mainFrame.MainFrame.getInstance() activeFit = mainFrame.getActiveFit() if activeFit != self.carryingFitID: # if we're no longer on the fit this module is affecting, simulate a "switch fit" so that the active fit # can be recalculated (if needed) sFit.switchFit(activeFit) # Send signal to GUI to update stats with current active fit wx.PostEvent(mainFrame, GE.FitChanged(fitIDs=(activeFit, )))
def change(self, event): sFit = Fit.getInstance() if self.input.GetLineText(0).strip() == '': event.Skip() return sFit = Fit.getInstance() mainFrame = gui.mainFrame.MainFrame.getInstance() fitID = mainFrame.getActiveFit() if isinstance(self.thing, es_Cargo): sFit.addCargo(fitID, self.thing.item.ID, int(float(self.input.GetLineText(0))), replace=True) elif isinstance(self.thing, eos.types.Fit): sFit.changeAmount(fitID, self.thing, int(float(self.input.GetLineText(0)))) elif isinstance(self.thing, es_Fighter): sFit.changeActiveFighters(fitID, self.thing, int(float(self.input.GetLineText(0)))) wx.PostEvent(mainFrame, GE.FitChanged(fitID=fitID)) event.Skip()
def switchToFirepowerView(self, event): # Getting the active fit mainFrame = gui.mainFrame.MainFrame.getInstance() sFit = Fit.getInstance() fit = sFit.getFit(mainFrame.getActiveFit()) # Remove ourselves from statsPane's view list self.parent.views.remove(self) self._cachedValues = [] # And no longer display us self.panel.GetSizer().Clear(True) self.panel.GetSizer().Layout() # Get the new view view = StatsView.getView("firepowerViewFull")(self.parent) view.populatePanel(self.panel, self.headerPanel) # Populate us in statsPane's view list self.parent.views.append(view) # Get the TogglePanel tp = self.panel.GetParent() tp.SetLabel(view.getHeaderText(fit)) view.refreshPanel(fit)
def switchToFirepowerView(self, event): # Getting the active fit mainFrame = gui.mainFrame.MainFrame.getInstance() sFit = Fit.getInstance() fit = sFit.getFit(mainFrame.getActiveFit()) # Remove ourselves from statsPane's view list self.parent.views.remove(self) self._cachedValues = [] # And no longer display us self.panel.GetSizer().Clear(True) self.panel.GetSizer().Layout() # Get the new view view = StatsView.getView("firepowerViewFull")(self.parent) view.populatePanel(self.panel, self.headerPanel) # Populate us in statsPane's view list self.parent.views.append(view) # Get the TogglePanel tp = self.panel.GetParent() # Bind the new panel's children to allow context menu access tp.SetLabel(view.getHeaderText(fit)) view.refreshPanel(fit)
def change(self, event): if self.input.GetLineText(0).strip() == '': event.Skip() self.Close() return sFit = Fit.getInstance() cleanInput = re.sub(r'[^0-9.]', '', self.input.GetLineText(0).strip()) mainFrame = gui.mainFrame.MainFrame.getInstance() fitID = mainFrame.getActiveFit() if isinstance(self.thing, es_Cargo): sFit.addCargo(fitID, self.thing.item.ID, int(float(cleanInput)), replace=True) elif isinstance(self.thing, es_Fit): sFit.changeAmount(fitID, self.thing, int(float(cleanInput))) elif isinstance(self.thing, es_Fighter): sFit.changeActiveFighters(fitID, self.thing, int(float(cleanInput))) wx.PostEvent(mainFrame, GE.FitChanged(fitID=fitID)) event.Skip() self.Close()
def activate(self, fullContext, mainItem, i): mainFrame = gui.mainFrame.MainFrame.getInstance() fitID = mainFrame.getActiveFit() srcContext = fullContext[0] if isinstance(mainItem, es_Fit): try: value = mainItem.getProjectionInfo(fitID).amount except AttributeError: return elif isinstance(mainItem, es_Fighter): value = mainItem.amountActive else: value = mainItem.amount dlg = AmountChanger(self.mainFrame, value, (0, 20)) if isinstance( mainItem, es_Fit) else AmountChanger(self.mainFrame, value) if dlg.ShowModal() == wx.ID_OK: if dlg.input.GetLineText(0).strip() == '': return sFit = Fit.getInstance() fit = sFit.getFit(fitID) cleanInput = int( float(re.sub(r'[^0-9.]', '', dlg.input.GetLineText(0).strip()))) if isinstance(mainItem, es_Cargo): self.mainFrame.command.Submit( cmd.GuiChangeCargoAmountCommand(fitID=fitID, itemID=mainItem.itemID, amount=cleanInput)) elif isinstance(mainItem, Drone): if srcContext == "projectedDrone": self.mainFrame.command.Submit( cmd.GuiChangeProjectedDroneAmountCommand( fitID=fitID, itemID=mainItem.itemID, amount=cleanInput)) else: if mainItem in fit.drones: position = fit.drones.index(mainItem) self.mainFrame.command.Submit( cmd.GuiChangeLocalDroneAmountCommand( fitID=fitID, position=position, amount=cleanInput)) elif isinstance(mainItem, es_Fit): self.mainFrame.command.Submit( cmd.GuiChangeProjectedFitAmountCommand( fitID=fitID, projectedFitID=mainItem.ID, amount=cleanInput)) elif isinstance(mainItem, es_Fighter): if srcContext == "projectedFighter": if mainItem in fit.projectedFighters: position = fit.projectedFighters.index(mainItem) self.mainFrame.command.Submit( cmd.GuiChangeProjectedFighterAmountCommand( fitID=fitID, position=position, amount=cleanInput)) else: if mainItem in fit.fighters: position = fit.fighters.index(mainItem) self.mainFrame.command.Submit( cmd.GuiChangeLocalFighterAmountCommand( fitID=fitID, position=position, amount=cleanInput))