From 79deca41c16223358c7837ddde192b05768c646b Mon Sep 17 00:00:00 2001 From: Ryan Holmes Date: Thu, 15 Mar 2018 23:05:28 -0400 Subject: [PATCH] Fix skill fetching --- gui/characterSelection.py | 22 +++++++++++++++------- service/character.py | 6 ++++-- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/gui/characterSelection.py b/gui/characterSelection.py index ea4afff01..cc63a1f82 100644 --- a/gui/characterSelection.py +++ b/gui/characterSelection.py @@ -79,6 +79,7 @@ class CharacterSelection(wx.Panel): self.mainFrame.Bind(GE.FIT_CHANGED, self.fitChanged) self.SetMinSize(wx.Size(25, -1)) + self.toggleRefreshButton() self.charChoice.Enable(False) @@ -159,11 +160,11 @@ class CharacterSelection(wx.Panel): self.refreshCharacterList() else: exc_type, exc_obj, exc_trace = e - pyfalog.warn("Error fetching API information for character") + pyfalog.warn("Error fetching skill information for character") pyfalog.warn(exc_obj) wx.MessageBox( - "Error fetching API information, please check your API details in the character editor and try again later", + "Error fetching skill information", "Error", wx.ICON_ERROR | wx.STAY_ON_TOP) def charChanged(self, event): @@ -177,17 +178,22 @@ class CharacterSelection(wx.Panel): self.mainFrame.showCharacterEditor(event) return - char = sChar.getCharacter(charID) - if sChar.getCharName(charID) not in ("All 0", "All 5") and sChar.getSsoCharacter(char.ID) is not None: - self.btnRefresh.Enable(True) - else: - self.btnRefresh.Enable(False) + self.toggleRefreshButton() sFit = Fit.getInstance() sFit.changeChar(fitID, charID) self.charCache = self.charChoice.GetCurrentSelection() wx.PostEvent(self.mainFrame, GE.FitChanged(fitID=fitID)) + def toggleRefreshButton(self): + charID = self.getActiveCharacter() + sChar = Character.getInstance() + char = sChar.getCharacter(charID) + if sChar.getCharName(charID) not in ("All 0", "All 5") and sChar.getSsoCharacter(char.ID) is not None: + self.btnRefresh.Enable(True) + else: + self.btnRefresh.Enable(False) + def selectChar(self, charID): choice = self.charChoice numItems = len(choice.GetItems()) @@ -244,6 +250,8 @@ class CharacterSelection(wx.Panel): if not fit.calculated: self.charChanged(None) + self.toggleRefreshButton() + event.Skip() def exportSkills(self, evt): diff --git a/service/character.py b/service/character.py index 6e5b07a0c..9a3727620 100644 --- a/service/character.py +++ b/service/character.py @@ -474,14 +474,16 @@ class UpdateAPIThread(threading.Thread): char = eos.db.getCharacter(self.charID) sEsi = Esi.getInstance() - resp = sEsi.getSkills(char.ssoCharacterID) + sChar = Character.getInstance() + ssoChar = sChar.getSsoCharacter(char.ID) + resp = sEsi.getSkills(ssoChar.ID) # todo: check if alpha. if so, pop up a question if they want to apply it as alpha. Use threading events to set the answer? char.clearSkills() for skillRow in resp["skills"]: char.addSkill(Skill(char, skillRow["skill_id"], skillRow["trained_skill_level"])) - resp = sEsi.getSecStatus(char.ssoCharacterID) + resp = sEsi.getSecStatus(ssoChar.ID) char.secStatus = resp['security_status']