From b52cbef26f32be6e7efa462b3a4d1a5a6fc919f0 Mon Sep 17 00:00:00 2001 From: blitzmann Date: Sun, 25 Oct 2015 21:48:55 -0400 Subject: [PATCH] Clean up some imports, get rid of CharacterInfo window. --- gui/crestFittings.py | 58 +++++--------------------------------------- service/__init__.py | 2 ++ service/crest.py | 13 +++++----- 3 files changed, 14 insertions(+), 59 deletions(-) diff --git a/gui/crestFittings.py b/gui/crestFittings.py index 53c7f7d7d..7602512db 100644 --- a/gui/crestFittings.py +++ b/gui/crestFittings.py @@ -1,5 +1,7 @@ -import wx +import time +import webbrowser import json +import wx from wx.lib.pubsub import setupkwargs from wx.lib.pubsub import pub @@ -8,8 +10,6 @@ import service import gui.display as d from eos.types import Cargo from eos.db import getItem -import time -import webbrowser class CrestFittings(wx.Frame): @@ -124,6 +124,7 @@ class CrestFittings(wx.Frame): fits = sFit.importFitFromBuffer(data) self.mainFrame._openAfterImport(fits) + class ExportToEve(wx.Frame): def __init__(self, parent): @@ -206,55 +207,6 @@ class ExportToEve(wx.Frame): except ValueError: self.statusbar.SetStatusText("", 1) -class CrestCharacterInfo(wx.Dialog): - - def __init__(self, parent): - wx.Dialog.__init__(self, parent, id=wx.ID_ANY, title="Character Info", pos=wx.DefaultPosition, size = wx.Size( 200,240 )) - self.mainFrame = parent - sCrest = service.Crest.getInstance() - self.char = sCrest.implicitCharacter - self.bitmapSet = False - - mainSizer = wx.BoxSizer( wx.VERTICAL ) - - 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.ALIGN_CENTRE | wx.ALL, 5 ) - - self.pic = wx.StaticBitmap(self, -1, wx.EmptyBitmap(128, 128)) - mainSizer.Add(self.pic, 0, wx.ALIGN_CENTRE | wx.ALL, 5 ) - - self.coutdownText = wx.StaticText( self, wx.ID_ANY, "", wx.DefaultPosition, wx.DefaultSize) - self.coutdownText.Wrap( -1 ) - 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 ) - - self.timer = wx.Timer(self) - self.Bind(wx.EVT_TIMER, self.update, self.timer) - self.timer.Start(1) - - def update(self, event): - t = time.gmtime(self.char.eve.expires-time.time()) - if not self.bitmapSet and hasattr(self.char, 'img'): - self.pic.SetBitmap(wx.ImageFromStream(self.char.img).ConvertToBitmap()) - self.Layout() - self.bitmapSet = True - newLabel = time.strftime("%H:%M:%S", t if t >= 0 else 0) - if self.coutdownText.Label != newLabel: - self.coutdownText.SetLabel(time.strftime("%H:%M:%S", t)) - - def logout(self, event): - sCrest = service.Crest.getInstance() - sCrest.logout() - self.Close() class CrestMgmt(wx.Dialog): @@ -321,6 +273,7 @@ class CrestMgmt(wx.Dialog): sCrest.delCrestCharacter(charID) self.popCharList() + class FittingsTreeView(wx.Panel): def __init__(self, parent): wx.Panel.__init__(self, parent, id=wx.ID_ANY) @@ -377,6 +330,7 @@ class FittingsTreeView(wx.Panel): self.parent.fitView.fitSelection = selection self.parent.fitView.update(list) + class FitView(d.Display): DEFAULT_COLS = ["Base Icon", "Base Name"] diff --git a/service/__init__.py b/service/__init__.py index 00e0e1153..8f5445527 100644 --- a/service/__init__.py +++ b/service/__init__.py @@ -11,3 +11,5 @@ from service.price import Price from service.network import Network from service.eveapi import EVEAPIConnection, ParseXML from service.crest import Crest +from service.server import StoppableHTTPServer, AuthHandler +from service.pycrest import EVE diff --git a/service/crest.py b/service/crest.py index c2a1c65fa..603120c84 100644 --- a/service/crest.py +++ b/service/crest.py @@ -1,3 +1,7 @@ +import thread +import config +import logging +import threading import copy import uuid @@ -5,12 +9,7 @@ from wx.lib.pubsub import pub import eos.db from eos.types import CrestChar -from service import pycrest import service -from service.server import * -import config -import logging -import threading logger = logging.getLogger(__name__) @@ -39,7 +38,7 @@ class Crest(): self.httpdTimer = None # Base EVE connection that is copied to all characters - self.eve = pycrest.EVE( + self.eve = service.pycrest.EVE( client_id=self.settings.get('clientID') if self.settings.get('mode') == 1 else config.clientID, api_key=self.settings.get('clientSecret') if self.settings.get('mode') == 1 else None, redirect_uri=self.clientCallback, @@ -99,7 +98,7 @@ class Crest(): def startServer(self): logging.debug("Starting server") - self.httpd = StoppableHTTPServer(('', 6461), AuthHandler) + self.httpd = service.StoppableHTTPServer(('', 6461), service.AuthHandler) thread.start_new_thread(self.httpd.serve, ()) # keep server going for only 60 seconds