Fix (hack at) pycrest to fix caching issue when getting another character.

This commit is contained in:
blitzmann
2015-10-23 01:21:51 -04:00
parent 6e04c64ffb
commit 953a70327a
3 changed files with 23 additions and 15 deletions

View File

@@ -147,22 +147,22 @@ class CrestCharacterInfo(wx.Dialog):
mainSizer = wx.BoxSizer( wx.VERTICAL )
self.headingText = wx.StaticText(self, wx.ID_ANY, "Currently logged in", wx.DefaultPosition, wx.DefaultSize, wx.ALIGN_CENTRE )
self.headingText.Wrap( -1 )
self.headingText.SetFont( wx.Font( 12, 74, 90, 92, False) )
mainSizer.Add( self.headingText, 0, wx.EXPAND|wx.ALL, 5 )
self.pic = wx.StaticBitmap(self, -1, wx.EmptyBitmap(128, 128))
mainSizer.Add(self.pic, 0, wx.EXPAND, 5 )
self.characterText = wx.StaticText(self, wx.ID_ANY, self.char.name, wx.DefaultPosition, wx.DefaultSize, wx.ALIGN_CENTRE )
self.characterText = wx.StaticText(self, wx.ID_ANY, self.char.name, wx.DefaultPosition, wx.DefaultSize)
self.characterText.Wrap( -1 )
self.characterText.SetFont( wx.Font( 11, 74, 90, 92, False) )
mainSizer.Add( self.characterText, 0, wx.EXPAND|wx.ALL, 5 )
mainSizer.Add( self.characterText, 0, wx.ALIGN_CENTRE | wx.ALL, 5 )
self.coutdownText = wx.StaticText( self, wx.ID_ANY, "", wx.DefaultPosition, wx.DefaultSize, wx.ALIGN_CENTRE)
self.pic = wx.StaticBitmap(self, -1, wx.EmptyBitmap(128, 128))
mainSizer.Add(self.pic, 0, wx.EXPAND|wx.ALIGN_CENTER, 5 )
self.coutdownText = wx.StaticText( self, wx.ID_ANY, "", wx.DefaultPosition, wx.DefaultSize)
self.coutdownText.Wrap( -1 )
mainSizer.Add( self.coutdownText, 0, wx.EXPAND, 5 )
mainSizer.Add( self.coutdownText, 0, wx.ALIGN_CENTER, 5 )
self.logoutBtn = wx.Button( self, wx.ID_ANY, u"Logout", wx.DefaultPosition, wx.DefaultSize, 5 )
mainSizer.Add( self.logoutBtn, 0, wx.ALIGN_CENTER|wx.ALL, 5 )
self.logoutBtn.Bind(wx.EVT_BUTTON, self.logout)
self.SetSizer( mainSizer )
self.Centre( wx.BOTH )
@@ -179,6 +179,10 @@ class CrestCharacterInfo(wx.Dialog):
self.bitmapSet = True
self.coutdownText.SetLabel(time.strftime("%H:%M:%S", t))
def logout(self, event):
sCrest = service.Crest.getInstance()
sCrest.logout()
self.Close()
class FittingsTreeView(wx.Panel):
def __init__(self, parent):

View File

@@ -258,9 +258,10 @@ class AuthedConnection(EVE):
return self._data
def whoami(self):
if 'whoami' not in self._cache:
self._cache['whoami'] = self.get("%s/verify" % self._oauth_endpoint)
return self._cache['whoami']
#if 'whoami' not in self._cache:
# print "Setting this whoami cache"
# self._cache['whoami'] = self.get("%s/verify" % self._oauth_endpoint)
return self.get("%s/verify" % self._oauth_endpoint)
def refresh(self):
res = self._authorize(params={"grant_type": "refresh_token", "refresh_token": self.refresh_token})

View File

@@ -76,6 +76,9 @@ class Crest():
char = CrestUser(info['CharacterName'], info['CharacterID'], connection.refresh_token)
eos.db.save(char)
def logout(self):
self.implicitCharacter = None
def startServer(self):
thread.start_new_thread(self.httpd.serve, ())
self.state = str(uuid.uuid4())