From 3c405f51d84bcc9b86a4aeb20bff52129fcb5340 Mon Sep 17 00:00:00 2001 From: blitzmann Date: Fri, 24 Nov 2017 17:27:44 -0500 Subject: [PATCH] Remove platform-specific CREST checks (add for mac-deprecated client) --- gui/builtinPreferenceViews/__init__.py | 6 +-- .../pyfaCrestPreferences.py | 3 +- gui/builtinViews/fittingView.py | 12 ++--- gui/crestFittings.py | 3 +- gui/mainFrame.py | 13 +++--- gui/mainMenuBar.py | 45 +++++++++---------- pyfa.py | 13 +++--- service/port.py | 3 +- 8 files changed, 44 insertions(+), 54 deletions(-) diff --git a/gui/builtinPreferenceViews/__init__.py b/gui/builtinPreferenceViews/__init__.py index 8b61beb13..e6b55fb3c 100644 --- a/gui/builtinPreferenceViews/__init__.py +++ b/gui/builtinPreferenceViews/__init__.py @@ -1,6 +1,3 @@ -# noinspection PyPackageRequirements -import wx - __all__ = [ "pyfaGeneralPreferences", "pyfaHTMLExportPreferences", @@ -10,7 +7,6 @@ __all__ = [ "pyfaLoggingPreferences", "pyfaEnginePreferences", "pyfaStatViewPreferences", + "pyfaCrestPreferences" ] -if 'wxMac' not in wx.PlatformInfo or ('wxMac' in wx.PlatformInfo and wx.VERSION >= (3, 0)): - __all__.append("pyfaCrestPreferences") diff --git a/gui/builtinPreferenceViews/pyfaCrestPreferences.py b/gui/builtinPreferenceViews/pyfaCrestPreferences.py index 2e82cb7bc..f2dbe694d 100644 --- a/gui/builtinPreferenceViews/pyfaCrestPreferences.py +++ b/gui/builtinPreferenceViews/pyfaCrestPreferences.py @@ -11,8 +11,7 @@ from service.settings import CRESTSettings # noinspection PyPackageRequirements from wx.lib.intctrl import IntCtrl -if 'wxMac' not in wx.PlatformInfo or ('wxMac' in wx.PlatformInfo and wx.VERSION >= (3, 0)): - from service.crest import Crest +from service.crest import Crest class PFCrestPref(PreferenceView): diff --git a/gui/builtinViews/fittingView.py b/gui/builtinViews/fittingView.py index 69fa3c918..271278283 100644 --- a/gui/builtinViews/fittingView.py +++ b/gui/builtinViews/fittingView.py @@ -684,12 +684,12 @@ class FittingView(d.Display): self.Thaw() self.itemCount = self.GetItemCount() - if 'wxMac' in wx.PlatformInfo: - try: - self.MakeSnapshot() - except Exception as e: - pyfalog.critical("Failed to make snapshot") - pyfalog.critical(e) + # if 'wxMac' in wx.PlatformInfo: + # try: + # self.MakeSnapshot() + # except Exception as e: + # pyfalog.critical("Failed to make snapshot") + # pyfalog.critical(e) def OnShow(self, event): pass diff --git a/gui/crestFittings.py b/gui/crestFittings.py index c23abb93c..bff2c5b9b 100644 --- a/gui/crestFittings.py +++ b/gui/crestFittings.py @@ -18,8 +18,7 @@ from logbook import Logger import calendar pyfalog = Logger(__name__) -if 'wxMac' not in wx.PlatformInfo or ('wxMac' in wx.PlatformInfo and wx.VERSION >= (3, 0)): - from service.crest import Crest, CrestModes +from service.crest import Crest, CrestModes class CrestFittings(wx.Frame): diff --git a/gui/mainFrame.py b/gui/mainFrame.py index be3a1cd27..849c295fe 100644 --- a/gui/mainFrame.py +++ b/gui/mainFrame.py @@ -81,10 +81,10 @@ from time import gmtime, strftime import threading import webbrowser import wx.adv -if 'wxMac' not in wx.PlatformInfo or ('wxMac' in wx.PlatformInfo and wx.VERSION >= (3, 0)): - from service.crest import Crest - from service.crest import CrestModes - from gui.crestFittings import CrestFittings, ExportToEve, CrestMgmt + +from service.crest import Crest +from service.crest import CrestModes +from gui.crestFittings import CrestFittings, ExportToEve, CrestMgmt disableOverrideEditor = False @@ -236,9 +236,8 @@ class MainFrame(wx.Frame): self.sUpdate = Update.getInstance() self.sUpdate.CheckUpdate(self.ShowUpdateBox) - if 'wxMac' not in wx.PlatformInfo or ('wxMac' in wx.PlatformInfo and wx.VERSION >= (3, 0)): - self.Bind(GE.EVT_SSO_LOGIN, self.onSSOLogin) - self.Bind(GE.EVT_SSO_LOGOUT, self.onSSOLogout) + self.Bind(GE.EVT_SSO_LOGIN, self.onSSOLogin) + self.Bind(GE.EVT_SSO_LOGOUT, self.onSSOLogout) self.titleTimer = wx.Timer(self) self.Bind(wx.EVT_TIMER, self.updateTitle, self.titleTimer) diff --git a/gui/mainMenuBar.py b/gui/mainMenuBar.py index aa85e0883..7fba900e2 100644 --- a/gui/mainMenuBar.py +++ b/gui/mainMenuBar.py @@ -30,9 +30,8 @@ from gui.bitmap_loader import BitmapLoader from logbook import Logger pyfalog = Logger(__name__) -if 'wxMac' not in wx.PlatformInfo or ('wxMac' in wx.PlatformInfo and wx.VERSION >= (3, 0)): - from service.crest import Crest - from service.crest import CrestModes +from service.crest import Crest +from service.crest import CrestModes class MainMenuBar(wx.MenuBar): @@ -61,6 +60,7 @@ class MainMenuBar(wx.MenuBar): self.toggleIgnoreRestrictionID = wx.NewId() self.devToolsId = wx.NewId() + # pheonix: evaluate if this is needed if 'wxMac' in wx.PlatformInfo and wx.VERSION >= (3, 0): wx.ID_COPY = wx.NewId() wx.ID_PASTE = wx.NewId() @@ -134,29 +134,28 @@ class MainMenuBar(wx.MenuBar): preferencesItem.SetBitmap(BitmapLoader.getBitmap("preferences_small", "gui")) windowMenu.Append(preferencesItem) - if 'wxMac' not in wx.PlatformInfo or ('wxMac' in wx.PlatformInfo and wx.VERSION >= (3, 0)): - self.sCrest = Crest.getInstance() + self.sCrest = Crest.getInstance() - # CREST Menu - crestMenu = wx.Menu() - self.Append(crestMenu, "&CREST") - if self.sCrest.settings.get('mode') != CrestModes.IMPLICIT: - crestMenu.Append(self.ssoLoginId, "Manage Characters") - else: - crestMenu.Append(self.ssoLoginId, "Login to EVE") - crestMenu.Append(self.eveFittingsId, "Browse EVE Fittings") - crestMenu.Append(self.exportToEveId, "Export To EVE") + # CREST Menu + crestMenu = wx.Menu() + self.Append(crestMenu, "&CREST") + if self.sCrest.settings.get('mode') != CrestModes.IMPLICIT: + crestMenu.Append(self.ssoLoginId, "Manage Characters") + else: + crestMenu.Append(self.ssoLoginId, "Login to EVE") + crestMenu.Append(self.eveFittingsId, "Browse EVE Fittings") + crestMenu.Append(self.exportToEveId, "Export To EVE") - if self.sCrest.settings.get('mode') == CrestModes.IMPLICIT or len(self.sCrest.getCrestCharacters()) == 0: - self.Enable(self.eveFittingsId, False) - self.Enable(self.exportToEveId, False) + if self.sCrest.settings.get('mode') == CrestModes.IMPLICIT or len(self.sCrest.getCrestCharacters()) == 0: + self.Enable(self.eveFittingsId, False) + self.Enable(self.exportToEveId, False) - if not self.mainFrame.disableOverrideEditor: - windowMenu.AppendSeparator() - attrItem = wx.MenuItem(windowMenu, self.attrEditorId, "Attribute Overrides\tCTRL+B") - attrItem.SetBitmap(BitmapLoader.getBitmap("fit_rename_small", "gui")) - windowMenu.Append(attrItem) - windowMenu.Append(self.toggleOverridesId, "Turn Overrides On") + if not self.mainFrame.disableOverrideEditor: + windowMenu.AppendSeparator() + attrItem = wx.MenuItem(windowMenu, self.attrEditorId, "Attribute Overrides\tCTRL+B") + attrItem.SetBitmap(BitmapLoader.getBitmap("fit_rename_small", "gui")) + windowMenu.Append(attrItem) + windowMenu.Append(self.toggleOverridesId, "Turn Overrides On") # Help menu helpMenu = wx.Menu() diff --git a/pyfa.py b/pyfa.py index 379f67de9..3a573a6e2 100755 --- a/pyfa.py +++ b/pyfa.py @@ -371,13 +371,12 @@ if __name__ == "__main__": # if int(logVersion[0]) == 0 and int(logVersion[1]) < 10: # raise PreCheckException("Logbook version >= 0.10.0 is required.") - if 'wxMac' not in wx.PlatformInfo or ('wxMac' in wx.PlatformInfo and wx.VERSION >= (3, 0)): - try: - import requests - config.requestsVersion = requests.__version__ - except ImportError: - pass - # raise PreCheckException("Cannot import requests. You can download requests from https://pypi.python.org/pypi/requests.") + try: + import requests + config.requestsVersion = requests.__version__ + except ImportError: + pass + # raise PreCheckException("Cannot import requests. You can download requests from https://pypi.python.org/pypi/requests.") import eos.db diff --git a/service/port.py b/service/port.py index 6c743570c..2a396f854 100644 --- a/service/port.py +++ b/service/port.py @@ -49,8 +49,7 @@ from service.market import Market from utils.strfunctions import sequential_rep, replace_ltgt from abc import ABCMeta, abstractmethod -if 'wxMac' not in wx.PlatformInfo or ('wxMac' in wx.PlatformInfo and wx.VERSION >= (3, 0)): - from service.crest import Crest +from service.crest import Crest pyfalog = Logger(__name__)