Fix skill fetching

This commit is contained in:
Ryan Holmes
2018-03-15 23:05:28 -04:00
parent 570df7f645
commit 79deca41c1
2 changed files with 19 additions and 9 deletions

View File

@@ -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):

View File

@@ -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']