示例#1
0
    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)
示例#2
0
    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)
示例#3
0
    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))
示例#4
0
 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
示例#5
0
 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
示例#6
0
 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()
示例#7
0
 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()
示例#8
0
文件: cargo.py 项目: DaManDOH/Pyfa
    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()
示例#9
0
    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))
示例#10
0
    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()
示例#11
0
    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()
示例#12
0
文件: amount.py 项目: m-sasha/PyfaAT
    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))
示例#13
0
文件: amount.py 项目: tiniumv/Pyfa
    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()
示例#14
0
    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))
示例#15
0
    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, )))
示例#16
0
文件: amount.py 项目: Ebag333/Pyfa
    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()
示例#17
0
 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)
示例#18
0
 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)
示例#19
0
    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()
示例#20
0
    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))