コード例 #1
0
 def remove(self, event):
     row, _ = self.HitTest(event.Position)
     if row != -1:
         col = self.getColumn(event.Position)
         if col != self.getColIndex(State):
             fitID = self.mainFrame.getActiveFit()
             thing = self.get(row)
             if isinstance(thing, es_Fit):
                 self.mainFrame.command.Submit(
                     cmd.GuiRemoveProjectedFitCommand(
                         fitID=fitID, projectedFitID=thing.ID))
             elif isinstance(thing, es_Module):
                 self.mainFrame.command.Submit(
                     cmd.GuiRemoveProjectedModuleCommand(
                         fitID=fitID,
                         position=Fit.getInstance().getFit(
                             fitID).projectedModules.index(thing)))
             elif isinstance(thing, es_Drone):
                 self.mainFrame.command.Submit(
                     cmd.GuiRemoveProjectedDroneCommand(fitID=fitID,
                                                        itemID=thing.itemID,
                                                        amount=1))
             elif isinstance(thing, es_Fighter):
                 self.mainFrame.command.Submit(
                     cmd.GuiRemoveProjectedFighterCommand(
                         fitID=fitID,
                         position=Fit.getInstance().getFit(
                             fitID).projectedFighters.index(thing)))
コード例 #2
0
 def kbEvent(self, event):
     keycode = event.GetKeyCode()
     if keycode in (wx.WXK_DELETE, wx.WXK_NUMPAD_DELETE):
         row = self.GetFirstSelected()
         if row != -1:
             fitID = self.mainFrame.getActiveFit()
             thing = self.get(row)
             if isinstance(thing, es_Fit):
                 self.mainFrame.command.Submit(
                     cmd.GuiRemoveProjectedFitCommand(
                         fitID=fitID, projectedFitID=thing.ID))
             elif isinstance(thing, es_Module):
                 self.mainFrame.command.Submit(
                     cmd.GuiRemoveProjectedModuleCommand(
                         fitID=fitID,
                         position=Fit.getInstance().getFit(
                             fitID).projectedModules.index(thing)))
             elif isinstance(thing, es_Drone):
                 self.mainFrame.command.Submit(
                     cmd.GuiRemoveProjectedDroneCommand(fitID=fitID,
                                                        itemID=thing.itemID,
                                                        amount=math.inf))
             elif isinstance(thing, es_Fighter):
                 self.mainFrame.command.Submit(
                     cmd.GuiRemoveProjectedFighterCommand(
                         fitID=fitID,
                         position=Fit.getInstance().getFit(
                             fitID).projectedFighters.index(thing)))
コード例 #3
0
 def remove(self, event):
     row, _ = self.HitTest(event.Position)
     if row != -1:
         col = self.getColumn(event.Position)
         if col != self.getColIndex(State):
             fitID = self.mainFrame.getActiveFit()
             thing = self.get(row)
             if isinstance(thing, es_Fit):
                 amount = math.inf if wx.GetMouseState().altDown else 1
                 self.mainFrame.command.Submit(cmd.GuiRemoveProjectedFitCommand(
                     fitID=fitID, projectedFitID=thing.ID, amount=amount))
             elif isinstance(thing, es_Module):
                 fit = Fit.getInstance().getFit(fitID)
                 if thing in fit.projectedModules:
                     position = fit.projectedModules.index(thing)
                     self.mainFrame.command.Submit(cmd.GuiRemoveProjectedModuleCommand(
                         fitID=fitID, position=position))
             elif isinstance(thing, es_Drone):
                 mstate = wx.GetMouseState()
                 self.mainFrame.command.Submit(cmd.GuiRemoveProjectedDroneCommand(
                     fitID=fitID,
                     itemID=thing.itemID,
                     amount=math.inf if mstate.cmdDown or mstate.altDown else 1))
             elif isinstance(thing, es_Fighter):
                 fit = Fit.getInstance().getFit(fitID)
                 if thing in fit.projectedFighters:
                     position = fit.projectedFighters.index(thing)
                     self.mainFrame.command.Submit(cmd.GuiRemoveProjectedFighterCommand(
                         fitID=fitID, position=position))
