def importSkills(self, evt): dlg = wx.MessageDialog(self, "Importing skills into this character will set the skill levels as pending. " + "To save the skills permanently, please click the Save button at the bottom of the window after importing" , "Import Skills", wx.OK) dlg.ShowModal() dlg.Destroy() text = fromClipboard().strip() if text: char = self.charEditor.entityEditor.getActiveEntity() try: lines = text.splitlines() for l in lines: s = l.strip() skill, level = s.rsplit(None, 1)[0], arabicOrRomanToInt(s.rsplit(None, 1)[1]) skill = char.getSkill(skill) if skill: skill.setLevel(level, ignoreRestrict=True) except Exception as e: dlg = wx.MessageDialog(self, "There was an error importing skills, please see log file", "Error", wx.ICON_ERROR) dlg.ShowModal() dlg.Destroy() pyfalog.error(e) finally: self.charEditor.btnRestrict() self.populateSkillTree() self.charEditor.entityEditor.refreshEntityList(char)
def importFromClipboard(self, event): clipboard = fromClipboard() try: fits = Port().importFitFromBuffer(clipboard, self.getActiveFit()) except: pyfalog.error("Attempt to import failed:\n{0}", clipboard) else: self._openAfterImport(fits)
def importPatterns(self, event): text = fromClipboard() if text: sDP = service.DamagePattern.getInstance() sDP.importPatterns(text) self.stPercentages.SetLabel("Patterns imported from clipboard") else: self.stPercentages.SetLabel("Could not import from clipboard")
def importFromClipboard(self, event): sFit = service.Fit.getInstance() try: fits = sFit.importFitFromBuffer(fromClipboard(), self.getActiveFit()) except: pass else: self._openAfterImport(fits)
def importFromClipboard(self, event): sFit = service.Fit.getInstance() try: fits = sFit.importFitFromBuffer(fromClipboard()) IDs = sFit.saveImportedFits(fits) self._openAfterImport(len(fits), IDs) except: pass
def importFromClipboard(self, event): sFit = service.Fit.getInstance() try: fits = sFit.importFitFromBuffer(fromClipboard(), self.getActiveFit()) except: pass else: ids = tuple(fit.ID for fit in fits) self._openAfterImport(len(fits), ids)
def activate(self, callingWindow, fullContext, i): text = fromClipboard() items = parseAdditions(text) filterFunc = self.viewSpecMap[self.srcContext][1] items = [(i.ID, a) for i, a in items if filterFunc(i)] if not items: return command = self.viewSpecMap[self.srcContext][2] self.mainFrame.command.Submit( command(self.mainFrame.getActiveFit(), items))
def importPatterns(self, event): text = fromClipboard() if text: sDP = service.DamagePattern.getInstance() try: sDP.importPatterns(text) self.stNotice.SetLabel("Patterns successfully imported from clipboard") except service.damagePattern.ImportError, e: self.stNotice.SetLabel(str(e)) except Exception, e: self.stNotice.SetLabel("Could not import from clipboard: unknown errors")
def display(self, callingWindow, srcContext): if srcContext not in self.viewSpecMap: return False fit = Fit.getInstance().getFit(self.mainFrame.getActiveFit()) if fit is None: return False if not fromClipboard(): return False self.srcContext = srcContext return True
def activate(self, callingWindow, fullContext, i): text = fromClipboard() lines = list(lineIter(text)) mutaData = importGetMutationData(lines) text = '\n'.join(lines) items = parseAdditions(text, mutaData=mutaData) filterFunc = self.viewSpecMap[self.srcContext][1] items = [(i.ID, a, m) for i, a, m in items if filterFunc(i)] if not items: return command = self.viewSpecMap[self.srcContext][2] self.mainFrame.command.Submit(command(self.mainFrame.getActiveFit(), items))
def display(self, callingWindow, srcContext): if not ContextMenuSettings.getInstance().get('additionsCopyPaste'): return False if srcContext not in viewSpecMap: return False fit = Fit.getInstance().getFit(self.mainFrame.getActiveFit()) if fit is None: return False if not fromClipboard(): return False self.srcContext = srcContext return True
def importPatterns(self, event): "Event fired when import from clipboard button is clicked" text = fromClipboard() if text: sTR = service.TargetResists.getInstance() try: sTR.importPatterns(text) self.stNotice.SetLabel("Patterns successfully imported from clipboard") except service.targetResists.ImportError, e: self.stNotice.SetLabel(str(e)) except Exception, e: self.stNotice.SetLabel("Could not import from clipboard: unknown errors")
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.GuiImportMutatedModuleCommand(activeFit, *importData[0])) return # no need to do anything else except: pyfalog.error("Attempt to import failed:\n{0}", clipboard) else: self._openAfterImport(importData)
def importPatterns(self, event): "Event fired when import from clipboard button is clicked" text = fromClipboard() if text: sTR = service.TargetResists.getInstance() try: sTR.importPatterns(text) self.stNotice.SetLabel("Patterns successfully imported from clipboard") self.showInput(False) except service.targetResists.ImportError, e: self.stNotice.SetLabel(str(e)) except Exception, e: self.stNotice.SetLabel("Could not import from clipboard: unknown errors")
def importPatterns(self, event): text = fromClipboard() if text: sDP = DamagePattern.getInstance() try: sDP.importPatterns(text) self.stNotice.SetLabel("Patterns successfully imported from clipboard") except ImportError as e: self.stNotice.SetLabel(str(e)) except Exception: self.stNotice.SetLabel("Could not import from clipboard: unknown errors") finally: self.entityEditor.refreshEntityList() else: self.stNotice.SetLabel("Could not import from clipboard")
def importPatterns(self, event): "Event fired when import from clipboard button is clicked" text = fromClipboard() if text: sIS = service.ImplantSets.getInstance() try: sIS.importSets(text) self.stNotice.SetLabel("Patterns successfully imported from clipboard") self.showInput(False) except ImportError, e: self.stNotice.SetLabel(str(e)) except Exception, e: logging.exception("Unhandled Exception") self.stNotice.SetLabel("Could not import from clipboard: unknown errors")
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)
def importPatterns(self, event): "Event fired when import from clipboard button is clicked" text = fromClipboard() if text: sTR = TargetResists.getInstance() try: sTR.importPatterns(text) self.stNotice.SetLabel("Patterns successfully imported from clipboard") except ImportError as e: self.stNotice.SetLabel(str(e)) except Exception: self.stNotice.SetLabel("Could not import from clipboard: unknown errors") finally: self.entityEditor.refreshEntityList() else: self.stNotice.SetLabel("Could not import from clipboard")
def importPatterns(self, event): text = fromClipboard() if text: sDP = DamagePattern.getInstance() try: sDP.importPatterns(text) self.stNotice.SetLabel("Patterns successfully imported from clipboard") except ImportError as e: pyfalog.error(e) self.stNotice.SetLabel(str(e)) except Exception as e: msg = "Could not import from clipboard: unknown errors" pyfalog.warning(msg) pyfalog.error(e) self.stNotice.SetLabel(msg) finally: self.entityEditor.refreshEntityList() else: self.stNotice.SetLabel("Could not import from clipboard")
def importPatterns(self, event): """Event fired when import from clipboard button is clicked""" text = fromClipboard() if text: sIS = ImplantSets.getInstance() try: sIS.importSets(text) self.stNotice.SetLabel("Patterns successfully imported from clipboard") self.showInput(False) except ImportError as e: pyfalog.error(e) self.stNotice.SetLabel(str(e)) except Exception as e: pyfalog.error(e) self.stNotice.SetLabel("Could not import from clipboard: unknown errors") finally: self.updateChoices() else: self.stNotice.SetLabel("Could not import from clipboard")
def importFromClipboard(self, event): self.doImport(fromClipboard())