Get fitting browser to show up with proper characters (still not functional). Start testing ways to store the esipy app on the service (it can take a few seconds to initialize due to network calls)
This commit is contained in:
@@ -34,16 +34,9 @@ class CrestFittings(wx.Frame):
|
|||||||
|
|
||||||
characterSelectSizer = wx.BoxSizer(wx.HORIZONTAL)
|
characterSelectSizer = wx.BoxSizer(wx.HORIZONTAL)
|
||||||
|
|
||||||
if sCrest.settings.get('mode') == CrestModes.IMPLICIT:
|
self.charChoice = wx.Choice(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, [])
|
||||||
self.stLogged = wx.StaticText(self, wx.ID_ANY, "Currently logged in as %s" % sCrest.implicitCharacter.name,
|
characterSelectSizer.Add(self.charChoice, 1, wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5)
|
||||||
wx.DefaultPosition, wx.DefaultSize)
|
self.updateCharList()
|
||||||
self.stLogged.Wrap(-1)
|
|
||||||
|
|
||||||
characterSelectSizer.Add(self.stLogged, 1, wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5)
|
|
||||||
else:
|
|
||||||
self.charChoice = wx.Choice(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, [])
|
|
||||||
characterSelectSizer.Add(self.charChoice, 1, wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5)
|
|
||||||
self.updateCharList()
|
|
||||||
|
|
||||||
self.fetchBtn = wx.Button(self, wx.ID_ANY, "Fetch Fits", wx.DefaultPosition, wx.DefaultSize, 5)
|
self.fetchBtn = wx.Button(self, wx.ID_ANY, "Fetch Fits", wx.DefaultPosition, wx.DefaultSize, 5)
|
||||||
characterSelectSizer.Add(self.fetchBtn, 0, wx.ALL, 5)
|
characterSelectSizer.Add(self.fetchBtn, 0, wx.ALL, 5)
|
||||||
@@ -99,14 +92,14 @@ class CrestFittings(wx.Frame):
|
|||||||
|
|
||||||
def updateCharList(self):
|
def updateCharList(self):
|
||||||
sCrest = Crest.getInstance()
|
sCrest = Crest.getInstance()
|
||||||
chars = sCrest.getCrestCharacters()
|
chars = sCrest.getSsoCharacters()
|
||||||
|
|
||||||
if len(chars) == 0:
|
if len(chars) == 0:
|
||||||
self.Close()
|
self.Close()
|
||||||
|
|
||||||
self.charChoice.Clear()
|
self.charChoice.Clear()
|
||||||
for char in chars:
|
for char in chars:
|
||||||
self.charChoice.Append(char.name, char.ID)
|
self.charChoice.Append(char.characterName, char.characterID)
|
||||||
|
|
||||||
self.charChoice.SetSelection(0)
|
self.charChoice.SetSelection(0)
|
||||||
|
|
||||||
@@ -232,7 +225,7 @@ class ExportToEve(wx.Frame):
|
|||||||
|
|
||||||
def updateCharList(self):
|
def updateCharList(self):
|
||||||
sCrest = Crest.getInstance()
|
sCrest = Crest.getInstance()
|
||||||
chars = sCrest.getCrestCharacters()
|
chars = sCrest.getSsoCharacters()
|
||||||
|
|
||||||
if len(chars) == 0:
|
if len(chars) == 0:
|
||||||
self.Close()
|
self.Close()
|
||||||
@@ -344,7 +337,7 @@ class CrestMgmt(wx.Dialog):
|
|||||||
|
|
||||||
def popCharList(self):
|
def popCharList(self):
|
||||||
sCrest = Crest.getInstance()
|
sCrest = Crest.getInstance()
|
||||||
chars = sCrest.getCrestCharacters()
|
chars = sCrest.getSsoCharacters()
|
||||||
|
|
||||||
self.lcCharacters.DeleteAllItems()
|
self.lcCharacters.DeleteAllItems()
|
||||||
|
|
||||||
|
|||||||
@@ -657,7 +657,7 @@ class MainFrame(wx.Frame):
|
|||||||
menu.Enable(menu.exportToEveId, False)
|
menu.Enable(menu.exportToEveId, False)
|
||||||
else:
|
else:
|
||||||
menu.SetLabel(menu.ssoLoginId, "Manage Characters")
|
menu.SetLabel(menu.ssoLoginId, "Manage Characters")
|
||||||
enable = len(sCrest.getCrestCharacters()) == 0
|
enable = len(sCrest.getSsoCharacters()) == 0
|
||||||
menu.Enable(menu.eveFittingsId, not enable)
|
menu.Enable(menu.eveFittingsId, not enable)
|
||||||
menu.Enable(menu.exportToEveId, not enable)
|
menu.Enable(menu.exportToEveId, not enable)
|
||||||
|
|
||||||
|
|||||||
@@ -145,8 +145,8 @@ class MainMenuBar(wx.MenuBar):
|
|||||||
crestMenu.Append(self.exportToEveId, "Export To EVE")
|
crestMenu.Append(self.exportToEveId, "Export To EVE")
|
||||||
|
|
||||||
# if self.sCrest.settings.get('mode') == CrestModes.IMPLICIT or len(self.sCrest.getCrestCharacters()) == 0:
|
# if self.sCrest.settings.get('mode') == CrestModes.IMPLICIT or len(self.sCrest.getCrestCharacters()) == 0:
|
||||||
self.Enable(self.eveFittingsId, False)
|
self.Enable(self.eveFittingsId, True)
|
||||||
self.Enable(self.exportToEveId, False)
|
self.Enable(self.exportToEveId, True)
|
||||||
|
|
||||||
if not self.mainFrame.disableOverrideEditor:
|
if not self.mainFrame.disableOverrideEditor:
|
||||||
windowMenu.AppendSeparator()
|
windowMenu.AppendSeparator()
|
||||||
|
|||||||
@@ -18,9 +18,11 @@ from service.server import StoppableHTTPServer, AuthHandler
|
|||||||
from service.pycrest.eve import EVE
|
from service.pycrest.eve import EVE
|
||||||
|
|
||||||
from .esi_security_proxy import EsiSecurityProxy
|
from .esi_security_proxy import EsiSecurityProxy
|
||||||
from esipy import EsiClient
|
from esipy import EsiClient, EsiApp
|
||||||
from esipy.cache import FileCache
|
from esipy.cache import FileCache
|
||||||
import os
|
import os
|
||||||
|
import logging
|
||||||
|
|
||||||
|
|
||||||
pyfalog = Logger(__name__)
|
pyfalog = Logger(__name__)
|
||||||
|
|
||||||
@@ -41,6 +43,7 @@ class CrestModes(Enum):
|
|||||||
IMPLICIT = 0
|
IMPLICIT = 0
|
||||||
USER = 1
|
USER = 1
|
||||||
|
|
||||||
|
from utils.timer import Timer
|
||||||
|
|
||||||
class Crest(object):
|
class Crest(object):
|
||||||
clientIDs = {
|
clientIDs = {
|
||||||
@@ -54,6 +57,16 @@ class Crest(object):
|
|||||||
|
|
||||||
_instance = None
|
_instance = None
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def initEsiApp(cls):
|
||||||
|
with Timer() as t:
|
||||||
|
cls.esiapp = EsiApp(cache=None)
|
||||||
|
|
||||||
|
with Timer() as t:
|
||||||
|
cls.esi_v1 = cls.esiapp.get_v1_swagger
|
||||||
|
with Timer() as t:
|
||||||
|
cls.esi_v4 = cls.esiapp.get_v4_swagger
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def genEsiClient(cls, security=None):
|
def genEsiClient(cls, security=None):
|
||||||
return EsiClient(
|
return EsiClient(
|
||||||
@@ -135,7 +148,7 @@ class Crest(object):
|
|||||||
self.charCache = {}
|
self.charCache = {}
|
||||||
wx.PostEvent(self.mainFrame, GE.SsoLogout(type=CrestModes.USER, numChars=0))
|
wx.PostEvent(self.mainFrame, GE.SsoLogout(type=CrestModes.USER, numChars=0))
|
||||||
|
|
||||||
def getCrestCharacters(self):
|
def getSsoCharacters(self):
|
||||||
chars = eos.db.getSsoCharacters(config.getClientSecret())
|
chars = eos.db.getSsoCharacters(config.getClientSecret())
|
||||||
return chars
|
return chars
|
||||||
|
|
||||||
@@ -150,6 +163,10 @@ class Crest(object):
|
|||||||
|
|
||||||
def getFittings(self, charID):
|
def getFittings(self, charID):
|
||||||
char = self.getSsoCharacter(charID)
|
char = self.getSsoCharacter(charID)
|
||||||
|
op = esi_v1.op['get_characters_character_id_fittings'](
|
||||||
|
character_id=self.currentCharacter.character_id
|
||||||
|
)
|
||||||
|
resp = self.currentCharacter.esi_client.request(op)
|
||||||
return char.eve.get('%scharacters/%d/fittings/' % (char.eve._authed_endpoint, char.ID))
|
return char.eve.get('%scharacters/%d/fittings/' % (char.eve._authed_endpoint, char.ID))
|
||||||
|
|
||||||
def postFitting(self, charID, json):
|
def postFitting(self, charID, json):
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ class Timer(object):
|
|||||||
def checkpoint(self, name=''):
|
def checkpoint(self, name=''):
|
||||||
text = 'Timer - {timer} - {checkpoint} - {last:.2f}ms ({elapsed:.2f}ms elapsed)'.format(
|
text = 'Timer - {timer} - {checkpoint} - {last:.2f}ms ({elapsed:.2f}ms elapsed)'.format(
|
||||||
timer=self.name,
|
timer=self.name,
|
||||||
checkpoint=str(name, "utf-8"),
|
checkpoint=name,
|
||||||
last=self.last,
|
last=self.last,
|
||||||
elapsed=self.elapsed
|
elapsed=self.elapsed
|
||||||
).strip()
|
).strip()
|
||||||
|
|||||||
Reference in New Issue
Block a user