コード例 #4
0
    def activate(self, fullContext, selection, i):

        srcContext = fullContext[0]
        sFit = Fit.getInstance()
        fitID = self.mainFrame.getActiveFit()
        fit = sFit.getFit(fitID)

        if srcContext == "fittingModule":
            positions = []
            for position, mod in enumerate(fit.modules):
                if mod in selection:
                    positions.append(position)
            self.mainFrame.command.Submit(
                cmd.GuiRemoveLocalModuleCommand(fitID=fitID,
                                                positions=positions))
        elif srcContext == "droneItem":
            drone = selection[0]
            if drone in fit.drones:
                position = fit.drones.index(drone)
                self.mainFrame.command.Submit(
                    cmd.GuiRemoveLocalDroneCommand(fitID=fitID,
                                                   position=position,
                                                   amount=math.inf))
        elif srcContext == "fighterItem":
            fighter = selection[0]
            if fighter in fit.fighters:
                position = fit.fighters.index(fighter)
                self.mainFrame.command.Submit(
                    cmd.GuiRemoveLocalFighterCommand(fitID=fitID,
                                                     position=position))
        elif srcContext == "implantItem":
            implant = selection[0]
            if implant in fit.implants:
                position = fit.implants.index(implant)
                self.mainFrame.command.Submit(
                    cmd.GuiRemoveImplantCommand(fitID=fitID,
                                                position=position))
        elif srcContext == "boosterItem":
            booster = selection[0]
            if booster in fit.boosters:
                position = fit.boosters.index(booster)
                self.mainFrame.command.Submit(
                    cmd.GuiRemoveBoosterCommand(fitID=fitID,
                                                position=position))
        elif srcContext == "cargoItem":
            cargo = selection[0]
            self.mainFrame.command.Submit(
                cmd.GuiRemoveCargoCommand(fitID=fitID, itemID=cargo.itemID))
        elif srcContext == "projectedFit":
            projectedFit = selection[0]
            self.mainFrame.command.Submit(
                cmd.GuiRemoveProjectedFitCommand(
                    fitID=fitID,
                    projectedFitID=projectedFit.ID,
                    amount=math.inf))
        elif srcContext == "projectedModule":
            mod = selection[0]
            if mod in fit.projectedModules:
                position = fit.projectedModules.index(mod)
                self.mainFrame.command.Submit(
                    cmd.GuiRemoveProjectedModuleCommand(fitID=fitID,
                                                        position=position))
        elif srcContext == "projectedDrone":
            drone = selection[0]
            self.mainFrame.command.Submit(
                cmd.GuiRemoveProjectedDroneCommand(fitID=fitID,
                                                   itemID=drone.itemID,
                                                   amount=math.inf))
        elif srcContext == "projectedFighter":
            fighter = selection[0]
            if fighter in fit.projectedFighters:
                position = fit.projectedFighters.index(fighter)
                self.mainFrame.command.Submit(
                    cmd.GuiRemoveProjectedFighterCommand(fitID=fitID,
                                                         position=position))
        elif srcContext == "commandFit":
            commandFit = selection[0]
            self.mainFrame.command.Submit(
                cmd.GuiRemoveCommandFitCommand(fitID=fitID,
                                               commandFitID=commandFit.ID))
コード例 #5
0
ファイル: itemRemove.py プロジェクト: Wilfried199754/Pyfa
    def activate(self, fullContext, selection, i):

        srcContext = fullContext[0]
        sFit = Fit.getInstance()
        fitID = self.mainFrame.getActiveFit()
        fit = sFit.getFit(fitID)

        if srcContext == "fittingModule":
            self.mainFrame.command.Submit(
                cmd.GuiRemoveLocalModuleCommand(fitID=fitID,
                                                modules=[
                                                    module
                                                    for module in selection
                                                    if module is not None
                                                ]))
        elif srcContext == "fittingCharge":
            self.mainFrame.command.Submit(
                cmd.GuiChangeLocalModuleChargesCommand(fitID=fitID,
                                                       modules=selection,
                                                       chargeItemID=None))
        elif srcContext == "droneItem":
            self.mainFrame.command.Submit(
                cmd.GuiRemoveLocalDroneCommand(fitID=fitID,
                                               position=fit.drones.index(
                                                   selection[0]),
                                               amount=math.inf))
        elif srcContext == "fighterItem":
            self.mainFrame.command.Submit(
                cmd.GuiRemoveLocalFighterCommand(fitID=fitID,
                                                 position=fit.fighters.index(
                                                     selection[0])))
        elif srcContext == "implantItem":
            self.mainFrame.command.Submit(
                cmd.GuiRemoveImplantCommand(fitID=fitID,
                                            position=fit.implants.index(
                                                selection[0])))
        elif srcContext == "boosterItem":
            self.mainFrame.command.Submit(
                cmd.GuiRemoveBoosterCommand(fitID=fitID,
                                            position=fit.boosters.index(
                                                selection[0])))
        elif srcContext == "cargoItem":
            self.mainFrame.command.Submit(
                cmd.GuiRemoveCargoCommand(fitID=fitID,
                                          itemID=selection[0].itemID))
        elif srcContext == "projectedFit":
            self.mainFrame.command.Submit(
                cmd.GuiRemoveProjectedFitCommand(
                    fitID=fitID, projectedFitID=selection[0].ID))
        elif srcContext == "projectedModule":
            self.mainFrame.command.Submit(
                cmd.GuiRemoveProjectedModuleCommand(
                    fitID=fitID,
                    position=fit.projectedModules.index(selection[0])))
        elif srcContext == "projectedDrone":
            self.mainFrame.command.Submit(
                cmd.GuiRemoveProjectedDroneCommand(fitID=fitID,
                                                   itemID=selection[0].itemID,
                                                   amount=math.inf))
        elif srcContext == "projectedFighter":
            self.mainFrame.command.Submit(
                cmd.GuiRemoveProjectedFighterCommand(
                    fitID=fitID,
                    position=fit.projectedFighters.index(selection[0])))
        elif srcContext == "commandFit":
            self.mainFrame.command.Submit(
                cmd.GuiRemoveCommandFitCommand(fitID=fitID,
                                               commandFitID=selection[0].ID))
コード例 #6
0
 def __handleProjectedDrone(self, mainItem, selection):
     fitID = self.mainFrame.getActiveFit()
     self.mainFrame.command.Submit(
         cmd.GuiRemoveProjectedDroneCommand(fitID=fitID,
                                            itemID=mainItem.itemID,
                                            amount=math.inf))