def run(self): paths = self.paths sCharacter = Character.getInstance() all5_character = es_Character("All 5", 5) all_skill_ids = [] for skill in all5_character.skills: # Parse out the skill item IDs to make searching it easier later on all_skill_ids.append(skill.itemID) for path in paths: try: # we try to parse api XML data first with open(path, mode='r') as charFile: sheet = ParseXML(charFile) char = sCharacter.new(sheet.name + " (imported)") sCharacter.apiUpdateCharSheet(char.ID, sheet.skills) except: # if it's not api XML data, try this # this is a horrible logic flow, but whatever try: charFile = open(path, mode='r').read() doc = minidom.parseString(charFile) if doc.documentElement.tagName not in ( "SerializableCCPCharacter", "SerializableUriCharacter"): pyfalog.error("Incorrect EVEMon XML sheet") raise RuntimeError("Incorrect EVEMon XML sheet") name = doc.getElementsByTagName( "name")[0].firstChild.nodeValue securitystatus = doc.getElementsByTagName( "securityStatus")[0].firstChild.nodeValue or 0 skill_els = doc.getElementsByTagName("skill") skills = [] for skill in skill_els: if int(skill.getAttribute( "typeID")) in all_skill_ids and (0 <= int( skill.getAttribute("level")) <= 5): skills.append({ "typeID": int(skill.getAttribute("typeID")), "level": int(skill.getAttribute("level")), }) else: pyfalog.error( "Attempted to import unknown skill {0} (ID: {1}) (Level: {2})", skill.getAttribute("name"), skill.getAttribute("typeID"), skill.getAttribute("level"), ) char = sCharacter.new(name + " (EVEMon)") sCharacter.apiUpdateCharSheet(char.ID, skills, securitystatus) except Exception, e: pyfalog.error("Exception on character import:") pyfalog.error(e) continue
def run(self): paths = self.paths sCharacter = Character.getInstance() all5_character = es_Character("All 5", 5) all_skill_ids = [] for skill in all5_character.skills: # Parse out the skill item IDs to make searching it easier later on all_skill_ids.append(skill.itemID) for path in paths: if not self.running: break try: charFile = open(path, mode='r').read() doc = minidom.parseString(charFile) if doc.documentElement.tagName not in ( "SerializableCCPCharacter", "SerializableUriCharacter"): pyfalog.error("Incorrect EVEMon XML sheet") raise RuntimeError("Incorrect EVEMon XML sheet") name = doc.getElementsByTagName("name")[0].firstChild.nodeValue securitystatus = doc.getElementsByTagName( "securityStatus")[0].firstChild.nodeValue or 0 skill_els = doc.getElementsByTagName("skill") skills = [] for skill in skill_els: if int(skill.getAttribute("typeID")) in all_skill_ids and ( 0 <= int(skill.getAttribute("level")) <= 5): skills.append({ "typeID": int(skill.getAttribute("typeID")), "level": int(skill.getAttribute("level")), }) else: pyfalog.error( "Attempted to import unknown skill {0} (ID: {1}) (Level: {2})", skill.getAttribute("name"), skill.getAttribute("typeID"), skill.getAttribute("level"), ) char = sCharacter.new(name + " (EVEMon)") sCharacter.apiUpdateCharSheet(char.ID, skills, securitystatus) except (KeyboardInterrupt, SystemExit): raise except Exception as e: pyfalog.error("Exception on character import:") pyfalog.error(e) continue wx.CallAfter(self.callback)
def run(self): paths = self.paths sCharacter = Character.getInstance() all5_character = es_Character("All 5", 5) all_skill_ids = [] for skill in all5_character.skills: # Parse out the skill item IDs to make searching it easier later on all_skill_ids.append(skill.itemID) for path in paths: try: # we try to parse api XML data first with open(path, mode='r') as charFile: sheet = ParseXML(charFile) char = sCharacter.new(sheet.name + " (imported)") sCharacter.apiUpdateCharSheet(char.ID, sheet.skills) except: # if it's not api XML data, try this # this is a horrible logic flow, but whatever try: charFile = open(path, mode='r').read() doc = minidom.parseString(charFile) if doc.documentElement.tagName not in ("SerializableCCPCharacter", "SerializableUriCharacter"): pyfalog.error("Incorrect EVEMon XML sheet") raise RuntimeError("Incorrect EVEMon XML sheet") name = doc.getElementsByTagName("name")[0].firstChild.nodeValue securitystatus = doc.getElementsByTagName("securityStatus")[0].firstChild.nodeValue or 0 skill_els = doc.getElementsByTagName("skill") skills = [] for skill in skill_els: if int(skill.getAttribute("typeID")) in all_skill_ids and (0 <= int(skill.getAttribute("level")) <= 5): skills.append({ "typeID": int(skill.getAttribute("typeID")), "level": int(skill.getAttribute("level")), }) else: pyfalog.error( "Attempted to import unknown skill {0} (ID: {1}) (Level: {2})", skill.getAttribute("name"), skill.getAttribute("typeID"), skill.getAttribute("level"), ) char = sCharacter.new(name + " (EVEMon)") sCharacter.apiUpdateCharSheet(char.ID, skills, securitystatus) except Exception, e: pyfalog.error("Exception on character import:") pyfalog.error(e) continue
def run(self): wx.CallAfter(self.callback) # todo: Fix character import (don't need CCP SML anymore, only support evemon?) return paths = self.paths sCharacter = Character.getInstance() all5_character = es_Character("All 5", 5) all_skill_ids = [] for skill in all5_character.skills: # Parse out the skill item IDs to make searching it easier later on all_skill_ids.append(skill.itemID) for path in paths: try: charFile = open(path, mode='r').read() doc = minidom.parseString(charFile) if doc.documentElement.tagName not in ("SerializableCCPCharacter", "SerializableUriCharacter"): pyfalog.error("Incorrect EVEMon XML sheet") raise RuntimeError("Incorrect EVEMon XML sheet") name = doc.getElementsByTagName("name")[0].firstChild.nodeValue securitystatus = doc.getElementsByTagName("securityStatus")[0].firstChild.nodeValue or 0 skill_els = doc.getElementsByTagName("skill") skills = [] for skill in skill_els: if int(skill.getAttribute("typeID")) in all_skill_ids and (0 <= int(skill.getAttribute("level")) <= 5): skills.append({ "typeID": int(skill.getAttribute("typeID")), "level": int(skill.getAttribute("level")), }) else: pyfalog.error( "Attempted to import unknown skill {0} (ID: {1}) (Level: {2})", skill.getAttribute("name"), skill.getAttribute("typeID"), skill.getAttribute("level"), ) char = sCharacter.new(name + " (EVEMon)") sCharacter.apiUpdateCharSheet(char.ID, skills, securitystatus) except Exception as e: pyfalog.error("Exception on character import:") pyfalog.error(e) continue wx.CallAfter(self.callback)
def new(name="New Character"): char = es_Character(name) eos.db.save(char) return char
def new(self, name="New Character"): char = es_Character(name) eds_queries.save(char) return char