Beispiel #1
0
    def activate(self, fullContext, selection, i):

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

        if srcContext == "fittingModule":
            modules = [module for module in selection if module is not None]
            self.mainFrame.command.Submit(
                cmd.GuiModuleRemoveCommand(fitID, modules))
            return  # the command takes care of the PostEvent
        elif srcContext in ("fittingCharge", "projectedCharge"):
            self.mainFrame.command.Submit(
                cmd.GuiModuleAddChargeCommand(fitID, None, selection))
            return
        elif srcContext == "droneItem":
            self.mainFrame.command.Submit(
                cmd.GuiRemoveDroneCommand(fitID,
                                          fit.drones.index(selection[0])))
            return
        elif srcContext == "fighterItem":
            self.mainFrame.command.Submit(
                cmd.GuiRemoveFighterCommand(fitID,
                                            fit.fighters.index(selection[0])))
            return  # the command takes care of the PostEvent
        elif srcContext == "implantItem":
            self.mainFrame.command.Submit(
                cmd.GuiRemoveImplantCommand(fitID,
                                            fit.implants.index(selection[0])))
            return  # the command takes care of the PostEvent
        elif srcContext == "boosterItem":
            self.mainFrame.command.Submit(
                cmd.GuiRemoveBoosterCommand(fitID,
                                            fit.boosters.index(selection[0])))
            return  # the command takes care of the PostEvent
        elif srcContext == "cargoItem":
            self.mainFrame.command.Submit(
                cmd.GuiRemoveCargoCommand(fitID, selection[0].itemID))
            return  # the command takes care of the PostEvent
        elif srcContext in ("projectedFit", "projectedModule",
                            "projectedDrone", "projectedFighter"):
            self.mainFrame.command.Submit(
                cmd.GuiRemoveProjectedCommand(fitID, selection[0]))
            return  # the command takes care of the PostEvent
        elif srcContext == "commandFit":
            self.mainFrame.command.Submit(
                cmd.GuiRemoveCommandCommand(fitID, selection[0].ID))
            return  # the command takes care of the PostEvent
        wx.PostEvent(self.mainFrame, GE.FitChanged(fitID=fitID))
Beispiel #2
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))
Beispiel #3
0
    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))
Beispiel #4
0
 def removeBooster(self, booster):
     fitID = self.mainFrame.getActiveFit()
     if booster in self.original:
         position = self.original.index(booster)
         self.mainFrame.command.Submit(
             cmd.GuiRemoveBoosterCommand(fitID=fitID, position=position))
Beispiel #5
0
 def removeBooster(self, booster):
     fitID = self.mainFrame.getActiveFit()
     self.mainFrame.command.Submit(cmd.GuiRemoveBoosterCommand(fitID, self.origional.index(booster)))