Esempio n. 1
0
 def importFromClipboard(self, event):
     clipboard = fromClipboard()
     activeFit = self.getActiveFit()
     try:
         importType, importData = Port().importFitFromBuffer(
             clipboard, activeFit)
         if importType == "FittingItem":
             baseItem, mutaplasmidItem, mutations = importData[0]
             if mutaplasmidItem:
                 self.command.Submit(
                     cmd.GuiImportLocalMutatedModuleCommand(
                         activeFit, baseItem, mutaplasmidItem, mutations))
             else:
                 self.command.Submit(
                     cmd.GuiAddLocalModuleCommand(activeFit, baseItem.ID))
             return
         if importType == "AdditionsDrones":
             if self.command.Submit(
                     cmd.GuiImportLocalDronesCommand(
                         activeFit, [(i.ID, a) for i, a in importData[0]])):
                 self.additionsPane.select("Drones")
             return
         if importType == "AdditionsFighters":
             if self.command.Submit(
                     cmd.GuiImportLocalFightersCommand(
                         activeFit, [(i.ID, a) for i, a in importData[0]])):
                 self.additionsPane.select("Fighters")
             return
         if importType == "AdditionsImplants":
             if self.command.Submit(
                     cmd.GuiImportImplantsCommand(
                         activeFit, [(i.ID, a) for i, a in importData[0]])):
                 self.additionsPane.select("Implants")
             return
         if importType == "AdditionsBoosters":
             if self.command.Submit(
                     cmd.GuiImportBoostersCommand(
                         activeFit, [(i.ID, a) for i, a in importData[0]])):
                 self.additionsPane.select("Boosters")
             return
         if importType == "AdditionsCargo":
             if self.command.Submit(
                     cmd.GuiImportCargosCommand(
                         activeFit, [(i.ID, a) for i, a in importData[0]])):
                 self.additionsPane.select("Cargo")
             return
     except (KeyboardInterrupt, SystemExit):
         raise
     except:
         pyfalog.error("Attempt to import failed:\n{0}", clipboard)
     else:
         self._openAfterImport(importData)
Esempio n. 2
0
 def importFromClipboard(self, event):
     clipboard = fromClipboard()
     activeFit = self.getActiveFit()
     try:
         importType, importData = Port().importFitFromBuffer(clipboard, activeFit)
         # If it's mutated item - make sure there's at least base item specified
         if importType == "MutatedItem":
             # we've imported an Abyssal module, need to fire off the command to add it to the fit
             self.command.Submit(cmd.GuiImportLocalMutatedModuleCommand(activeFit, *importData[0]))
             return  # no need to do anything else
     except:
         pyfalog.error("Attempt to import failed:\n{0}", clipboard)
     else:
         self._openAfterImport(importData)
Esempio n. 3
0
    def importFromClipboard(self, event):
        clipboard = fromClipboard()
        activeFit = self.getActiveFit()
        try:
            importType, importData = Port().importFitFromBuffer(
                clipboard, activeFit)

            if importType == "MutatedItem":
                # we've imported an Abyssal module, need to fire off the command to add it to the fit
                self.command.Submit(
                    cmd.GuiImportLocalMutatedModuleCommand(
                        activeFit, *importData[0]))
                return
            if importType == "AdditionsDrones":
                if self.command.Submit(
                        cmd.GuiImportLocalDronesCommand(
                            activeFit, [(i.ID, a) for i, a in importData[0]])):
                    self.additionsPane.select("Drones")
                return
            if importType == "AdditionsFighters":
                if self.command.Submit(
                        cmd.GuiImportLocalFightersCommand(
                            activeFit, [(i.ID, a) for i, a in importData[0]])):
                    self.additionsPane.select("Fighters")
                return
            if importType == "AdditionsImplants":
                if self.command.Submit(
                        cmd.GuiImportImplantsCommand(
                            activeFit, [(i.ID, a) for i, a in importData[0]])):
                    self.additionsPane.select("Implants")
                return
            if importType == "AdditionsBoosters":
                if self.command.Submit(
                        cmd.GuiImportBoostersCommand(
                            activeFit, [(i.ID, a) for i, a in importData[0]])):
                    self.additionsPane.select("Boosters")
                return
            if importType == "AdditionsCargo":
                if self.command.Submit(
                        cmd.GuiImportCargosCommand(
                            activeFit, [(i.ID, a) for i, a in importData[0]])):
                    self.additionsPane.select("Cargo")
                return
        except:
            pyfalog.error("Attempt to import failed:\n{0}", clipboard)
        else:
            self._openAfterImport(importData)