Пример #1
0
 def kbEvent(self, event):
     keycode = event.GetKeyCode()
     if keycode == wx.WXK_DELETE or keycode == wx.WXK_NUMPAD_DELETE:
         fitID = self.mainFrame.getActiveFit()
         row = self.GetFirstSelected()
         if row != -1:
             self.mainFrame.command.Submit(
                 cmd.GuiRemoveCommandCommand(fitID,
                                             self.get(row).ID))
Пример #2
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 thing:  # thing doesn't exist if it's the dummy value
                 self.mainFrame.command.Submit(
                     cmd.GuiRemoveCommandCommand(fitID, thing.ID))
Пример #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":
            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))