Ejemplo n.º 1
0
    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
Ejemplo n.º 2
0
    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)
Ejemplo n.º 3
0
    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
Ejemplo n.º 4
0
    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)
Ejemplo n.º 5
0
 def new(name="New Character"):
     char = es_Character(name)
     eos.db.save(char)
     return char
Ejemplo n.º 6
0
 def new(self, name="New Character"):
     char = es_Character(name)
     eds_queries.save(char)
     return char