Update existing character if character with the same name exists

This commit is contained in:
DarkPhoenix
2020-04-13 12:52:02 +03:00
parent 1772bb5e7f
commit dcb058a718
2 changed files with 6 additions and 7 deletions

View File

@@ -362,14 +362,13 @@ class SsoCharacterMgmt(AuxiliaryFrame):
def ssoLogin(self, event):
self.popCharList()
characterID = event.character.ID
sChar = Character.getInstance()
char = sChar.new(event.character.characterName)
# Update existing pyfa character, if it doesn't exist - create new
char = sChar.getCharacter(event.character.characterName)
if char is None:
char = sChar.new(event.character.characterName)
char.setSsoCharacter(event.character, config.getClientSecret())
sChar.apiFetch(char.ID, APIView.fetchCallback)
event.Skip()
def kbEvent(self, event):

View File

@@ -242,8 +242,8 @@ class Character:
return eos.db.getCharacterList()
@staticmethod
def getCharacter(charID):
char = eos.db.getCharacter(charID)
def getCharacter(identity):
char = eos.db.getCharacter(identity)
return char
def saveCharacter(self, charID):