From 7eb3ad98faad0dd625b567c77558b3d61729daf6 Mon Sep 17 00:00:00 2001 From: tgraviou Date: Mon, 21 Nov 2016 17:38:28 +0100 Subject: [PATCH 01/52] beginnings of price system choice --- gui/builtinStatsViews/priceViewFull.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/gui/builtinStatsViews/priceViewFull.py b/gui/builtinStatsViews/priceViewFull.py index 16935a136..5ee9ec829 100644 --- a/gui/builtinStatsViews/priceViewFull.py +++ b/gui/builtinStatsViews/priceViewFull.py @@ -69,6 +69,10 @@ class PriceViewFull(StatsView): setattr(self, "labelPrice%s" % type.capitalize(), lbl) hbox.Add(lbl, 0, wx.ALIGN_LEFT) + self.priceChoice = wx.Choice(contentPanel, choices=["Jita", "Amarr", "Dodixie", "Rens", "Hek"]) + contentSizer.Add(self.priceChoice, 1, wx.RIGHT | wx.LEFT, 3) + self.priceChoice.SetStringSelection("Jita") + def refreshPanel(self, fit): if fit is not None: self.fit = fit From 2f2800c360d74906ce0dd43db8c02bcf537c49f3 Mon Sep 17 00:00:00 2001 From: tgraviou Date: Thu, 24 Nov 2016 12:00:53 +0100 Subject: [PATCH 02/52] System list --- gui/builtinStatsViews/priceViewFull.py | 5 ++++- service/price.py | 12 +++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/gui/builtinStatsViews/priceViewFull.py b/gui/builtinStatsViews/priceViewFull.py index 5ee9ec829..f392d31aa 100644 --- a/gui/builtinStatsViews/priceViewFull.py +++ b/gui/builtinStatsViews/priceViewFull.py @@ -23,6 +23,8 @@ from gui import builtinStatsViews from gui.bitmapLoader import BitmapLoader from gui.utils.numberFormatter import formatAmount import service +from service import Price + class PriceViewFull(StatsView): name = "priceViewFull" @@ -69,9 +71,10 @@ class PriceViewFull(StatsView): setattr(self, "labelPrice%s" % type.capitalize(), lbl) hbox.Add(lbl, 0, wx.ALIGN_LEFT) - self.priceChoice = wx.Choice(contentPanel, choices=["Jita", "Amarr", "Dodixie", "Rens", "Hek"]) + self.priceChoice = wx.Choice(contentPanel, choices=Price.systemsList.keys()) contentSizer.Add(self.priceChoice, 1, wx.RIGHT | wx.LEFT, 3) self.priceChoice.SetStringSelection("Jita") + Price.currentSystemId = Price.systemsList.get(self.priceChoice.GetString(self.priceChoice.GetSelection())) def refreshPanel(self, fit): if fit is not None: diff --git a/service/price.py b/service/price.py index 71858cf7c..8215a46d9 100644 --- a/service/price.py +++ b/service/price.py @@ -29,6 +29,16 @@ TIMEOUT = 15*60 # Network timeout delay for connection issues, 15 minutes class Price(): + systemsList = { + "Jita": 30000142, + "Amarr": 30002187, + "Dodixie": 30002659, + "Rens": 30002510, + "Hek": 30002053 + } + + currentSystemId = systemsList.get("Jita") + @classmethod def fetchPrices(cls, prices): """Fetch all prices passed to this method""" @@ -64,7 +74,7 @@ class Price(): # Base request URL baseurl = "https://eve-central.com/api/marketstat" - data.append(("usesystem", 30000142)) # Use Jita for market + data.append(("usesystem", Price.currentSystemId)) # Use Jita for market for typeID in toRequest: # Add all typeID arguments data.append(("typeid", typeID)) From edc48f00178f60029731a34c4be96a6f5b25ca7e Mon Sep 17 00:00:00 2001 From: petosorus Date: Mon, 21 Nov 2016 17:38:28 +0100 Subject: [PATCH 03/52] beginnings of price system choice --- gui/builtinStatsViews/priceViewFull.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/gui/builtinStatsViews/priceViewFull.py b/gui/builtinStatsViews/priceViewFull.py index 16935a136..5ee9ec829 100644 --- a/gui/builtinStatsViews/priceViewFull.py +++ b/gui/builtinStatsViews/priceViewFull.py @@ -69,6 +69,10 @@ class PriceViewFull(StatsView): setattr(self, "labelPrice%s" % type.capitalize(), lbl) hbox.Add(lbl, 0, wx.ALIGN_LEFT) + self.priceChoice = wx.Choice(contentPanel, choices=["Jita", "Amarr", "Dodixie", "Rens", "Hek"]) + contentSizer.Add(self.priceChoice, 1, wx.RIGHT | wx.LEFT, 3) + self.priceChoice.SetStringSelection("Jita") + def refreshPanel(self, fit): if fit is not None: self.fit = fit From 48ccc7ff060f31abd2188af03ef37da47c17e0e9 Mon Sep 17 00:00:00 2001 From: petosorus Date: Thu, 24 Nov 2016 12:00:53 +0100 Subject: [PATCH 04/52] System list --- gui/builtinStatsViews/priceViewFull.py | 5 ++++- service/price.py | 12 +++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/gui/builtinStatsViews/priceViewFull.py b/gui/builtinStatsViews/priceViewFull.py index 5ee9ec829..f392d31aa 100644 --- a/gui/builtinStatsViews/priceViewFull.py +++ b/gui/builtinStatsViews/priceViewFull.py @@ -23,6 +23,8 @@ from gui import builtinStatsViews from gui.bitmapLoader import BitmapLoader from gui.utils.numberFormatter import formatAmount import service +from service import Price + class PriceViewFull(StatsView): name = "priceViewFull" @@ -69,9 +71,10 @@ class PriceViewFull(StatsView): setattr(self, "labelPrice%s" % type.capitalize(), lbl) hbox.Add(lbl, 0, wx.ALIGN_LEFT) - self.priceChoice = wx.Choice(contentPanel, choices=["Jita", "Amarr", "Dodixie", "Rens", "Hek"]) + self.priceChoice = wx.Choice(contentPanel, choices=Price.systemsList.keys()) contentSizer.Add(self.priceChoice, 1, wx.RIGHT | wx.LEFT, 3) self.priceChoice.SetStringSelection("Jita") + Price.currentSystemId = Price.systemsList.get(self.priceChoice.GetString(self.priceChoice.GetSelection())) def refreshPanel(self, fit): if fit is not None: diff --git a/service/price.py b/service/price.py index 71858cf7c..8215a46d9 100644 --- a/service/price.py +++ b/service/price.py @@ -29,6 +29,16 @@ TIMEOUT = 15*60 # Network timeout delay for connection issues, 15 minutes class Price(): + systemsList = { + "Jita": 30000142, + "Amarr": 30002187, + "Dodixie": 30002659, + "Rens": 30002510, + "Hek": 30002053 + } + + currentSystemId = systemsList.get("Jita") + @classmethod def fetchPrices(cls, prices): """Fetch all prices passed to this method""" @@ -64,7 +74,7 @@ class Price(): # Base request URL baseurl = "https://eve-central.com/api/marketstat" - data.append(("usesystem", 30000142)) # Use Jita for market + data.append(("usesystem", Price.currentSystemId)) # Use Jita for market for typeID in toRequest: # Add all typeID arguments data.append(("typeid", typeID)) From fcd934319db707e2686b920490a81d79f3f5c65d Mon Sep 17 00:00:00 2001 From: petosorus Date: Sun, 27 Nov 2016 11:10:33 +0100 Subject: [PATCH 05/52] Price listing price panel --- gui/builtinStatsViews/priceViewFull.py | 58 ++++++++++++++++++-------- service/price.py | 7 +++- 2 files changed, 46 insertions(+), 19 deletions(-) diff --git a/gui/builtinStatsViews/priceViewFull.py b/gui/builtinStatsViews/priceViewFull.py index f392d31aa..b4800c4ce 100644 --- a/gui/builtinStatsViews/priceViewFull.py +++ b/gui/builtinStatsViews/priceViewFull.py @@ -18,6 +18,7 @@ #=============================================================================== import wx +import gui.mainFrame from gui.statsView import StatsView from gui import builtinStatsViews from gui.bitmapLoader import BitmapLoader @@ -74,30 +75,51 @@ class PriceViewFull(StatsView): self.priceChoice = wx.Choice(contentPanel, choices=Price.systemsList.keys()) contentSizer.Add(self.priceChoice, 1, wx.RIGHT | wx.LEFT, 3) self.priceChoice.SetStringSelection("Jita") + self.priceChoice.Bind(wx.EVT_CHOICE, self.priceSelection) + + def priceSelection(self, event): Price.currentSystemId = Price.systemsList.get(self.priceChoice.GetString(self.priceChoice.GetSelection())) + mainFrame = gui.mainFrame.MainFrame.getInstance() + sFit = service.Fit.getInstance() + fit = sFit.getFit(mainFrame.getActiveFit()) + + typeIDs = self.fitItemsList(fit) + + sMkt = service.Market.getInstance() + sMkt.getPrices(typeIDs, Price.invalidPrices) + + self.refreshPanel(fit); + + + def fitItemsList(self, fit): + # Compose a list of all the data we need & request it + typeIDs = [] + typeIDs.append(fit.ship.item.ID) + + for mod in fit.modules: + if not mod.isEmpty: + typeIDs.append(mod.itemID) + + for drone in fit.drones: + for _ in xrange(drone.amount): + typeIDs.append(drone.itemID) + + for fighter in fit.fighters: + for _ in xrange(fighter.amountActive): + typeIDs.append(fighter.itemID) + + for cargo in fit.cargo: + for _ in xrange(cargo.amount): + typeIDs.append(cargo.itemID) + + return typeIDs + def refreshPanel(self, fit): if fit is not None: self.fit = fit - # Compose a list of all the data we need & request it - typeIDs = [] - typeIDs.append(fit.ship.item.ID) - for mod in fit.modules: - if not mod.isEmpty: - typeIDs.append(mod.itemID) - - for drone in fit.drones: - for _ in xrange(drone.amount): - typeIDs.append(drone.itemID) - - for fighter in fit.fighters: - for _ in xrange(fighter.amountActive): - typeIDs.append(fighter.itemID) - - for cargo in fit.cargo: - for _ in xrange(cargo.amount): - typeIDs.append(cargo.itemID) + typeIDs = self.fitItemsList(fit) sMkt = service.Market.getInstance() sMkt.getPrices(typeIDs, self.processPrices) diff --git a/service/price.py b/service/price.py index 8215a46d9..0a3b3b53d 100644 --- a/service/price.py +++ b/service/price.py @@ -37,7 +37,12 @@ class Price(): "Hek": 30002053 } - currentSystemId = systemsList.get("Jita") + currentSystemId = "" + + @classmethod + def invalidPrices(self, prices): + for price in prices: + price.time = 0 @classmethod def fetchPrices(cls, prices): From 9df54238d9ac71747830ee0e425de695943dfef2 Mon Sep 17 00:00:00 2001 From: petosorus Date: Thu, 5 Jan 2017 00:06:25 +0100 Subject: [PATCH 06/52] refresh modules price view --- gui/builtinStatsViews/priceViewFull.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/gui/builtinStatsViews/priceViewFull.py b/gui/builtinStatsViews/priceViewFull.py index b4800c4ce..ac2de40ea 100644 --- a/gui/builtinStatsViews/priceViewFull.py +++ b/gui/builtinStatsViews/priceViewFull.py @@ -25,6 +25,7 @@ from gui.bitmapLoader import BitmapLoader from gui.utils.numberFormatter import formatAmount import service from service import Price +import gui.globalEvents as GE class PriceViewFull(StatsView): @@ -35,6 +36,7 @@ class PriceViewFull(StatsView): self._cachedShip = 0 self._cachedFittings = 0 self._cachedTotal = 0 + self.mainFrame = gui.mainFrame.MainFrame.getInstance() def getHeaderText(self, fit): return "Price" @@ -73,12 +75,13 @@ class PriceViewFull(StatsView): hbox.Add(lbl, 0, wx.ALIGN_LEFT) self.priceChoice = wx.Choice(contentPanel, choices=Price.systemsList.keys()) - contentSizer.Add(self.priceChoice, 1, wx.RIGHT | wx.LEFT, 3) + contentSizer.Add(self.priceChoice) self.priceChoice.SetStringSelection("Jita") self.priceChoice.Bind(wx.EVT_CHOICE, self.priceSelection) def priceSelection(self, event): Price.currentSystemId = Price.systemsList.get(self.priceChoice.GetString(self.priceChoice.GetSelection())) + fitID = self.mainFrame.getActiveFit() mainFrame = gui.mainFrame.MainFrame.getInstance() sFit = service.Fit.getInstance() @@ -89,8 +92,8 @@ class PriceViewFull(StatsView): sMkt = service.Market.getInstance() sMkt.getPrices(typeIDs, Price.invalidPrices) - self.refreshPanel(fit); - + self.refreshPanel(fit) + wx.PostEvent(self.mainFrame, GE.FitChanged(fitID=fitID)) def fitItemsList(self, fit): # Compose a list of all the data we need & request it From a8fd7cf2e98b70a72b15304e5d3145955d7fd238 Mon Sep 17 00:00:00 2001 From: Ebag333 Date: Wed, 8 Feb 2017 12:50:42 -0800 Subject: [PATCH 07/52] Matplotlib 2.0 support --- gui/graphFrame.py | 97 ++++++++++++++++++++++++++++++----------------- 1 file changed, 63 insertions(+), 34 deletions(-) diff --git a/gui/graphFrame.py b/gui/graphFrame.py index 7b56c0ed0..4eceaba89 100644 --- a/gui/graphFrame.py +++ b/gui/graphFrame.py @@ -19,7 +19,6 @@ import os import logging -import imp import wx @@ -31,37 +30,37 @@ from gui.graph import Graph from gui.bitmapLoader import BitmapLoader from config import parsePath -# Don't actually import the thing, since it takes for fucking ever try: - imp.find_module('matplotlib') - enabled = True + import matplotlib as mpl + if mpl.__version__[0] >= "2": + mpl.use('wxagg') + mplImported = True + from matplotlib.patches import Patch + else: + mplImported = False + from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as Canvas + from matplotlib.figure import Figure + graphFrame_enabled = True except ImportError: - enabled = False - -mplImported = False + mpl = None + Canvas = None + Figure = None + mplImported = False + graphFrame_enabled = False logger = logging.getLogger(__name__) -if not enabled: +if not graphFrame_enabled: logger.info("Problems importing matplotlib; continuing without graphs") class GraphFrame(wx.Frame): def __init__(self, parent, style=wx.DEFAULT_FRAME_STYLE | wx.NO_FULL_REPAINT_ON_RESIZE | wx.FRAME_FLOAT_ON_PARENT): - global enabled + global graphFrame_enabled global mplImported - # Import here - try: - import matplotlib as mpl - from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as Canvas - from matplotlib.figure import Figure - enabled = True - except ImportError: - enabled = False - self.legendFix = False - if not enabled: + if not graphFrame_enabled: return try: @@ -69,7 +68,7 @@ class GraphFrame(wx.Frame): except: cache_dir = os.path.expanduser(os.path.join("~", ".matplotlib")) - cache_file = parsePath(cache_dir, 'fontList.cache') + cache_file = config.parsePath(cache_dir, 'fontList.cache') if os.access(cache_dir, os.W_OK | os.X_OK) and os.path.isfile(cache_file): # remove matplotlib font cache, see #234 @@ -77,12 +76,14 @@ class GraphFrame(wx.Frame): if not mplImported: mpl.use('wxagg') - enabled = True - if mpl.__version__[0] != "1": + graphFrame_enabled = True + if mpl.__version__[0] < "1": print("pyfa: Found matplotlib version ", mpl.__version__, " - activating OVER9000 workarounds") print("pyfa: Recommended minimum matplotlib version is 1.0.0") self.legendFix = True + self.mpl_version = mpl.__version__[0] + mplImported = True wx.Frame.__init__(self, parent, title=u"pyfa: Graph Generator", style=style, size=(520, 390)) @@ -236,21 +237,49 @@ class GraphFrame(wx.Frame): self.canvas.draw() return - if self.legendFix and len(legend) > 0: - leg = self.subplot.legend(tuple(legend), "upper right", shadow=False) - for t in leg.get_texts(): - t.set_fontsize('small') + if self.mpl_version < 2: + if self.legendFix and len(legend) > 0: + leg = self.subplot.legend(tuple(legend), "upper right", shadow=False) + for t in leg.get_texts(): + t.set_fontsize('small') - for l in leg.get_lines(): - l.set_linewidth(1) + for l in leg.get_lines(): + l.set_linewidth(1) - elif not self.legendFix and len(legend) > 0: - leg = self.subplot.legend(tuple(legend), "upper right", shadow=False, frameon=False) - for t in leg.get_texts(): - t.set_fontsize('small') + elif not self.legendFix and len(legend) > 0: + leg = self.subplot.legend(tuple(legend), "upper right", shadow=False, frameon=False) + for t in leg.get_texts(): + t.set_fontsize('small') - for l in leg.get_lines(): - l.set_linewidth(1) + for l in leg.get_lines(): + l.set_linewidth(1) + elif self.mpl_version >= 2: + legend2 = [] + legend_colors = { + 0: "blue", + 1: "orange", + 2: "green", + 3: "red", + 4: "purple", + 5: "brown", + 6: "pink", + 7: "grey", + } + + for i, i_name in enumerate(legend): + try: + selected_color = legend_colors[i] + except: + selected_color = None + legend2.append(Patch(color=selected_color,label=i_name),) + + if len(legend2) > 0: + leg = self.subplot.legend(handles=legend2) + for t in leg.get_texts(): + t.set_fontsize('small') + + for l in leg.get_lines(): + l.set_linewidth(1) self.canvas.draw() self.SetStatusText("") From e18deb5eeb646394ef16828cf92505f84651a34e Mon Sep 17 00:00:00 2001 From: Ebag333 Date: Wed, 8 Feb 2017 13:12:54 -0800 Subject: [PATCH 08/52] Roll up #967 and #974 Takes the import fixes and cleanup out of those and rolls it into this one --- eos/__init__.py | 6 ------ eos/db/__init__.py | 4 ++-- gui/additionsPane.py | 10 ++-------- .../moduleGlobalAmmoPicker.py | 4 ++-- gui/builtinStatsViews/resourcesViewFull.py | 4 ++-- gui/builtinViews/emptyView.py | 6 +++--- gui/contextMenu.py | 4 +++- gui/crestFittings.py | 6 +++--- gui/droneView.py | 12 +++++------ gui/graph.py | 2 +- gui/mainFrame.py | 20 +++++++++---------- gui/marketBrowser.py | 10 +++++----- gui/multiSwitch.py | 10 +++++----- gui/preferenceView.py | 3 ++- gui/propertyEditor.py | 6 +++--- gui/statsView.py | 3 ++- gui/viewColumn.py | 3 ++- 17 files changed, 53 insertions(+), 60 deletions(-) diff --git a/eos/__init__.py b/eos/__init__.py index 96a3c75be..83ab57f41 100644 --- a/eos/__init__.py +++ b/eos/__init__.py @@ -1,8 +1,2 @@ version = "0.2.3" tag = "git" - - -def test(): - import tests.runTests - import unittest - unittest.main(defaultTest="discover", testLoader=tests.runTests.loader) diff --git a/eos/db/__init__.py b/eos/db/__init__.py index e0dd4d135..aa599dca6 100644 --- a/eos/db/__init__.py +++ b/eos/db/__init__.py @@ -67,8 +67,8 @@ if saveddata_connectionstring is not None: sd_lock = threading.Lock() # Import all the definitions for all our database stuff -from eos.db.gamedata import * -from eos.db.saveddata import * +from eos.db.gamedata import alphaClones, attribute, category, effect, group, icon, item, marketGroup, metaData, metaGroup, queries, traits, unit +from eos.db.saveddata import booster, cargo, character, crest, damagePattern, databaseRepair, drone, fighter, fit, implant, implantSet, loadDefaultDatabaseValues, miscData, module, override, price, queries, skill, targetResists, user # Import queries from eos.db.gamedata.queries import * diff --git a/gui/additionsPane.py b/gui/additionsPane.py index c0616f597..a7a034032 100644 --- a/gui/additionsPane.py +++ b/gui/additionsPane.py @@ -18,7 +18,6 @@ # ============================================================================= import wx -import gui.mainFrame from gui.boosterView import BoosterView from gui.droneView import DroneView from gui.fighterView import FighterView @@ -31,7 +30,7 @@ from gui.notesView import NotesView from gui.pyfatogglepanel import TogglePanel from gui.bitmapLoader import BitmapLoader -import gui.chromeTabs +from gui.chromeTabs import PFNotebook class AdditionsPane(TogglePanel): @@ -45,9 +44,7 @@ class AdditionsPane(TogglePanel): baseSizer = wx.BoxSizer(wx.HORIZONTAL) pane.SetSizer(baseSizer) - self.mainFrame = gui.mainFrame.MainFrame.getInstance() - - self.notebook = gui.chromeTabs.PFNotebook(pane, False) + self.notebook = PFNotebook(pane, False) self.notebook.SetMinSize((-1, 1000)) baseSizer.Add(self.notebook, 1, wx.EXPAND) @@ -92,9 +89,6 @@ class AdditionsPane(TogglePanel): def select(self, name): self.notebook.SetSelection(self.PANES.index(name)) - def toggleBoosters(self, event): - self.notebook.ToggleShown(self.booster) - def getName(self, idx): return self.PANES[idx] diff --git a/gui/builtinContextMenus/moduleGlobalAmmoPicker.py b/gui/builtinContextMenus/moduleGlobalAmmoPicker.py index 035109320..3ccf5e3ff 100644 --- a/gui/builtinContextMenus/moduleGlobalAmmoPicker.py +++ b/gui/builtinContextMenus/moduleGlobalAmmoPicker.py @@ -3,7 +3,7 @@ import gui.mainFrame import wx import gui.globalEvents as GE from gui.builtinContextMenus.moduleAmmoPicker import ModuleAmmoPicker -import eos.db +from eos.db.saveddata.queries import getFit as db_getFit from service.fit import Fit @@ -26,7 +26,7 @@ class ModuleGlobalAmmoPicker(ModuleAmmoPicker): sFit = Fit.getInstance() fitID = self.mainFrame.getActiveFit() - fit = eos.db.getFit(fitID) + fit = db_getFit(fitID) selectedModule = self.modules[0] allModules = [] diff --git a/gui/builtinStatsViews/resourcesViewFull.py b/gui/builtinStatsViews/resourcesViewFull.py index 05c187661..10d8fd2d1 100644 --- a/gui/builtinStatsViews/resourcesViewFull.py +++ b/gui/builtinStatsViews/resourcesViewFull.py @@ -22,7 +22,7 @@ from gui.statsView import StatsView from gui.bitmapLoader import BitmapLoader from gui import pygauge as PG import gui.mainFrame -import gui.chromeTabs +from gui.chromeTabs import EVT_NOTEBOOK_PAGE_CHANGED from eos.saveddata.module import Hardpoint @@ -37,7 +37,7 @@ class ResourcesViewFull(StatsView): StatsView.__init__(self) self.parent = parent self.mainFrame = gui.mainFrame.MainFrame.getInstance() - self.mainFrame.additionsPane.notebook.Bind(gui.chromeTabs.EVT_NOTEBOOK_PAGE_CHANGED, self.pageChanged) + self.mainFrame.additionsPane.notebook.Bind(EVT_NOTEBOOK_PAGE_CHANGED, self.pageChanged) def pageChanged(self, event): page = self.mainFrame.additionsPane.getName(event.GetSelection()) diff --git a/gui/builtinViews/emptyView.py b/gui/builtinViews/emptyView.py index 0dc8d958e..5b19fa044 100644 --- a/gui/builtinViews/emptyView.py +++ b/gui/builtinViews/emptyView.py @@ -1,6 +1,6 @@ import wx import gui.globalEvents as GE -import gui.chromeTabs +from gui.chromeTabs import EVT_NOTEBOOK_PAGE_CHANGED import gui.mainFrame @@ -11,13 +11,13 @@ class BlankPage(wx.Panel): self.mainFrame = gui.mainFrame.MainFrame.getInstance() self.parent = parent - self.parent.Bind(gui.chromeTabs.EVT_NOTEBOOK_PAGE_CHANGED, self.pageChanged) + self.parent.Bind(EVT_NOTEBOOK_PAGE_CHANGED, self.pageChanged) self.SetBackgroundColour(wx.SystemSettings_GetColour(wx.SYS_COLOUR_WINDOW)) wx.PostEvent(self.mainFrame, GE.FitChanged(fitID=None)) def Destroy(self): - self.parent.Unbind(gui.chromeTabs.EVT_NOTEBOOK_PAGE_CHANGED, handler=self.pageChanged) + self.parent.Unbind(EVT_NOTEBOOK_PAGE_CHANGED, handler=self.pageChanged) wx.Panel.Destroy(self) def pageChanged(self, event): diff --git a/gui/contextMenu.py b/gui/contextMenu.py index 520ad8065..0d743ebc8 100644 --- a/gui/contextMenu.py +++ b/gui/contextMenu.py @@ -177,4 +177,6 @@ class ContextMenu(object): return None -from gui.builtinContextMenus import * # noqa +from gui.builtinContextMenus import ammoPattern, amount, cargo, changeAffectingSkills, damagePattern, droneRemoveStack, \ + droneSplit, factorReload, fighterAbilities, implantSets, itemRemove, itemStats, marketJump, metaSwap, moduleAmmoPicker, \ + moduleGlobalAmmoPicker, openFit, priceClear, project, shipJump, tacticalMode, targetResists, whProjector diff --git a/gui/crestFittings.py b/gui/crestFittings.py index 13aafb0d3..c6eec6439 100644 --- a/gui/crestFittings.py +++ b/gui/crestFittings.py @@ -10,7 +10,7 @@ from service.fit import Fit from eos.saveddata.cargo import Cargo from eos.db import getItem -import gui.display as d +from gui.display import Display import gui.globalEvents as GE if 'wxMac' not in wx.PlatformInfo or ('wxMac' in wx.PlatformInfo and wx.VERSION >= (3, 0)): @@ -411,10 +411,10 @@ class FittingsTreeView(wx.Panel): self.parent.fitView.update(list) -class FitView(d.Display): +class FitView(Display): DEFAULT_COLS = ["Base Icon", "Base Name"] def __init__(self, parent): - d.Display.__init__(self, parent, style=wx.LC_SINGLE_SEL) + Display.__init__(self, parent, style=wx.LC_SINGLE_SEL) self.fitSelection = None diff --git a/gui/droneView.py b/gui/droneView.py index 4d389e8ea..bcee91378 100644 --- a/gui/droneView.py +++ b/gui/droneView.py @@ -20,8 +20,8 @@ import wx import gui.globalEvents as GE -import gui.marketBrowser as mb -import gui.display as d +from gui.marketBrowser import ITEM_SELECTED, ItemSelected +from gui.display import Display from gui.builtinViewColumns.state import State from gui.contextMenu import ContextMenu from service.fit import Fit @@ -43,7 +43,7 @@ class DroneViewDrop(wx.PyDropTarget): return t -class DroneView(d.Display): +class DroneView(Display): DEFAULT_COLS = [ "State", # "Base Icon", @@ -56,7 +56,7 @@ class DroneView(d.Display): ] def __init__(self, parent): - d.Display.__init__(self, parent, style=wx.LC_SINGLE_SEL | wx.BORDER_NONE) + Display.__init__(self, parent, style=wx.LC_SINGLE_SEL | wx.BORDER_NONE) self.lastFitId = None @@ -64,7 +64,7 @@ class DroneView(d.Display): self.hoveredColumn = None self.mainFrame.Bind(GE.FIT_CHANGED, self.fitChanged) - self.mainFrame.Bind(mb.ITEM_SELECTED, self.addItem) + self.mainFrame.Bind(ITEM_SELECTED, self.addItem) self.Bind(wx.EVT_LEFT_DCLICK, self.removeItem) self.Bind(wx.EVT_LEFT_DOWN, self.click) self.Bind(wx.EVT_KEY_UP, self.kbEvent) @@ -141,7 +141,7 @@ class DroneView(d.Display): if srcRow != -1 and dstRow != -1: self._merge(srcRow, dstRow) elif data[0] == "market": - wx.PostEvent(self.mainFrame, mb.ItemSelected(itemID=int(data[1]))) + wx.PostEvent(self.mainFrame, ItemSelected(itemID=int(data[1]))) def _merge(self, src, dst): sFit = Fit.getInstance() diff --git a/gui/graph.py b/gui/graph.py index 720e10cb8..00ee58694 100644 --- a/gui/graph.py +++ b/gui/graph.py @@ -35,4 +35,4 @@ class Graph(object): return None -from gui.builtinGraphs import * # noqa +from gui.builtinGraphs import fitDps diff --git a/gui/mainFrame.py b/gui/mainFrame.py index 7e2eb072f..bb9926dc8 100644 --- a/gui/mainFrame.py +++ b/gui/mainFrame.py @@ -35,7 +35,7 @@ import config from eos.config import gamedata_version import gui.aboutData -import gui.chromeTabs +from gui.chromeTabs import PFNotebook import gui.globalEvents as GE from gui.bitmapLoader import BitmapLoader @@ -55,7 +55,7 @@ from gui.graphFrame import GraphFrame from gui.copySelectDialog import CopySelectDialog from gui.utils.clipboard import toClipboard, fromClipboard from gui.updateDialog import UpdateDialog -from gui.builtinViews import * # TODO: unsure if this is needed here +from gui.builtinViews import emptyView, entityEditor, fittingView, implantEditor from gui import graphFrame from service.settings import SettingsProvider @@ -66,7 +66,7 @@ from service.update import Update # import this to access override setting from eos.modifiedAttributeDict import ModifiedAttributeDict from eos.db.saveddata.loadDefaultDatabaseValues import DefaultDatabaseValues -from eos import db +from eos.db.saveddata.queries import getFit as db_getFit from service.port import Port from service.settings import HTMLExportSettings @@ -171,7 +171,7 @@ class MainFrame(wx.Frame): self.fitMultiSwitch = MultiSwitch(self.fitting_additions_split) self.additionsPane = AdditionsPane(self.fitting_additions_split) - self.notebookBrowsers = gui.chromeTabs.PFNotebook(self.browser_fitting_split, False) + self.notebookBrowsers = PFNotebook(self.browser_fitting_split, False) marketImg = BitmapLoader.getImage("market_small", "gui") shipBrowserImg = BitmapLoader.getImage("ship_small", "gui") @@ -700,27 +700,27 @@ class MainFrame(wx.Frame): self.marketBrowser.search.Focus() def clipboardEft(self): - fit = db.getFit(self.getActiveFit()) + fit = db_getFit(self.getActiveFit()) toClipboard(Port.exportEft(fit)) def clipboardEftImps(self): - fit = db.getFit(self.getActiveFit()) + fit = db_getFit(self.getActiveFit()) toClipboard(Port.exportEftImps(fit)) def clipboardDna(self): - fit = db.getFit(self.getActiveFit()) + fit = db_getFit(self.getActiveFit()) toClipboard(Port.exportDna(fit)) def clipboardCrest(self): - fit = db.getFit(self.getActiveFit()) + fit = db_getFit(self.getActiveFit()) toClipboard(Port.exportCrest(fit)) def clipboardXml(self): - fit = db.getFit(self.getActiveFit()) + fit = db_getFit(self.getActiveFit()) toClipboard(Port.exportXml(None, fit)) def clipboardMultiBuy(self): - fit = db.getFit(self.getActiveFit()) + fit = db_getFit(self.getActiveFit()) toClipboard(Port.exportMultiBuy(fit)) def importFromClipboard(self, event): diff --git a/gui/marketBrowser.py b/gui/marketBrowser.py index 213e0520d..cbf17e6e8 100644 --- a/gui/marketBrowser.py +++ b/gui/marketBrowser.py @@ -20,7 +20,7 @@ import wx from service.market import Market from service.attribute import Attribute -import gui.display as d +from gui.display import Display import gui.PFSearchBox as SBox from gui.cachingImageList import CachingImageList from gui.contextMenu import ContextMenu @@ -216,14 +216,14 @@ class MarketTree(wx.TreeCtrl): self.marketBrowser.itemView.selectionMade() -class ItemView(d.Display): +class ItemView(Display): DEFAULT_COLS = ["Base Icon", "Base Name", "attr:power,,,True", "attr:cpu,,,True"] def __init__(self, parent, marketBrowser): - d.Display.__init__(self, parent) + Display.__init__(self, parent) marketBrowser.Bind(wx.EVT_TREE_SEL_CHANGED, self.selectionMade) self.unfilteredStore = set() @@ -429,7 +429,7 @@ class ItemView(d.Display): # Mark current item list as active self.active = items # Show them - d.Display.populate(self, items) + Display.populate(self, items) def refresh(self, items): if len(items) > 1: @@ -445,7 +445,7 @@ class ItemView(d.Display): # set shortcut info for first 9 modules item.marketShortcut = i + 1 - d.Display.refresh(self, items) + Display.refresh(self, items) def makeReverseMetaMap(self): """ diff --git a/gui/multiSwitch.py b/gui/multiSwitch.py index 766524a61..2efe80bc0 100644 --- a/gui/multiSwitch.py +++ b/gui/multiSwitch.py @@ -17,13 +17,13 @@ # along with pyfa. If not, see . # ============================================================================= -import gui.chromeTabs +from gui.chromeTabs import PFNotebook import gui.builtinViews.emptyView -class MultiSwitch(gui.chromeTabs.PFNotebook): +class MultiSwitch(PFNotebook): def __init__(self, parent): - gui.chromeTabs.PFNotebook.__init__(self, parent) + PFNotebook.__init__(self, parent) # self.AddPage() # now handled by mainFrame self.handlers = handlers = [] for type in TabSpawner.tabTypes: @@ -40,10 +40,10 @@ class MultiSwitch(gui.chromeTabs.PFNotebook): tabWnd = gui.builtinViews.emptyView.BlankPage(self) tabWnd.handleDrag = lambda type, info: self.handleDrag(type, info) - gui.chromeTabs.PFNotebook.AddPage(self, tabWnd, tabTitle, tabImage, True) + PFNotebook.AddPage(self, tabWnd, tabTitle, tabImage, True) def DeletePage(self, n, *args, **kwargs): - gui.chromeTabs.PFNotebook.DeletePage(self, n, *args, **kwargs) + PFNotebook.DeletePage(self, n, *args, **kwargs) if self.GetPageCount() == 0: self.AddPage() diff --git a/gui/preferenceView.py b/gui/preferenceView.py index 06e7d10e2..4bff674fc 100644 --- a/gui/preferenceView.py +++ b/gui/preferenceView.py @@ -37,4 +37,5 @@ class PreferenceView(object): return wx.NullBitmap -from gui.builtinPreferenceViews import * # noqa +from gui.builtinPreferenceViews import pyfaCrestPreferences, pyfaGeneralPreferences, \ + pyfaHTMLExportPreferences, pyfaNetworkPreferences, pyfaUpdatePreferences diff --git a/gui/propertyEditor.py b/gui/propertyEditor.py index 1129545a6..405e2a5d3 100644 --- a/gui/propertyEditor.py +++ b/gui/propertyEditor.py @@ -11,7 +11,7 @@ except: else: raise -import eos.db +from eos.db.gamedata.queries import getItem, getAttributeInfo from service.market import Market import gui.display as d import gui.globalEvents as GE @@ -104,8 +104,8 @@ class AttributeEditor(wx.Frame): spamreader = csv.reader(csvfile) for row in spamreader: itemID, attrID, value = row - item = eos.db.getItem(int(itemID)) - attr = eos.db.getAttributeInfo(int(attrID)) + item = getItem(int(itemID)) + attr = getAttributeInfo(int(attrID)) item.setOverride(attr, float(value)) self.itemView.updateItems(True) diff --git a/gui/statsView.py b/gui/statsView.py index 2cd8db548..0f9416cae 100644 --- a/gui/statsView.py +++ b/gui/statsView.py @@ -42,4 +42,5 @@ class StatsView(object): raise NotImplementedError() -from gui.builtinStatsViews import * # noqa +from gui.builtinStatsViews import capacitorViewFull, firepowerViewFull, miningyieldViewFull, priceViewFull, rechargeViewFull, \ + resistancesViewFull, resourcesViewFull, targetingMiscViewFull diff --git a/gui/viewColumn.py b/gui/viewColumn.py index 9afca36e7..ae3af6e7a 100644 --- a/gui/viewColumn.py +++ b/gui/viewColumn.py @@ -65,4 +65,5 @@ class ViewColumn(object): raise NotImplementedError() -from gui.builtinViewColumns import * # noqa +from gui.builtinViewColumns import abilities, ammo, ammoIcon, attributeDisplay, baseIcon, baseName, capacitorUse, maxRange, \ + misc, price, propertyDisplay, state From e5fb90f0175f0257ec29be9f06731e1a431c8ccc Mon Sep 17 00:00:00 2001 From: Ebag333 Date: Wed, 8 Feb 2017 14:22:56 -0800 Subject: [PATCH 09/52] Fix commit message. LOTS of fixes for flake8. --- eos/db/migrations/upgrade15.py | 2 -- eos/db/migrations/upgrade17.py | 2 -- eos/db/migrations/upgrade19.py | 2 -- eos/db/saveddata/databaseRepair.py | 3 ++- gui/builtinViewColumns/misc.py | 4 ++-- gui/builtinViews/fittingView.py | 2 +- gui/contextMenu.py | 34 ++++++++++++++++++++++++------ gui/graph.py | 2 +- gui/mainFrame.py | 5 +---- gui/mainMenuBar.py | 1 - gui/preferenceView.py | 9 ++++++-- gui/statsView.py | 12 +++++++++-- gui/viewColumn.py | 16 ++++++++++++-- pyfa.py | 2 +- service/fit.py | 1 - service/prefetch.py | 2 -- service/pycrest/eve.py | 5 ----- tox.ini | 2 +- 18 files changed, 68 insertions(+), 38 deletions(-) diff --git a/eos/db/migrations/upgrade15.py b/eos/db/migrations/upgrade15.py index 13852b035..feb824dad 100644 --- a/eos/db/migrations/upgrade15.py +++ b/eos/db/migrations/upgrade15.py @@ -4,8 +4,6 @@ Migration 15 - Delete projected modules on citadels """ -import sqlalchemy - def upgrade(saveddata_engine): sql = """ diff --git a/eos/db/migrations/upgrade17.py b/eos/db/migrations/upgrade17.py index 1d6a4cff8..90ed6e646 100644 --- a/eos/db/migrations/upgrade17.py +++ b/eos/db/migrations/upgrade17.py @@ -4,8 +4,6 @@ Migration 17 - Moves all fleet boosters to the new schema """ -import sqlalchemy - def upgrade(saveddata_engine): from eos.db import saveddata_session diff --git a/eos/db/migrations/upgrade19.py b/eos/db/migrations/upgrade19.py index 090f07dda..d10836e31 100644 --- a/eos/db/migrations/upgrade19.py +++ b/eos/db/migrations/upgrade19.py @@ -4,8 +4,6 @@ Migration 19 - Deletes broken references to fits from the commandFits table (see GH issue #844) """ -import sqlalchemy - def upgrade(saveddata_engine): from eos.db import saveddata_session diff --git a/eos/db/saveddata/databaseRepair.py b/eos/db/saveddata/databaseRepair.py index 6c32695a6..185f8bed1 100644 --- a/eos/db/saveddata/databaseRepair.py +++ b/eos/db/saveddata/databaseRepair.py @@ -85,7 +85,8 @@ class DatabaseCleanup: logger.error("More than one uniform damage pattern found.") else: uniform_damage_pattern_id = rows[0]['ID'] - update_query = "UPDATE 'fits' SET 'damagePatternID' = {} WHERE damagePatternID NOT IN (SELECT ID FROM damagePatterns) OR damagePatternID IS NULL".format(uniform_damage_pattern_id) + update_query = "UPDATE 'fits' SET 'damagePatternID' = {} " \ + "WHERE damagePatternID NOT IN (SELECT ID FROM damagePatterns) OR damagePatternID IS NULL".format(uniform_damage_pattern_id) update_results = DatabaseCleanup.ExecuteSQLQuery(saveddata_engine, update_query) logger.error("Database corruption found. Cleaning up %d records.", update_results.rowcount) diff --git a/gui/builtinViewColumns/misc.py b/gui/builtinViewColumns/misc.py index a5188253d..6540a8fa4 100644 --- a/gui/builtinViewColumns/misc.py +++ b/gui/builtinViewColumns/misc.py @@ -504,8 +504,8 @@ class Miscellanea(ViewColumn): for number_of_cycles in {5, 10, 25}: tooltip = "{0}\n{1} charges lasts {2} seconds ({3} cycles)".format( tooltip, - formatAmount(number_of_cycles*cycles, 3, 0, 3), - formatAmount((duration+reload_time)*number_of_cycles, 3, 0, 3), + formatAmount(number_of_cycles * cycles, 3, 0, 3), + formatAmount((duration + reload_time) * number_of_cycles, 3, 0, 3), formatAmount(number_of_cycles, 3, 0, 3) ) text = "{0} / {1}s (+{2}s)".format( diff --git a/gui/builtinViews/fittingView.py b/gui/builtinViews/fittingView.py index fc59fac13..8306dfa8d 100644 --- a/gui/builtinViews/fittingView.py +++ b/gui/builtinViews/fittingView.py @@ -31,7 +31,7 @@ from gui.builtinViewColumns.state import State from gui.bitmapLoader import BitmapLoader import gui.builtinViews.emptyView from gui.utils.exportHtml import exportHtml -from logging import getLogger, Formatter +from logging import getLogger from service.fit import Fit from service.market import Market diff --git a/gui/contextMenu.py b/gui/contextMenu.py index 0d743ebc8..527535393 100644 --- a/gui/contextMenu.py +++ b/gui/contextMenu.py @@ -58,7 +58,7 @@ class ContextMenu(object): rootMenu.selection = (selection,) if not hasattr(selection, "__iter__") else selection empty = True for i, fullContext in enumerate(fullContexts): - amount = 0 + display_amount = 0 srcContext = fullContext[0] try: itemContext = fullContext[1] @@ -68,7 +68,7 @@ class ContextMenu(object): # loop through registered menus m = menuHandler() if m.display(srcContext, selection): - amount += 1 + display_amount += 1 texts = m.getText(itemContext, selection) if isinstance(texts, basestring): @@ -115,7 +115,7 @@ class ContextMenu(object): empty = False - if amount > 0 and i != len(fullContexts) - 1: + if display_amount > 0 and i != len(fullContexts) - 1: rootMenu.AppendSeparator() debug_end = len(cls._ids) @@ -177,6 +177,28 @@ class ContextMenu(object): return None -from gui.builtinContextMenus import ammoPattern, amount, cargo, changeAffectingSkills, damagePattern, droneRemoveStack, \ - droneSplit, factorReload, fighterAbilities, implantSets, itemRemove, itemStats, marketJump, metaSwap, moduleAmmoPicker, \ - moduleGlobalAmmoPicker, openFit, priceClear, project, shipJump, tacticalMode, targetResists, whProjector +from gui.builtinContextMenus import ( # noqa: E402,F401 + ammoPattern, + amount, + cargo, + changeAffectingSkills, + damagePattern, + droneRemoveStack, + droneSplit, + factorReload, + fighterAbilities, + implantSets, + itemRemove, + itemStats, + marketJump, + metaSwap, + moduleAmmoPicker, + moduleGlobalAmmoPicker, + openFit, + priceClear, + project, + shipJump, + tacticalMode, + targetResists, + whProjector +) diff --git a/gui/graph.py b/gui/graph.py index 00ee58694..9c2739479 100644 --- a/gui/graph.py +++ b/gui/graph.py @@ -35,4 +35,4 @@ class Graph(object): return None -from gui.builtinGraphs import fitDps +from gui.builtinGraphs import fitDps # noqa: E402, F401 diff --git a/gui/mainFrame.py b/gui/mainFrame.py index bb9926dc8..fdaa6e6ba 100644 --- a/gui/mainFrame.py +++ b/gui/mainFrame.py @@ -71,9 +71,6 @@ from service.port import Port from service.settings import HTMLExportSettings from time import gmtime, strftime -import logging - -logger = logging.getLogger(__name__) import threading import webbrowser @@ -91,7 +88,7 @@ if 'wxMac' not in wx.PlatformInfo or ('wxMac' in wx.PlatformInfo and wx.VERSION print("Error loading Attribute Editor: %s.\nAccess to Attribute Editor is disabled." % e.message) disableOverrideEditor = True -logger = logging.getLogger("pyfa.gui.mainFrame") +logger = logging.getLogger(__name__) # dummy panel(no paint no erasebk) diff --git a/gui/mainMenuBar.py b/gui/mainMenuBar.py index 5e28da949..340a66e3a 100644 --- a/gui/mainMenuBar.py +++ b/gui/mainMenuBar.py @@ -21,7 +21,6 @@ import wx import config from service.character import Character -#import gui.graphFrame import gui.globalEvents as GE from gui.bitmapLoader import BitmapLoader diff --git a/gui/preferenceView.py b/gui/preferenceView.py index 4bff674fc..2f7b34bd8 100644 --- a/gui/preferenceView.py +++ b/gui/preferenceView.py @@ -37,5 +37,10 @@ class PreferenceView(object): return wx.NullBitmap -from gui.builtinPreferenceViews import pyfaCrestPreferences, pyfaGeneralPreferences, \ - pyfaHTMLExportPreferences, pyfaNetworkPreferences, pyfaUpdatePreferences +from gui.builtinPreferenceViews import (# noqa: E402, F401 + pyfaGeneralPreferences, + pyfaNetworkPreferences, + pyfaHTMLExportPreferences, + pyfaCrestPreferences, + pyfaUpdatePreferences +) diff --git a/gui/statsView.py b/gui/statsView.py index 0f9416cae..62993ade0 100644 --- a/gui/statsView.py +++ b/gui/statsView.py @@ -42,5 +42,13 @@ class StatsView(object): raise NotImplementedError() -from gui.builtinStatsViews import capacitorViewFull, firepowerViewFull, miningyieldViewFull, priceViewFull, rechargeViewFull, \ - resistancesViewFull, resourcesViewFull, targetingMiscViewFull +from gui.builtinStatsViews import ( # noqa: E402, F401 + resourcesViewFull, + resistancesViewFull, + firepowerViewFull, + miningyieldViewFull, + capacitorViewFull, + rechargeViewFull, + targetingMiscViewFull, + priceViewFull, +) diff --git a/gui/viewColumn.py b/gui/viewColumn.py index ae3af6e7a..cd13055bb 100644 --- a/gui/viewColumn.py +++ b/gui/viewColumn.py @@ -65,5 +65,17 @@ class ViewColumn(object): raise NotImplementedError() -from gui.builtinViewColumns import abilities, ammo, ammoIcon, attributeDisplay, baseIcon, baseName, capacitorUse, maxRange, \ - misc, price, propertyDisplay, state +from gui.builtinViewColumns import ( # noqa: E402, F401 + abilities, + ammo, + ammoIcon, + attributeDisplay, + baseIcon, + baseName, + capacitorUse, + maxRange, + misc, + price, + propertyDisplay, + state +) diff --git a/pyfa.py b/pyfa.py index 4eb9e0b9d..b27389971 100755 --- a/pyfa.py +++ b/pyfa.py @@ -125,7 +125,7 @@ if __name__ == "__main__": import os.path import eos.db - import service.prefetch + import service.prefetch # noqa: F401 from gui.mainFrame import MainFrame # Make sure the saveddata db exists diff --git a/service/fit.py b/service/fit.py index 5a345c4c7..30ff67960 100644 --- a/service/fit.py +++ b/service/fit.py @@ -34,7 +34,6 @@ from eos.saveddata.module import Module as es_Module, State, Slot from eos.saveddata.fit import Fit as FitType from service.character import Character from service.damagePattern import DamagePattern -from service.market import Market from service.settings import SettingsProvider logger = logging.getLogger(__name__) diff --git a/service/prefetch.py b/service/prefetch.py index 257fe37bc..dda8a319f 100644 --- a/service/prefetch.py +++ b/service/prefetch.py @@ -17,7 +17,6 @@ # along with pyfa. If not, see . # ============================================================================= -import threading import os import config @@ -25,7 +24,6 @@ from eos import db from eos.db import migration from eos.db.saveddata.loadDefaultDatabaseValues import DefaultDatabaseValues from eos.db.saveddata.databaseRepair import DatabaseCleanup -from eos.saveddata.character import Character as es_Character import logging diff --git a/service/pycrest/eve.py b/service/pycrest/eve.py index b4ab03cd6..cd5a82f8c 100644 --- a/service/pycrest/eve.py +++ b/service/pycrest/eve.py @@ -22,11 +22,6 @@ try: except ImportError: # pragma: no cover import cPickle as pickle -try: - from urllib.parse import quote -except ImportError: # pragma: no cover - from urllib import quote - logger = logging.getLogger("pycrest.eve") cache_re = re.compile(r'max-age=([0-9]+)') diff --git a/tox.ini b/tox.ini index dea12ad99..9e9d26985 100644 --- a/tox.ini +++ b/tox.ini @@ -14,4 +14,4 @@ commands = py.test -vv --cov Pyfa tests/ deps = flake8 # TODO: Remove F class exceptions once all imports are fixed # TODO: Remove E731 and convert lambdas to defs -commands = flake8 --exclude=.svn,CVS,.bzr,.hg,.git,__pycache__,venv,tests,.tox,build,dist,__init__.py --ignore=E126,E127,E128,E731,F401,F403,F405 service gui eos utils config.py pyfa.py --max-line-length=165 +commands = flake8 --exclude=.svn,CVS,.bzr,.hg,.git,__pycache__,venv,tests,.tox,build,dist,__init__.py --ignore=E126,E127,E128,E731 service gui eos utils config.py pyfa.py --max-line-length=165 From de87c992d7cc091c42730d403899842303ecb7d5 Mon Sep 17 00:00:00 2001 From: Ebag333 Date: Wed, 8 Feb 2017 16:50:41 -0800 Subject: [PATCH 10/52] Remove calling es_Module from effectHandlerHelpers, this causes a circular import. Instead pass in from fit. --- eos/effectHandlerHelpers.py | 21 ++++++++------------- service/fit.py | 10 +++++++--- 2 files changed, 15 insertions(+), 16 deletions(-) diff --git a/eos/effectHandlerHelpers.py b/eos/effectHandlerHelpers.py index 7c5e87d39..057db5d4d 100644 --- a/eos/effectHandlerHelpers.py +++ b/eos/effectHandlerHelpers.py @@ -164,26 +164,21 @@ class HandledModuleList(HandledList): for i in xrange(oldPos, len(self)): self[i].position -= 1 - def toDummy(self, index): - mod = self[index] - if not mod.isEmpty: - pass - # TODO: This can't point to es_Module, cyclical import loop - ''' - dummy = es_Module.buildEmpty(mod.slot) - dummy.position = index - self[index] = dummy - ''' - def toModule(self, index, mod): mod.position = index self[index] = mod - def freeSlot(self, slot): + def toDummy(self, index, dummy): + mod = self[index] + if not mod.isEmpty: + dummy.position = index + self[index] = dummy + + def freeSlot(self, slot, dummy): for i in range(len(self)): mod = self[i] if mod.getModifiedItemAttr("subSystemSlot") == slot: - self.toDummy(i) + self.toDummy(i, dummy) break diff --git a/service/fit.py b/service/fit.py index 30ff67960..ce5143cf0 100644 --- a/service/fit.py +++ b/service/fit.py @@ -421,7 +421,9 @@ class Fit(object): return False if m.item.category.name == "Subsystem": - fit.modules.freeSlot(m.getModifiedItemAttr("subSystemSlot")) + slot = m.getModifiedItemAttr("subSystemSlot") + dummy_module = es_Module.buildEmpty(fit.modules[slot]) + fit.modules.freeSlot(slot, dummy_module) if m.fits(fit): m.owner = fit @@ -448,7 +450,8 @@ class Fit(object): return None numSlots = len(fit.modules) - fit.modules.toDummy(position) + dummy_module = es_Module.buildEmpty(fit.modules[position].slot) + fit.modules.toDummy(position, dummy_module) self.recalc(fit) self.checkStates(fit, None) fit.fill() @@ -459,7 +462,8 @@ class Fit(object): fit = eos.db.getFit(fitID) # Dummy it out in case the next bit fails - fit.modules.toDummy(position) + dummy_module = es_Module.buildEmpty(fit.modules[position].slot) + fit.modules.toDummy(position, dummy_module) item = eos.db.getItem(newItemID, eager=("attributes", "group.category")) try: From 3e916e42f2b7e993f3e32e18bd88e5f4cfddb0b1 Mon Sep 17 00:00:00 2001 From: Ebag333 Date: Wed, 8 Feb 2017 17:55:20 -0800 Subject: [PATCH 11/52] pyCharm inspection fixes. Mostly variable refernce issues --- eos/db/__init__.py | 2 + eos/db/saveddata/queries.py | 1 + eos/effectHandlerHelpers.py | 5 -- eos/saveddata/fit.py | 10 +--- gui/boosterView.py | 3 +- gui/builtinContextMenus/moduleAmmoPicker.py | 2 +- .../moduleGlobalAmmoPicker.py | 1 + gui/builtinStatsViews/resourcesViewFull.py | 47 ++++++++++++------- gui/builtinViews/fittingView.py | 3 +- gui/cargoView.py | 3 +- gui/chromeTabs.py | 1 + gui/commandView.py | 3 +- gui/crestFittings.py | 4 +- gui/droneView.py | 3 +- gui/fighterView.py | 3 +- gui/mainFrame.py | 4 +- gui/marketBrowser.py | 1 + gui/projectedView.py | 3 +- gui/resistsEditor.py | 2 + gui/utils/compat.py | 5 +- service/fit.py | 6 +-- service/market.py | 2 - service/port.py | 2 + utils/compat.py | 5 +- 24 files changed, 70 insertions(+), 51 deletions(-) diff --git a/eos/db/__init__.py b/eos/db/__init__.py index aa599dca6..cb6742d19 100644 --- a/eos/db/__init__.py +++ b/eos/db/__init__.py @@ -62,6 +62,8 @@ if saveddata_connectionstring is not None: saveddata_meta = MetaData() saveddata_meta.bind = saveddata_engine saveddata_session = sessionmaker(bind=saveddata_engine, autoflush=False, expire_on_commit=False)() +else: + saveddata_meta = None # Lock controlling any changes introduced to session sd_lock = threading.Lock() diff --git a/eos/db/saveddata/queries.py b/eos/db/saveddata/queries.py index 58beb4448..16f6a3bf9 100644 --- a/eos/db/saveddata/queries.py +++ b/eos/db/saveddata/queries.py @@ -68,6 +68,7 @@ if configVal is True: def checkAndReturn(*args, **kwargs): useCache = kwargs.pop("useCache", True) cacheKey = [] + items = None cacheKey.extend(args) for keyword in keywords: cacheKey.append(kwargs.get(keyword)) diff --git a/eos/effectHandlerHelpers.py b/eos/effectHandlerHelpers.py index 057db5d4d..f4854d577 100644 --- a/eos/effectHandlerHelpers.py +++ b/eos/effectHandlerHelpers.py @@ -17,12 +17,7 @@ # along with eos. If not, see . # =============================================================================== -# from sqlalchemy.orm.attributes import flag_modified import logging -# TODO: This can't point to es_Module, cyclical import loop -# from eos.saveddata.module import Module as es_Module, State as es_State - -import eos.db logger = logging.getLogger(__name__) diff --git a/eos/saveddata/fit.py b/eos/saveddata/fit.py index de1eb2967..2632707c7 100644 --- a/eos/saveddata/fit.py +++ b/eos/saveddata/fit.py @@ -27,7 +27,6 @@ from sqlalchemy.orm import validates, reconstructor import eos.db from eos import capSim -from eos.effectHandlerHelpers import * from eos.effectHandlerHelpers import HandledModuleList, HandledDroneCargoList, HandledImplantBoosterList, HandledProjectedDroneList, HandledProjectedModList from eos.enum import Enum from eos.saveddata.ship import Ship @@ -39,15 +38,10 @@ import logging logger = logging.getLogger(__name__) -try: - from collections import OrderedDict -except ImportError: - from utils.compat import OrderedDict - class ImplantLocation(Enum): def __init__(self): - pass + Enum.__init__(self) FIT = 0 CHARACTER = 1 @@ -727,7 +721,7 @@ class Fit(object): self.register(item) item.calculateModifiedAttributes(self, runTime, False) - if projected is True and item not in chain.from_iterable(r): + if projected is True and projectionInfo and item not in chain.from_iterable(r): # apply effects onto target fit for _ in xrange(projectionInfo.amount): targetFit.register(item, origin=self) diff --git a/gui/boosterView.py b/gui/boosterView.py index d4d631942..110a04b04 100644 --- a/gui/boosterView.py +++ b/gui/boosterView.py @@ -27,7 +27,8 @@ from service.fit import Fit class BoosterViewDrop(wx.PyDropTarget): - def __init__(self, dropFn): + def __init__(self, dropFn, *args, **kwargs): + super(BoosterViewDrop, self).__init__(*args, **kwargs) wx.PyDropTarget.__init__(self) self.dropFn = dropFn # this is really transferring an EVE itemID diff --git a/gui/builtinContextMenus/moduleAmmoPicker.py b/gui/builtinContextMenus/moduleAmmoPicker.py index ba7b7cfc1..4e0111493 100644 --- a/gui/builtinContextMenus/moduleAmmoPicker.py +++ b/gui/builtinContextMenus/moduleAmmoPicker.py @@ -157,7 +157,7 @@ class ModuleAmmoPicker(ContextMenu): item = self.addCharge(rootMenu if msw else m, charge) items.append(item) else: - if sub is None: + if sub is None and item and base: sub = wx.Menu() sub.Bind(wx.EVT_MENU, self.handleAmmoSwitch) self.addSeperator(sub, "Less Damage") diff --git a/gui/builtinContextMenus/moduleGlobalAmmoPicker.py b/gui/builtinContextMenus/moduleGlobalAmmoPicker.py index 3ccf5e3ff..71c1b2e33 100644 --- a/gui/builtinContextMenus/moduleGlobalAmmoPicker.py +++ b/gui/builtinContextMenus/moduleGlobalAmmoPicker.py @@ -9,6 +9,7 @@ from service.fit import Fit class ModuleGlobalAmmoPicker(ModuleAmmoPicker): def __init__(self): + super(ModuleGlobalAmmoPicker, self).__init__() self.mainFrame = gui.mainFrame.MainFrame.getInstance() def getText(self, itmContext, selection): diff --git a/gui/builtinStatsViews/resourcesViewFull.py b/gui/builtinStatsViews/resourcesViewFull.py index 10d8fd2d1..8bd7bb37b 100644 --- a/gui/builtinStatsViews/resourcesViewFull.py +++ b/gui/builtinStatsViews/resourcesViewFull.py @@ -216,52 +216,61 @@ class ResourcesViewFull(StatsView): ("label%sTotalCargoBay", lambda: fit.ship.getModifiedItemAttr("capacity"), 3, 0, 9), ) panel = "Full" + usedTurretHardpoints = 0 + labelUTH = "" totalTurretHardpoints = 0 + labelTTH = "" usedLauncherHardpoints = 0 + labelULH = "" totalLauncherHardPoints = 0 + labelTLH = "" + usedDronesActive = 0 + labelUDA = "" + totalDronesActive = 0 + labelTDA = "" + usedFighterTubes = 0 + labelUFT = "" + totalFighterTubes = 0 + labelTFT = "" + usedCalibrationPoints = 0 + labelUCP = "" + totalCalibrationPoints = 0 + labelTCP = "" for labelName, value, prec, lowest, highest in stats: label = getattr(self, labelName % panel) value = value() if fit is not None else 0 value = value if value is not None else 0 + if labelName % panel == "label%sUsedTurretHardpoints" % panel: usedTurretHardpoints = value labelUTH = label - - if labelName % panel == "label%sTotalTurretHardpoints" % panel: + elif labelName % panel == "label%sTotalTurretHardpoints" % panel: totalTurretHardpoints = value labelTTH = label - - if labelName % panel == "label%sUsedLauncherHardpoints" % panel: + elif labelName % panel == "label%sUsedLauncherHardpoints" % panel: usedLauncherHardpoints = value labelULH = label - - if labelName % panel == "label%sTotalLauncherHardpoints" % panel: + elif labelName % panel == "label%sTotalLauncherHardpoints" % panel: totalLauncherHardPoints = value labelTLH = label - - if labelName % panel == "label%sUsedDronesActive" % panel: + elif labelName % panel == "label%sUsedDronesActive" % panel: usedDronesActive = value labelUDA = label - - if labelName % panel == "label%sTotalDronesActive" % panel: + elif labelName % panel == "label%sTotalDronesActive" % panel: totalDronesActive = value labelTDA = label - - if labelName % panel == "label%sUsedFighterTubes" % panel: + elif labelName % panel == "label%sUsedFighterTubes" % panel: usedFighterTubes = value labelUFT = label - - if labelName % panel == "label%sTotalFighterTubes" % panel: + elif labelName % panel == "label%sTotalFighterTubes" % panel: totalFighterTubes = value labelTFT = label - - if labelName % panel == "label%sUsedCalibrationPoints" % panel: + elif labelName % panel == "label%sUsedCalibrationPoints" % panel: usedCalibrationPoints = value labelUCP = label - - if labelName % panel == "label%sTotalCalibrationPoints" % panel: + elif labelName % panel == "label%sTotalCalibrationPoints" % panel: totalCalibrationPoints = value labelTCP = label @@ -316,6 +325,8 @@ class ResourcesViewFull(StatsView): lambda: fit.ship.getModifiedItemAttr("droneBandwidth"), lambda: fit.ship.getModifiedItemAttr("capacity"), ) + else: + resMax = None i = 0 for resourceType in ("cpu", "pg", "droneBay", "fighterBay", "droneBandwidth", "cargoBay"): diff --git a/gui/builtinViews/fittingView.py b/gui/builtinViews/fittingView.py index 8306dfa8d..43e46d780 100644 --- a/gui/builtinViews/fittingView.py +++ b/gui/builtinViews/fittingView.py @@ -97,7 +97,8 @@ FitSpawner.register() # Drag'n'drop handler class FittingViewDrop(wx.PyDropTarget): - def __init__(self, dropFn): + def __init__(self, dropFn, *args, **kwargs): + super(FittingViewDrop, self).__init__(*args, **kwargs) wx.PyDropTarget.__init__(self) self.dropFn = dropFn # this is really transferring an EVE itemID diff --git a/gui/cargoView.py b/gui/cargoView.py index 6fe9e3c9e..12197fb67 100644 --- a/gui/cargoView.py +++ b/gui/cargoView.py @@ -27,7 +27,8 @@ from service.market import Market class CargoViewDrop(wx.PyDropTarget): - def __init__(self, dropFn): + def __init__(self, dropFn, *args, **kwargs): + super(CargoViewDrop, self).__init__(*args, **kwargs) wx.PyDropTarget.__init__(self) self.dropFn = dropFn # this is really transferring an EVE itemID diff --git a/gui/chromeTabs.py b/gui/chromeTabs.py index 00998eb87..b1fec7008 100644 --- a/gui/chromeTabs.py +++ b/gui/chromeTabs.py @@ -1268,6 +1268,7 @@ class PFTabsContainer(wx.Panel): pos = tabsWidth selected = None + selpos = None for i in range(len(self.tabs) - 1, -1, -1): tab = self.tabs[i] width = tab.tabWidth - self.inclination * 2 diff --git a/gui/commandView.py b/gui/commandView.py index 20a7a33a9..4b5a03390 100644 --- a/gui/commandView.py +++ b/gui/commandView.py @@ -40,7 +40,8 @@ class DummyEntry: class CommandViewDrop(wx.PyDropTarget): - def __init__(self, dropFn): + def __init__(self, dropFn, *args, **kwargs): + super(CommandViewDrop, self).__init__(*args, **kwargs) wx.PyDropTarget.__init__(self) self.dropFn = dropFn # this is really transferring an EVE itemID diff --git a/gui/crestFittings.py b/gui/crestFittings.py index c6eec6439..40ce122e9 100644 --- a/gui/crestFittings.py +++ b/gui/crestFittings.py @@ -144,10 +144,10 @@ class CrestFittings(wx.Frame): self.updateCacheStatus(None) self.cacheTimer.Start(1000) self.fitTree.populateSkillTree(fittings) + del waitDialog except requests.exceptions.ConnectionError: self.statusbar.SetStatusText("Connection error, please check your internet connection") - finally: - del waitDialog + def importFitting(self, event): selection = self.fitView.fitSelection diff --git a/gui/droneView.py b/gui/droneView.py index bcee91378..f49c0c293 100644 --- a/gui/droneView.py +++ b/gui/droneView.py @@ -29,7 +29,8 @@ from service.market import Market class DroneViewDrop(wx.PyDropTarget): - def __init__(self, dropFn): + def __init__(self, dropFn, *args, **kwargs): + super(DroneViewDrop, self).__init__(*args, **kwargs) wx.PyDropTarget.__init__(self) self.dropFn = dropFn # this is really transferring an EVE itemID diff --git a/gui/fighterView.py b/gui/fighterView.py index 59e2e8ae2..2ea1b9ff3 100644 --- a/gui/fighterView.py +++ b/gui/fighterView.py @@ -31,7 +31,8 @@ from service.market import Market class FighterViewDrop(wx.PyDropTarget): - def __init__(self, dropFn): + def __init__(self, dropFn, *args, **kwargs): + super(FighterViewDrop, self).__init__(*args, **kwargs) wx.PyDropTarget.__init__(self) self.dropFn = dropFn # this is really transferring an EVE itemID diff --git a/gui/mainFrame.py b/gui/mainFrame.py index fdaa6e6ba..5f13807d3 100644 --- a/gui/mainFrame.py +++ b/gui/mainFrame.py @@ -55,7 +55,7 @@ from gui.graphFrame import GraphFrame from gui.copySelectDialog import CopySelectDialog from gui.utils.clipboard import toClipboard, fromClipboard from gui.updateDialog import UpdateDialog -from gui.builtinViews import emptyView, entityEditor, fittingView, implantEditor +from gui.builtinViews import emptyView, entityEditor, fittingView, implantEditor # noqa: F401 from gui import graphFrame from service.settings import SettingsProvider @@ -136,7 +136,7 @@ class MainFrame(wx.Frame): @classmethod def getInstance(cls): - return cls.__instance if cls.__instance is not None else MainFrame() + return cls.__instance if cls.__instance is not None else MainFrame("") def __init__(self, title): self.title = title diff --git a/gui/marketBrowser.py b/gui/marketBrowser.py index cbf17e6e8..4b3b8d55b 100644 --- a/gui/marketBrowser.py +++ b/gui/marketBrowser.py @@ -82,6 +82,7 @@ class MarketBrowser(wx.Panel): p.SetSizer(box) vbox.Add(p, 0, wx.EXPAND) self.metaButtons = [] + btn = None for name in self.sMkt.META_MAP.keys(): btn = MetaButton(p, wx.ID_ANY, name.capitalize(), style=wx.BU_EXACTFIT) setattr(self, name, btn) diff --git a/gui/projectedView.py b/gui/projectedView.py index f9c666f60..6560044a7 100644 --- a/gui/projectedView.py +++ b/gui/projectedView.py @@ -42,7 +42,8 @@ class DummyEntry: class ProjectedViewDrop(wx.PyDropTarget): - def __init__(self, dropFn): + def __init__(self, dropFn, *args, **kwargs): + super(ProjectedViewDrop, self).__init__(*args, **kwargs) wx.PyDropTarget.__init__(self) self.dropFn = dropFn # this is really transferring an EVE itemID diff --git a/gui/resistsEditor.py b/gui/resistsEditor.py index 84f7bf98b..44eadd9c3 100644 --- a/gui/resistsEditor.py +++ b/gui/resistsEditor.py @@ -197,6 +197,8 @@ class ResistsEditorDlg(wx.Dialog): if self.block: return + editObj = None + try: p = self.entityEditor.getActiveEntity() diff --git a/gui/utils/compat.py b/gui/utils/compat.py index e0d336b22..e010cef29 100644 --- a/gui/utils/compat.py +++ b/gui/utils/compat.py @@ -31,6 +31,7 @@ class OrderedDict(dict): because their insertion order is arbitrary. ''' + super(OrderedDict, self).__init__(**kwds) if len(args) > 1: raise TypeError('expected at most 1 arguments, got %d' % len(args)) try: @@ -194,8 +195,10 @@ class OrderedDict(dict): self[key] = default return default - def __repr__(self, _repr_running={}): + def __repr__(self, _repr_running=None): 'od.__repr__() <==> repr(od)' + if _repr_running is None: + _repr_running = {} call_key = id(self), _get_ident() if call_key in _repr_running: return '...' diff --git a/service/fit.py b/service/fit.py index ce5143cf0..5f92bd949 100644 --- a/service/fit.py +++ b/service/fit.py @@ -421,9 +421,7 @@ class Fit(object): return False if m.item.category.name == "Subsystem": - slot = m.getModifiedItemAttr("subSystemSlot") - dummy_module = es_Module.buildEmpty(fit.modules[slot]) - fit.modules.freeSlot(slot, dummy_module) + fit.modules.freeSlot(m.getModifiedItemAttr("subSystemSlot"), es_Module.buildEmpty(m.slot)) if m.fits(fit): m.owner = fit @@ -450,7 +448,7 @@ class Fit(object): return None numSlots = len(fit.modules) - dummy_module = es_Module.buildEmpty(fit.modules[position].slot) + dummy_module = es_Module.buildEmpty(fit.modules[position].slot) fit.modules.toDummy(position, dummy_module) self.recalc(fit) self.checkStates(fit, None) diff --git a/service/market.py b/service/market.py index d4519bdb3..902b06fe6 100644 --- a/service/market.py +++ b/service/market.py @@ -736,8 +736,6 @@ class Market(): """Get ships for given group id""" grp = self.getGroup(grpid, eager=("items", "items.group", "items.marketGroup")) ships = self.getItemsByGroup(grp) - for ship in ships: - ship.race return ships def getShipListDelayed(self, id_, callback): diff --git a/service/port.py b/service/port.py index efc9f1c14..2cfcff05c 100644 --- a/service/port.py +++ b/service/port.py @@ -115,6 +115,8 @@ class Port(object): # codepage then fallback to utf-16, cp1252 if isinstance(srcString, str): + savebom = None + encoding_map = ( ('\xef\xbb\xbf', 'utf-8'), ('\xff\xfe\0\0', 'utf-32'), diff --git a/utils/compat.py b/utils/compat.py index bf49eb4aa..d95b155df 100644 --- a/utils/compat.py +++ b/utils/compat.py @@ -30,6 +30,7 @@ class OrderedDict(dict): because their insertion order is arbitrary. ''' + super(OrderedDict, self).__init__(**kwds) if len(args) > 1: raise TypeError('expected at most 1 arguments, got %d' % len(args)) try: @@ -193,8 +194,10 @@ class OrderedDict(dict): self[key] = default return default - def __repr__(self, _repr_running={}): + def __repr__(self, _repr_running=None): 'od.__repr__() <==> repr(od)' + if _repr_running is None: + _repr_running = {} call_key = id(self), _get_ident() if call_key in _repr_running: return '...' From 6e524de32006437c75c7ed2748d6bfcc3c93e0e3 Mon Sep 17 00:00:00 2001 From: Ebag333 Date: Wed, 8 Feb 2017 20:15:24 -0800 Subject: [PATCH 12/52] Disable import inspections for wxPython, because it's not installed traditionally and we can't include it in requirements.txt --- gui/PFListPane.py | 1 + gui/PFSearchBox.py | 1 + gui/additionsPane.py | 1 + gui/bitmapLoader.py | 1 + gui/boosterView.py | 1 + gui/builtinContextMenus/ammoPattern.py | 1 + gui/builtinContextMenus/amount.py | 1 + gui/builtinContextMenus/cargo.py | 1 + gui/builtinContextMenus/changeAffectingSkills.py | 1 + gui/builtinContextMenus/damagePattern.py | 1 + gui/builtinContextMenus/droneRemoveStack.py | 1 + gui/builtinContextMenus/droneSplit.py | 1 + gui/builtinContextMenus/factorReload.py | 1 + gui/builtinContextMenus/fighterAbilities.py | 1 + gui/builtinContextMenus/implantSets.py | 1 + gui/builtinContextMenus/itemRemove.py | 1 + gui/builtinContextMenus/itemStats.py | 1 + gui/builtinContextMenus/metaSwap.py | 1 + gui/builtinContextMenus/moduleAmmoPicker.py | 1 + gui/builtinContextMenus/moduleGlobalAmmoPicker.py | 1 + gui/builtinContextMenus/openFit.py | 1 + gui/builtinContextMenus/priceClear.py | 1 + gui/builtinContextMenus/project.py | 1 + gui/builtinContextMenus/shipJump.py | 1 + gui/builtinContextMenus/tacticalMode.py | 1 + gui/builtinContextMenus/targetResists.py | 1 + gui/builtinContextMenus/whProjector.py | 1 + gui/builtinPreferenceViews/__init__.py | 1 + gui/builtinPreferenceViews/dummyView.py | 1 + gui/builtinPreferenceViews/pyfaCrestPreferences.py | 2 ++ gui/builtinPreferenceViews/pyfaGaugePreferences.py | 1 + gui/builtinPreferenceViews/pyfaGeneralPreferences.py | 1 + .../pyfaHTMLExportPreferences.py | 1 + gui/builtinPreferenceViews/pyfaNetworkPreferences.py | 1 + gui/builtinPreferenceViews/pyfaUpdatePreferences.py | 1 + gui/builtinStatsViews/capacitorViewFull.py | 1 + gui/builtinStatsViews/firepowerViewFull.py | 1 + gui/builtinStatsViews/miningyieldViewFull.py | 1 + gui/builtinStatsViews/priceViewFull.py | 1 + gui/builtinStatsViews/rechargeViewFull.py | 1 + gui/builtinStatsViews/resistancesViewFull.py | 1 + gui/builtinStatsViews/resourcesViewFull.py | 1 + gui/builtinStatsViews/targetingMiscViewFull.py | 1 + gui/builtinViewColumns/abilities.py | 1 + gui/builtinViewColumns/ammo.py | 1 + gui/builtinViewColumns/ammoIcon.py | 1 + gui/builtinViewColumns/attributeDisplay.py | 1 + gui/builtinViewColumns/baseIcon.py | 1 + gui/builtinViewColumns/baseName.py | 1 + gui/builtinViewColumns/capacitorUse.py | 1 + gui/builtinViewColumns/maxRange.py | 1 + gui/builtinViewColumns/misc.py | 1 + gui/builtinViewColumns/price.py | 1 + gui/builtinViewColumns/state.py | 1 + gui/builtinViews/emptyView.py | 1 + gui/builtinViews/entityEditor.py | 1 + gui/builtinViews/fittingView.py | 2 ++ gui/builtinViews/implantEditor.py | 2 ++ gui/cachingImageList.py | 1 + gui/cargoView.py | 1 + gui/characterEditor.py | 3 +++ gui/characterSelection.py | 1 + gui/chromeTabs.py | 3 +++ gui/commandView.py | 1 + gui/contextMenu.py | 1 + gui/copySelectDialog.py | 1 + gui/crestFittings.py | 1 + gui/display.py | 1 + gui/droneView.py | 1 + gui/fighterView.py | 1 + gui/globalEvents.py | 1 + gui/graphFrame.py | 1 + gui/implantView.py | 1 + gui/itemStats.py | 3 +++ gui/mainFrame.py | 11 +++++++---- gui/mainMenuBar.py | 1 + gui/marketBrowser.py | 1 + gui/notesView.py | 1 + gui/patternEditor.py | 2 ++ gui/preferenceDialog.py | 1 + gui/preferenceView.py | 1 + gui/projectedView.py | 1 + gui/propertyEditor.py | 2 ++ gui/pyfatogglepanel.py | 1 + gui/pygauge.py | 1 + gui/resistsEditor.py | 1 + gui/setEditor.py | 1 + gui/sfBrowserItem.py | 1 + gui/shipBrowser.py | 2 ++ gui/statsPane.py | 1 + gui/updateDialog.py | 2 ++ gui/utils/animUtils.py | 1 + gui/utils/clipboard.py | 1 + gui/utils/colorUtils.py | 1 + gui/utils/drawUtils.py | 1 + gui/utils/exportHtml.py | 1 + gui/utils/fonts.py | 1 + gui/viewColumn.py | 1 + 98 files changed, 117 insertions(+), 4 deletions(-) diff --git a/gui/PFListPane.py b/gui/PFListPane.py index 556b97638..c138e72b8 100644 --- a/gui/PFListPane.py +++ b/gui/PFListPane.py @@ -17,6 +17,7 @@ # along with pyfa. If not, see . # ============================================================================= +# noinspection PyPackageRequirements import wx diff --git a/gui/PFSearchBox.py b/gui/PFSearchBox.py index ece5cef5f..b0337c2e1 100644 --- a/gui/PFSearchBox.py +++ b/gui/PFSearchBox.py @@ -1,3 +1,4 @@ +# noinspection PyPackageRequirements import wx import gui.utils.colorUtils as colorUtils import gui.utils.drawUtils as drawUtils diff --git a/gui/additionsPane.py b/gui/additionsPane.py index a7a034032..503fc4135 100644 --- a/gui/additionsPane.py +++ b/gui/additionsPane.py @@ -17,6 +17,7 @@ # along with pyfa. If not, see . # ============================================================================= +# noinspection PyPackageRequirements import wx from gui.boosterView import BoosterView from gui.droneView import DroneView diff --git a/gui/bitmapLoader.py b/gui/bitmapLoader.py index 066fc0c5f..c6c932b4b 100644 --- a/gui/bitmapLoader.py +++ b/gui/bitmapLoader.py @@ -22,6 +22,7 @@ import os.path import zipfile from config import parsePath +# noinspection PyPackageRequirements import wx import config diff --git a/gui/boosterView.py b/gui/boosterView.py index 110a04b04..3f0c08d59 100644 --- a/gui/boosterView.py +++ b/gui/boosterView.py @@ -17,6 +17,7 @@ # along with pyfa. If not, see . # ============================================================================= +# noinspection PyPackageRequirements import wx import gui.display as d import gui.globalEvents as GE diff --git a/gui/builtinContextMenus/ammoPattern.py b/gui/builtinContextMenus/ammoPattern.py index be2833d9e..e131bb1c6 100644 --- a/gui/builtinContextMenus/ammoPattern.py +++ b/gui/builtinContextMenus/ammoPattern.py @@ -1,5 +1,6 @@ from gui.contextMenu import ContextMenu import gui.mainFrame +# noinspection PyPackageRequirements import wx import gui.globalEvents as GE from service.fit import Fit diff --git a/gui/builtinContextMenus/amount.py b/gui/builtinContextMenus/amount.py index 54662f58d..3d51a1963 100644 --- a/gui/builtinContextMenus/amount.py +++ b/gui/builtinContextMenus/amount.py @@ -2,6 +2,7 @@ from gui.contextMenu import ContextMenu from eos.saveddata.fit import Fit as es_Fit import gui.mainFrame import gui.globalEvents as GE +# noinspection PyPackageRequirements import wx from service.fit import Fit from eos.saveddata.cargo import Cargo as es_Cargo diff --git a/gui/builtinContextMenus/cargo.py b/gui/builtinContextMenus/cargo.py index 1f5ad4202..97ea7b8ab 100644 --- a/gui/builtinContextMenus/cargo.py +++ b/gui/builtinContextMenus/cargo.py @@ -1,6 +1,7 @@ from gui.contextMenu import ContextMenu import gui.mainFrame import gui.globalEvents as GE +# noinspection PyPackageRequirements import wx from service.fit import Fit diff --git a/gui/builtinContextMenus/changeAffectingSkills.py b/gui/builtinContextMenus/changeAffectingSkills.py index cc2d99055..6c02d07b9 100644 --- a/gui/builtinContextMenus/changeAffectingSkills.py +++ b/gui/builtinContextMenus/changeAffectingSkills.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- from gui.contextMenu import ContextMenu import gui.mainFrame +# noinspection PyPackageRequirements import wx from gui.bitmapLoader import BitmapLoader from eos.saveddata.character import Skill diff --git a/gui/builtinContextMenus/damagePattern.py b/gui/builtinContextMenus/damagePattern.py index b2089e9c0..6fd1778c3 100644 --- a/gui/builtinContextMenus/damagePattern.py +++ b/gui/builtinContextMenus/damagePattern.py @@ -1,6 +1,7 @@ from gui.contextMenu import ContextMenu import gui.mainFrame import gui.globalEvents as GE +# noinspection PyPackageRequirements import wx from gui.bitmapLoader import BitmapLoader from service.fit import Fit diff --git a/gui/builtinContextMenus/droneRemoveStack.py b/gui/builtinContextMenus/droneRemoveStack.py index 8132a8fc9..b8e4b820b 100644 --- a/gui/builtinContextMenus/droneRemoveStack.py +++ b/gui/builtinContextMenus/droneRemoveStack.py @@ -1,5 +1,6 @@ from gui.contextMenu import ContextMenu import gui.mainFrame +# noinspection PyPackageRequirements import wx import gui.globalEvents as GE from service.fit import Fit diff --git a/gui/builtinContextMenus/droneSplit.py b/gui/builtinContextMenus/droneSplit.py index 2f2ec923e..77ba87e8a 100644 --- a/gui/builtinContextMenus/droneSplit.py +++ b/gui/builtinContextMenus/droneSplit.py @@ -2,6 +2,7 @@ from gui.contextMenu import ContextMenu import gui.mainFrame import gui.globalEvents as GE from service.fit import Fit +# noinspection PyPackageRequirements import wx diff --git a/gui/builtinContextMenus/factorReload.py b/gui/builtinContextMenus/factorReload.py index d7b33658d..86553c73b 100644 --- a/gui/builtinContextMenus/factorReload.py +++ b/gui/builtinContextMenus/factorReload.py @@ -1,6 +1,7 @@ from gui.contextMenu import ContextMenu import gui.mainFrame import gui.globalEvents as GE +# noinspection PyPackageRequirements import wx from gui.bitmapLoader import BitmapLoader from service.fit import Fit diff --git a/gui/builtinContextMenus/fighterAbilities.py b/gui/builtinContextMenus/fighterAbilities.py index d262cb052..8c26a9ffe 100644 --- a/gui/builtinContextMenus/fighterAbilities.py +++ b/gui/builtinContextMenus/fighterAbilities.py @@ -1,3 +1,4 @@ +# noinspection PyPackageRequirements import wx from gui.contextMenu import ContextMenu import gui.mainFrame diff --git a/gui/builtinContextMenus/implantSets.py b/gui/builtinContextMenus/implantSets.py index 490f52ef2..994c0d607 100644 --- a/gui/builtinContextMenus/implantSets.py +++ b/gui/builtinContextMenus/implantSets.py @@ -1,6 +1,7 @@ from gui.contextMenu import ContextMenu import gui.mainFrame import gui.globalEvents as GE +# noinspection PyPackageRequirements import wx from service.implantSet import ImplantSets as s_ImplantSets from service.character import Character diff --git a/gui/builtinContextMenus/itemRemove.py b/gui/builtinContextMenus/itemRemove.py index 400890b1a..fb8a70679 100644 --- a/gui/builtinContextMenus/itemRemove.py +++ b/gui/builtinContextMenus/itemRemove.py @@ -1,5 +1,6 @@ from gui.contextMenu import ContextMenu import gui.mainFrame +# noinspection PyPackageRequirements import wx import gui.globalEvents as GE from service.fit import Fit diff --git a/gui/builtinContextMenus/itemStats.py b/gui/builtinContextMenus/itemStats.py index 2ccc3d364..1b923ecf5 100644 --- a/gui/builtinContextMenus/itemStats.py +++ b/gui/builtinContextMenus/itemStats.py @@ -1,6 +1,7 @@ from gui.contextMenu import ContextMenu from gui.itemStats import ItemStatsDialog import gui.mainFrame +# noinspection PyPackageRequirements import wx from service.fit import Fit diff --git a/gui/builtinContextMenus/metaSwap.py b/gui/builtinContextMenus/metaSwap.py index 3462410e5..389335f53 100644 --- a/gui/builtinContextMenus/metaSwap.py +++ b/gui/builtinContextMenus/metaSwap.py @@ -1,5 +1,6 @@ # coding: utf-8 +# noinspection PyPackageRequirements import wx from service.fit import Fit diff --git a/gui/builtinContextMenus/moduleAmmoPicker.py b/gui/builtinContextMenus/moduleAmmoPicker.py index 4e0111493..ef0a8a742 100644 --- a/gui/builtinContextMenus/moduleAmmoPicker.py +++ b/gui/builtinContextMenus/moduleAmmoPicker.py @@ -1,5 +1,6 @@ # coding: utf-8 +# noinspection PyPackageRequirements import wx from service.fit import Fit diff --git a/gui/builtinContextMenus/moduleGlobalAmmoPicker.py b/gui/builtinContextMenus/moduleGlobalAmmoPicker.py index 71c1b2e33..849896111 100644 --- a/gui/builtinContextMenus/moduleGlobalAmmoPicker.py +++ b/gui/builtinContextMenus/moduleGlobalAmmoPicker.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- import gui.mainFrame +# noinspection PyPackageRequirements import wx import gui.globalEvents as GE from gui.builtinContextMenus.moduleAmmoPicker import ModuleAmmoPicker diff --git a/gui/builtinContextMenus/openFit.py b/gui/builtinContextMenus/openFit.py index fad0c2640..5a0a760f7 100644 --- a/gui/builtinContextMenus/openFit.py +++ b/gui/builtinContextMenus/openFit.py @@ -1,5 +1,6 @@ from gui.contextMenu import ContextMenu import gui.mainFrame +# noinspection PyPackageRequirements import wx from gui.shipBrowser import FitSelected diff --git a/gui/builtinContextMenus/priceClear.py b/gui/builtinContextMenus/priceClear.py index e61b7df7f..8cb1a5175 100644 --- a/gui/builtinContextMenus/priceClear.py +++ b/gui/builtinContextMenus/priceClear.py @@ -1,5 +1,6 @@ from gui.contextMenu import ContextMenu import gui.mainFrame +# noinspection PyPackageRequirements import wx import gui.globalEvents as GE from service.market import Market diff --git a/gui/builtinContextMenus/project.py b/gui/builtinContextMenus/project.py index 0fcae7864..838b4e4fc 100644 --- a/gui/builtinContextMenus/project.py +++ b/gui/builtinContextMenus/project.py @@ -1,6 +1,7 @@ from gui.contextMenu import ContextMenu import gui.mainFrame import gui.globalEvents as GE +# noinspection PyPackageRequirements import wx from service.fit import Fit diff --git a/gui/builtinContextMenus/shipJump.py b/gui/builtinContextMenus/shipJump.py index b743201a3..40dda42c8 100644 --- a/gui/builtinContextMenus/shipJump.py +++ b/gui/builtinContextMenus/shipJump.py @@ -1,3 +1,4 @@ +# noinspection PyPackageRequirements import wx from gui.contextMenu import ContextMenu import gui.mainFrame diff --git a/gui/builtinContextMenus/tacticalMode.py b/gui/builtinContextMenus/tacticalMode.py index 62abf309d..679be45f3 100644 --- a/gui/builtinContextMenus/tacticalMode.py +++ b/gui/builtinContextMenus/tacticalMode.py @@ -1,3 +1,4 @@ +# noinspection PyPackageRequirements import wx from gui.contextMenu import ContextMenu import gui.mainFrame diff --git a/gui/builtinContextMenus/targetResists.py b/gui/builtinContextMenus/targetResists.py index f23125f43..c8224104b 100644 --- a/gui/builtinContextMenus/targetResists.py +++ b/gui/builtinContextMenus/targetResists.py @@ -1,6 +1,7 @@ from gui.contextMenu import ContextMenu import gui.mainFrame import gui.globalEvents as GE +# noinspection PyPackageRequirements import wx from gui.bitmapLoader import BitmapLoader from service.targetResists import TargetResists as svc_TargetResists diff --git a/gui/builtinContextMenus/whProjector.py b/gui/builtinContextMenus/whProjector.py index 0e3bfed93..d5883541f 100644 --- a/gui/builtinContextMenus/whProjector.py +++ b/gui/builtinContextMenus/whProjector.py @@ -1,6 +1,7 @@ from gui.contextMenu import ContextMenu import gui.mainFrame import gui.globalEvents as GE +# noinspection PyPackageRequirements import wx from service.market import Market from service.fit import Fit diff --git a/gui/builtinPreferenceViews/__init__.py b/gui/builtinPreferenceViews/__init__.py index eb7f3c970..38beb0d0f 100644 --- a/gui/builtinPreferenceViews/__init__.py +++ b/gui/builtinPreferenceViews/__init__.py @@ -1,3 +1,4 @@ +# noinspection PyPackageRequirements import wx __all__ = ["pyfaGeneralPreferences", "pyfaHTMLExportPreferences", "pyfaUpdatePreferences", diff --git a/gui/builtinPreferenceViews/dummyView.py b/gui/builtinPreferenceViews/dummyView.py index fb46db87e..5bded0d05 100644 --- a/gui/builtinPreferenceViews/dummyView.py +++ b/gui/builtinPreferenceViews/dummyView.py @@ -17,6 +17,7 @@ # along with pyfa. If not, see . # ============================================================================= +# noinspection PyPackageRequirements import wx from gui.preferenceView import PreferenceView diff --git a/gui/builtinPreferenceViews/pyfaCrestPreferences.py b/gui/builtinPreferenceViews/pyfaCrestPreferences.py index 7a54dbc83..4a9208d0a 100644 --- a/gui/builtinPreferenceViews/pyfaCrestPreferences.py +++ b/gui/builtinPreferenceViews/pyfaCrestPreferences.py @@ -1,3 +1,4 @@ +# noinspection PyPackageRequirements import wx from gui.preferenceView import PreferenceView @@ -7,6 +8,7 @@ import gui.mainFrame 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)): diff --git a/gui/builtinPreferenceViews/pyfaGaugePreferences.py b/gui/builtinPreferenceViews/pyfaGaugePreferences.py index 88c1e1313..c7d832a88 100644 --- a/gui/builtinPreferenceViews/pyfaGaugePreferences.py +++ b/gui/builtinPreferenceViews/pyfaGaugePreferences.py @@ -2,6 +2,7 @@ # -*- coding: utf-8 -*- +# noinspection PyPackageRequirements import wx import copy diff --git a/gui/builtinPreferenceViews/pyfaGeneralPreferences.py b/gui/builtinPreferenceViews/pyfaGeneralPreferences.py index 0e5a18f93..e63863f22 100644 --- a/gui/builtinPreferenceViews/pyfaGeneralPreferences.py +++ b/gui/builtinPreferenceViews/pyfaGeneralPreferences.py @@ -1,3 +1,4 @@ +# noinspection PyPackageRequirements import wx from gui.preferenceView import PreferenceView diff --git a/gui/builtinPreferenceViews/pyfaHTMLExportPreferences.py b/gui/builtinPreferenceViews/pyfaHTMLExportPreferences.py index c6428d8b7..01f00409d 100644 --- a/gui/builtinPreferenceViews/pyfaHTMLExportPreferences.py +++ b/gui/builtinPreferenceViews/pyfaHTMLExportPreferences.py @@ -1,3 +1,4 @@ +# noinspection PyPackageRequirements import wx import os diff --git a/gui/builtinPreferenceViews/pyfaNetworkPreferences.py b/gui/builtinPreferenceViews/pyfaNetworkPreferences.py index 8c93b1a5f..e20f8a01d 100644 --- a/gui/builtinPreferenceViews/pyfaNetworkPreferences.py +++ b/gui/builtinPreferenceViews/pyfaNetworkPreferences.py @@ -1,3 +1,4 @@ +# noinspection PyPackageRequirements import wx from gui.preferenceView import PreferenceView diff --git a/gui/builtinPreferenceViews/pyfaUpdatePreferences.py b/gui/builtinPreferenceViews/pyfaUpdatePreferences.py index 48e2a79cc..fcb3fe003 100644 --- a/gui/builtinPreferenceViews/pyfaUpdatePreferences.py +++ b/gui/builtinPreferenceViews/pyfaUpdatePreferences.py @@ -1,3 +1,4 @@ +# noinspection PyPackageRequirements import wx from gui.preferenceView import PreferenceView diff --git a/gui/builtinStatsViews/capacitorViewFull.py b/gui/builtinStatsViews/capacitorViewFull.py index a09b2ff91..6dab28404 100644 --- a/gui/builtinStatsViews/capacitorViewFull.py +++ b/gui/builtinStatsViews/capacitorViewFull.py @@ -17,6 +17,7 @@ # along with pyfa. If not, see . # ============================================================================= +# noinspection PyPackageRequirements import wx from gui.statsView import StatsView from gui.bitmapLoader import BitmapLoader diff --git a/gui/builtinStatsViews/firepowerViewFull.py b/gui/builtinStatsViews/firepowerViewFull.py index 9c31fefe2..618ca52de 100644 --- a/gui/builtinStatsViews/firepowerViewFull.py +++ b/gui/builtinStatsViews/firepowerViewFull.py @@ -17,6 +17,7 @@ # along with pyfa. If not, see . # ============================================================================= +# noinspection PyPackageRequirements import wx import gui.mainFrame from gui.statsView import StatsView diff --git a/gui/builtinStatsViews/miningyieldViewFull.py b/gui/builtinStatsViews/miningyieldViewFull.py index 545b47c88..be69be316 100644 --- a/gui/builtinStatsViews/miningyieldViewFull.py +++ b/gui/builtinStatsViews/miningyieldViewFull.py @@ -17,6 +17,7 @@ # along with pyfa. If not, see . # ============================================================================= +# noinspection PyPackageRequirements import wx import gui.mainFrame from gui.statsView import StatsView diff --git a/gui/builtinStatsViews/priceViewFull.py b/gui/builtinStatsViews/priceViewFull.py index bb222d94a..d33459865 100644 --- a/gui/builtinStatsViews/priceViewFull.py +++ b/gui/builtinStatsViews/priceViewFull.py @@ -17,6 +17,7 @@ # along with pyfa. If not, see . # ============================================================================= +# noinspection PyPackageRequirements import wx from gui.statsView import StatsView from gui.bitmapLoader import BitmapLoader diff --git a/gui/builtinStatsViews/rechargeViewFull.py b/gui/builtinStatsViews/rechargeViewFull.py index a285c04cb..9469084ee 100644 --- a/gui/builtinStatsViews/rechargeViewFull.py +++ b/gui/builtinStatsViews/rechargeViewFull.py @@ -17,6 +17,7 @@ # along with pyfa. If not, see . # ============================================================================= +# noinspection PyPackageRequirements import wx from gui.statsView import StatsView from gui.bitmapLoader import BitmapLoader diff --git a/gui/builtinStatsViews/resistancesViewFull.py b/gui/builtinStatsViews/resistancesViewFull.py index 16f8cb5a5..d36f1fc24 100644 --- a/gui/builtinStatsViews/resistancesViewFull.py +++ b/gui/builtinStatsViews/resistancesViewFull.py @@ -17,6 +17,7 @@ # along with pyfa. If not, see . # ============================================================================= +# noinspection PyPackageRequirements import wx from gui.statsView import StatsView from gui.bitmapLoader import BitmapLoader diff --git a/gui/builtinStatsViews/resourcesViewFull.py b/gui/builtinStatsViews/resourcesViewFull.py index 8bd7bb37b..bff5dd0e1 100644 --- a/gui/builtinStatsViews/resourcesViewFull.py +++ b/gui/builtinStatsViews/resourcesViewFull.py @@ -17,6 +17,7 @@ # along with pyfa. If not, see . # ============================================================================= +# noinspection PyPackageRequirements import wx from gui.statsView import StatsView from gui.bitmapLoader import BitmapLoader diff --git a/gui/builtinStatsViews/targetingMiscViewFull.py b/gui/builtinStatsViews/targetingMiscViewFull.py index aab2bf25e..bcdd2ca60 100644 --- a/gui/builtinStatsViews/targetingMiscViewFull.py +++ b/gui/builtinStatsViews/targetingMiscViewFull.py @@ -17,6 +17,7 @@ # along with pyfa. If not, see . # ============================================================================= +# noinspection PyPackageRequirements import wx from gui.statsView import StatsView from gui.utils.numberFormatter import formatAmount diff --git a/gui/builtinViewColumns/abilities.py b/gui/builtinViewColumns/abilities.py index 5198743b0..69b7ece97 100644 --- a/gui/builtinViewColumns/abilities.py +++ b/gui/builtinViewColumns/abilities.py @@ -18,6 +18,7 @@ # ============================================================================= +# noinspection PyPackageRequirements import wx from eos.saveddata.fighter import Fighter from gui.viewColumn import ViewColumn diff --git a/gui/builtinViewColumns/ammo.py b/gui/builtinViewColumns/ammo.py index 14bb4e3ba..069328a32 100644 --- a/gui/builtinViewColumns/ammo.py +++ b/gui/builtinViewColumns/ammo.py @@ -17,6 +17,7 @@ # along with pyfa. If not, see . # ============================================================================= +# noinspection PyPackageRequirements import wx from eos.saveddata.fighter import Fighter from gui.viewColumn import ViewColumn diff --git a/gui/builtinViewColumns/ammoIcon.py b/gui/builtinViewColumns/ammoIcon.py index 8c532dd32..7459db6a4 100644 --- a/gui/builtinViewColumns/ammoIcon.py +++ b/gui/builtinViewColumns/ammoIcon.py @@ -18,6 +18,7 @@ # ============================================================================= from gui.viewColumn import ViewColumn +# noinspection PyPackageRequirements import wx from eos.saveddata.module import Module diff --git a/gui/builtinViewColumns/attributeDisplay.py b/gui/builtinViewColumns/attributeDisplay.py index 26994a956..5996b0f74 100644 --- a/gui/builtinViewColumns/attributeDisplay.py +++ b/gui/builtinViewColumns/attributeDisplay.py @@ -17,6 +17,7 @@ # along with pyfa. If not, see . # ============================================================================= +# noinspection PyPackageRequirements import wx from gui.viewColumn import ViewColumn diff --git a/gui/builtinViewColumns/baseIcon.py b/gui/builtinViewColumns/baseIcon.py index 32eca9c61..8c09a9fa3 100644 --- a/gui/builtinViewColumns/baseIcon.py +++ b/gui/builtinViewColumns/baseIcon.py @@ -1,3 +1,4 @@ +# noinspection PyPackageRequirements import wx from eos.saveddata.implant import Implant from eos.saveddata.drone import Drone diff --git a/gui/builtinViewColumns/baseName.py b/gui/builtinViewColumns/baseName.py index c1a291434..70d0c65a7 100644 --- a/gui/builtinViewColumns/baseName.py +++ b/gui/builtinViewColumns/baseName.py @@ -18,6 +18,7 @@ # along with pyfa. If not, see . # ============================================================================= +# noinspection PyPackageRequirements import wx from eos.saveddata.cargo import Cargo from eos.saveddata.implant import Implant diff --git a/gui/builtinViewColumns/capacitorUse.py b/gui/builtinViewColumns/capacitorUse.py index b6a65c58d..5d0287375 100644 --- a/gui/builtinViewColumns/capacitorUse.py +++ b/gui/builtinViewColumns/capacitorUse.py @@ -17,6 +17,7 @@ # along with pyfa. If not, see . # ============================================================================= +# noinspection PyPackageRequirements import wx from eos.saveddata.mode import Mode diff --git a/gui/builtinViewColumns/maxRange.py b/gui/builtinViewColumns/maxRange.py index 95fd3d931..f10335b37 100644 --- a/gui/builtinViewColumns/maxRange.py +++ b/gui/builtinViewColumns/maxRange.py @@ -17,6 +17,7 @@ # along with pyfa. If not, see . # ============================================================================= +# noinspection PyPackageRequirements import wx from eos.saveddata.mode import Mode diff --git a/gui/builtinViewColumns/misc.py b/gui/builtinViewColumns/misc.py index 6540a8fa4..f5ba2c89a 100644 --- a/gui/builtinViewColumns/misc.py +++ b/gui/builtinViewColumns/misc.py @@ -17,6 +17,7 @@ # along with pyfa. If not, see . # ============================================================================= +# noinspection PyPackageRequirements import wx from service.fit import Fit diff --git a/gui/builtinViewColumns/price.py b/gui/builtinViewColumns/price.py index c916c54c1..194aa594d 100644 --- a/gui/builtinViewColumns/price.py +++ b/gui/builtinViewColumns/price.py @@ -17,6 +17,7 @@ # along with pyfa. If not, see . # ============================================================================= +# noinspection PyPackageRequirements import wx from eos.saveddata.cargo import Cargo diff --git a/gui/builtinViewColumns/state.py b/gui/builtinViewColumns/state.py index 0a139eca3..aa3f79ebe 100644 --- a/gui/builtinViewColumns/state.py +++ b/gui/builtinViewColumns/state.py @@ -18,6 +18,7 @@ # ============================================================================= +# noinspection PyPackageRequirements import wx from eos.saveddata.fit import Fit diff --git a/gui/builtinViews/emptyView.py b/gui/builtinViews/emptyView.py index 5b19fa044..ebf667726 100644 --- a/gui/builtinViews/emptyView.py +++ b/gui/builtinViews/emptyView.py @@ -1,3 +1,4 @@ +# noinspection PyPackageRequirements import wx import gui.globalEvents as GE from gui.chromeTabs import EVT_NOTEBOOK_PAGE_CHANGED diff --git a/gui/builtinViews/entityEditor.py b/gui/builtinViews/entityEditor.py index b77efe8a5..ecbe065c6 100644 --- a/gui/builtinViews/entityEditor.py +++ b/gui/builtinViews/entityEditor.py @@ -1,3 +1,4 @@ +# noinspection PyPackageRequirements import wx from gui.bitmapLoader import BitmapLoader diff --git a/gui/builtinViews/fittingView.py b/gui/builtinViews/fittingView.py index 43e46d780..a06a77300 100644 --- a/gui/builtinViews/fittingView.py +++ b/gui/builtinViews/fittingView.py @@ -17,7 +17,9 @@ # along with pyfa. If not, see . # ============================================================================= +# noinspection PyPackageRequirements import wx +# noinspection PyPackageRequirements import wx.lib.newevent import gui.mainFrame import gui.marketBrowser diff --git a/gui/builtinViews/implantEditor.py b/gui/builtinViews/implantEditor.py index 8b56833df..bb9c125e7 100644 --- a/gui/builtinViews/implantEditor.py +++ b/gui/builtinViews/implantEditor.py @@ -1,4 +1,6 @@ +# noinspection PyPackageRequirements import wx +# noinspection PyPackageRequirements from wx.lib.buttons import GenBitmapButton from service.market import Market diff --git a/gui/cachingImageList.py b/gui/cachingImageList.py index 0762d1687..4bbef1e23 100644 --- a/gui/cachingImageList.py +++ b/gui/cachingImageList.py @@ -18,6 +18,7 @@ # ============================================================================= +# noinspection PyPackageRequirements import wx from gui.bitmapLoader import BitmapLoader diff --git a/gui/cargoView.py b/gui/cargoView.py index 12197fb67..bacd5c8aa 100644 --- a/gui/cargoView.py +++ b/gui/cargoView.py @@ -17,6 +17,7 @@ # along with pyfa. If not, see . # ============================================================================= +# noinspection PyPackageRequirements import wx import gui.display as d from gui.builtinViewColumns.state import State diff --git a/gui/characterEditor.py b/gui/characterEditor.py index 421ed8bbc..37855e46c 100644 --- a/gui/characterEditor.py +++ b/gui/characterEditor.py @@ -17,9 +17,12 @@ # along with pyfa. If not, see . # ============================================================================= +# noinspection PyPackageRequirements import wx +# noinspection PyPackageRequirements import wx.lib.newevent +# noinspection PyPackageRequirements import wx.gizmos from gui.bitmapLoader import BitmapLoader from gui.contextMenu import ContextMenu diff --git a/gui/characterSelection.py b/gui/characterSelection.py index b63f87475..e85cd081b 100644 --- a/gui/characterSelection.py +++ b/gui/characterSelection.py @@ -17,6 +17,7 @@ # along with pyfa. If not, see . # ============================================================================= +# noinspection PyPackageRequirements import wx from gui.bitmapLoader import BitmapLoader import gui.globalEvents as GE diff --git a/gui/chromeTabs.py b/gui/chromeTabs.py index b1fec7008..f5033baf3 100644 --- a/gui/chromeTabs.py +++ b/gui/chromeTabs.py @@ -17,7 +17,9 @@ # along with pyfa. If not, see . # ============================================================================= +# noinspection PyPackageRequirements import wx +# noinspection PyPackageRequirements import wx.lib.newevent import gui.utils.colorUtils as colorUtils import gui.utils.drawUtils as drawUtils @@ -1123,6 +1125,7 @@ class PFTabsContainer(wx.Panel): color = wx.Colour(0, 0, 0) brush = wx.Brush(color) + # noinspection PyPackageRequirements from Carbon.Appearance import kThemeBrushDialogBackgroundActive brush.MacSetTheme(kThemeBrushDialogBackgroundActive) else: diff --git a/gui/commandView.py b/gui/commandView.py index 4b5a03390..4a3850f19 100644 --- a/gui/commandView.py +++ b/gui/commandView.py @@ -17,6 +17,7 @@ # along with pyfa. If not, see . # ============================================================================= +# noinspection PyPackageRequirements import wx import gui.display as d import gui.globalEvents as GE diff --git a/gui/contextMenu.py b/gui/contextMenu.py index 527535393..376a8b813 100644 --- a/gui/contextMenu.py +++ b/gui/contextMenu.py @@ -17,6 +17,7 @@ # along with pyfa. If not, see . # ============================================================================= +# noinspection PyPackageRequirements import wx import logging diff --git a/gui/copySelectDialog.py b/gui/copySelectDialog.py index bb5a6e601..2f0a55e60 100644 --- a/gui/copySelectDialog.py +++ b/gui/copySelectDialog.py @@ -18,6 +18,7 @@ # ============================================================================= +# noinspection PyPackageRequirements import wx diff --git a/gui/crestFittings.py b/gui/crestFittings.py index 40ce122e9..ff2ec8527 100644 --- a/gui/crestFittings.py +++ b/gui/crestFittings.py @@ -1,6 +1,7 @@ import time import webbrowser import json +# noinspection PyPackageRequirements import wx import requests diff --git a/gui/display.py b/gui/display.py index 0d9e0308f..71043f379 100644 --- a/gui/display.py +++ b/gui/display.py @@ -18,6 +18,7 @@ # ============================================================================= import sys +# noinspection PyPackageRequirements import wx import gui.mainFrame from gui.viewColumn import ViewColumn diff --git a/gui/droneView.py b/gui/droneView.py index f49c0c293..b3836785c 100644 --- a/gui/droneView.py +++ b/gui/droneView.py @@ -17,6 +17,7 @@ # along with pyfa. If not, see . # ============================================================================= +# noinspection PyPackageRequirements import wx import gui.globalEvents as GE diff --git a/gui/fighterView.py b/gui/fighterView.py index 2ea1b9ff3..803707c37 100644 --- a/gui/fighterView.py +++ b/gui/fighterView.py @@ -17,6 +17,7 @@ # along with pyfa. If not, see . # ============================================================================= +# noinspection PyPackageRequirements import wx import gui.globalEvents as GE diff --git a/gui/globalEvents.py b/gui/globalEvents.py index 18f91d348..1c1cc7e38 100644 --- a/gui/globalEvents.py +++ b/gui/globalEvents.py @@ -1,3 +1,4 @@ +# noinspection PyPackageRequirements import wx.lib.newevent FitChanged, FIT_CHANGED = wx.lib.newevent.NewEvent() diff --git a/gui/graphFrame.py b/gui/graphFrame.py index 7b56c0ed0..059bd3fa7 100644 --- a/gui/graphFrame.py +++ b/gui/graphFrame.py @@ -21,6 +21,7 @@ import os import logging import imp +# noinspection PyPackageRequirements import wx from service.fit import Fit diff --git a/gui/implantView.py b/gui/implantView.py index 88211f381..12e27e241 100644 --- a/gui/implantView.py +++ b/gui/implantView.py @@ -17,6 +17,7 @@ # along with pyfa. If not, see . # ============================================================================= +# noinspection PyPackageRequirements import wx import gui.display as d import gui.marketBrowser as mb diff --git a/gui/itemStats.py b/gui/itemStats.py index 9942ba41e..9e4145fff 100644 --- a/gui/itemStats.py +++ b/gui/itemStats.py @@ -23,8 +23,11 @@ import csv import sys import subprocess +# noinspection PyPackageRequirements import wx +# noinspection PyPackageRequirements import wx.html +# noinspection PyPackageRequirements import wx.lib.mixins.listctrl as listmix import config diff --git a/gui/mainFrame.py b/gui/mainFrame.py index 5f13807d3..665b4c603 100644 --- a/gui/mainFrame.py +++ b/gui/mainFrame.py @@ -22,13 +22,17 @@ import os.path import logging import sqlalchemy +# noinspection PyPackageRequirements import wx +# noinspection PyPackageRequirements +from wx._core import PyDeadObjectError +# noinspection PyPackageRequirements +from wx.lib.wordwrap import wordwrap +# noinspection PyPackageRequirements +from wx.lib.inspection import InspectionTool import time from codecs import open -from wx._core import PyDeadObjectError - -from wx.lib.wordwrap import wordwrap import config @@ -949,7 +953,6 @@ class MainFrame(wx.Frame): self.graphFrame.SetFocus() def openWXInspectTool(self, event): - from wx.lib.inspection import InspectionTool if not InspectionTool().initialized: InspectionTool().Init() diff --git a/gui/mainMenuBar.py b/gui/mainMenuBar.py index 340a66e3a..da1b08772 100644 --- a/gui/mainMenuBar.py +++ b/gui/mainMenuBar.py @@ -17,6 +17,7 @@ # along with pyfa. If not, see . # ============================================================================= +# noinspection PyPackageRequirements import wx import config diff --git a/gui/marketBrowser.py b/gui/marketBrowser.py index 4b3b8d55b..8b00a4378 100644 --- a/gui/marketBrowser.py +++ b/gui/marketBrowser.py @@ -17,6 +17,7 @@ # along with pyfa. If not, see . # ============================================================================= +# noinspection PyPackageRequirements import wx from service.market import Market from service.attribute import Attribute diff --git a/gui/notesView.py b/gui/notesView.py index f607efb0b..d4f8703cc 100644 --- a/gui/notesView.py +++ b/gui/notesView.py @@ -1,3 +1,4 @@ +# noinspection PyPackageRequirements import wx from service.fit import Fit diff --git a/gui/patternEditor.py b/gui/patternEditor.py index 9d11a5ab9..ed63fd9a3 100644 --- a/gui/patternEditor.py +++ b/gui/patternEditor.py @@ -17,8 +17,10 @@ # along with pyfa. If not, see . # ============================================================================= +# noinspection PyPackageRequirements import wx from gui.bitmapLoader import BitmapLoader +# noinspection PyPackageRequirements from wx.lib.intctrl import IntCtrl from gui.utils.clipboard import toClipboard, fromClipboard from gui.builtinViews.entityEditor import EntityEditor, BaseValidator diff --git a/gui/preferenceDialog.py b/gui/preferenceDialog.py index 1d36d0d03..e6c5f12af 100644 --- a/gui/preferenceDialog.py +++ b/gui/preferenceDialog.py @@ -17,6 +17,7 @@ # along with pyfa. If not, see . # ============================================================================= +# noinspection PyPackageRequirements import wx from gui.preferenceView import PreferenceView from gui.bitmapLoader import BitmapLoader diff --git a/gui/preferenceView.py b/gui/preferenceView.py index 2f7b34bd8..5a9064ae2 100644 --- a/gui/preferenceView.py +++ b/gui/preferenceView.py @@ -17,6 +17,7 @@ # along with pyfa. If not, see . # ============================================================================= +# noinspection PyPackageRequirements import wx diff --git a/gui/projectedView.py b/gui/projectedView.py index 6560044a7..bfd5736ea 100644 --- a/gui/projectedView.py +++ b/gui/projectedView.py @@ -17,6 +17,7 @@ # along with pyfa. If not, see . # ============================================================================= +# noinspection PyPackageRequirements import wx import gui.display as d import gui.globalEvents as GE diff --git a/gui/propertyEditor.py b/gui/propertyEditor.py index 405e2a5d3..32c1e0485 100644 --- a/gui/propertyEditor.py +++ b/gui/propertyEditor.py @@ -1,9 +1,11 @@ import csv import logging +# noinspection PyPackageRequirements import wx try: + # noinspection PyPackageRequirements import wx.propgrid as wxpg except: if wx.VERSION < (2, 9): diff --git a/gui/pyfatogglepanel.py b/gui/pyfatogglepanel.py index db37216ba..71ccec124 100644 --- a/gui/pyfatogglepanel.py +++ b/gui/pyfatogglepanel.py @@ -21,6 +21,7 @@ # Notes: leave the commented code as it is, those line will be removed someday ########################################################################### +# noinspection PyPackageRequirements import wx from gui.bitmapLoader import BitmapLoader diff --git a/gui/pygauge.py b/gui/pygauge.py index 602304e13..6605d19f8 100644 --- a/gui/pygauge.py +++ b/gui/pygauge.py @@ -11,6 +11,7 @@ PyfaGauge is a generic Gauge implementation tailored for PYFA (Python Fitting As It uses the easeOutQuad equation from caurina.transitions.Tweener to do the animation stuff """ +# noinspection PyPackageRequirements import wx import copy diff --git a/gui/resistsEditor.py b/gui/resistsEditor.py index 44eadd9c3..dedf0914e 100644 --- a/gui/resistsEditor.py +++ b/gui/resistsEditor.py @@ -17,6 +17,7 @@ # along with pyfa. If not, see . # ============================================================================= +# noinspection PyPackageRequirements import wx from service.targetResists import TargetResists from gui.bitmapLoader import BitmapLoader diff --git a/gui/setEditor.py b/gui/setEditor.py index 0118fbe03..3a1d2874a 100644 --- a/gui/setEditor.py +++ b/gui/setEditor.py @@ -18,6 +18,7 @@ # ============================================================================= import logging +# noinspection PyPackageRequirements import wx from service.implantSet import ImplantSets diff --git a/gui/sfBrowserItem.py b/gui/sfBrowserItem.py index 047c04bc6..52989c932 100644 --- a/gui/sfBrowserItem.py +++ b/gui/sfBrowserItem.py @@ -1,3 +1,4 @@ +# noinspection PyPackageRequirements import wx import gui.utils.drawUtils as drawUtils diff --git a/gui/shipBrowser.py b/gui/shipBrowser.py index a9e12a110..a0302f74b 100644 --- a/gui/shipBrowser.py +++ b/gui/shipBrowser.py @@ -3,7 +3,9 @@ import re import time +# noinspection PyPackageRequirements import wx +# noinspection PyPackageRequirements from wx.lib.buttons import GenBitmapButton from service.fit import Fit diff --git a/gui/statsPane.py b/gui/statsPane.py index 5d20f22ef..f1ea90e22 100644 --- a/gui/statsPane.py +++ b/gui/statsPane.py @@ -17,6 +17,7 @@ # along with pyfa. If not, see . # ============================================================================= +# noinspection PyPackageRequirements import wx from service.fit import Fit diff --git a/gui/updateDialog.py b/gui/updateDialog.py index 155d5a6a9..10d978a1f 100644 --- a/gui/updateDialog.py +++ b/gui/updateDialog.py @@ -17,7 +17,9 @@ # along with pyfa. If not, see . # ============================================================================= +# noinspection PyPackageRequirements import wx +# noinspection PyPackageRequirements import dateutil.parser from service.settings import UpdateSettings as svc_UpdateSettings diff --git a/gui/utils/animUtils.py b/gui/utils/animUtils.py index cefd3938b..d30375fe2 100644 --- a/gui/utils/animUtils.py +++ b/gui/utils/animUtils.py @@ -1,3 +1,4 @@ +# noinspection PyPackageRequirements import wx import gui.utils.colorUtils as colorUtils diff --git a/gui/utils/clipboard.py b/gui/utils/clipboard.py index 4fa05e1f3..2ca2345e4 100644 --- a/gui/utils/clipboard.py +++ b/gui/utils/clipboard.py @@ -1,3 +1,4 @@ +# noinspection PyPackageRequirements import wx diff --git a/gui/utils/colorUtils.py b/gui/utils/colorUtils.py index a8d560159..aeeb508c8 100644 --- a/gui/utils/colorUtils.py +++ b/gui/utils/colorUtils.py @@ -1,3 +1,4 @@ +# noinspection PyPackageRequirements import wx import math diff --git a/gui/utils/drawUtils.py b/gui/utils/drawUtils.py index 559dac395..185cbb109 100644 --- a/gui/utils/drawUtils.py +++ b/gui/utils/drawUtils.py @@ -1,3 +1,4 @@ +# noinspection PyPackageRequirements import wx import gui.utils.colorUtils as colorUtils diff --git a/gui/utils/exportHtml.py b/gui/utils/exportHtml.py index 194db5a6b..5cdec552f 100644 --- a/gui/utils/exportHtml.py +++ b/gui/utils/exportHtml.py @@ -1,5 +1,6 @@ import threading import time +# noinspection PyPackageRequirements import wx from service.settings import HTMLExportSettings from service.fit import Fit diff --git a/gui/utils/fonts.py b/gui/utils/fonts.py index eb2dd95f5..359957147 100644 --- a/gui/utils/fonts.py +++ b/gui/utils/fonts.py @@ -3,6 +3,7 @@ Font file to handle the differences in font calculations between different wxPython versions ''' +# noinspection PyPackageRequirements import wx if 'wxMac' in wx.PlatformInfo: diff --git a/gui/viewColumn.py b/gui/viewColumn.py index cd13055bb..c047ebece 100644 --- a/gui/viewColumn.py +++ b/gui/viewColumn.py @@ -17,6 +17,7 @@ # along with pyfa. If not, see . # ============================================================================= +# noinspection PyPackageRequirements import wx From 636474610b23d80bdfc1fb71648b28d518b6f4cc Mon Sep 17 00:00:00 2001 From: Ebag333 Date: Wed, 8 Feb 2017 20:16:58 -0800 Subject: [PATCH 13/52] More of: Disable import inspections for wxPython, because it's not installed traditionally and we can't include it in requirements.txt --- pyfa.py | 2 ++ service/character.py | 1 + service/crest.py | 1 + service/market.py | 1 + service/port.py | 1 + service/server.py | 1 + service/update.py | 2 ++ setup.py | 1 + tests/test_package.py | 1 + 9 files changed, 11 insertions(+) diff --git a/pyfa.py b/pyfa.py index b27389971..f5aab70a3 100755 --- a/pyfa.py +++ b/pyfa.py @@ -94,6 +94,7 @@ if not hasattr(sys, 'frozen'): # check also for dateutil module installed. try: + # noinspection PyPackageRequirements import dateutil.parser # noqa - Copied import statement from service/update.py except ImportError: print("Cannot find python-dateutil.\nYou can download python-dateutil from https://pypi.python.org/pypi/python-dateutil") @@ -120,6 +121,7 @@ if __name__ == "__main__": logging.basicConfig() # Import everything + # noinspection PyPackageRequirements import wx import os import os.path diff --git a/service/character.py b/service/character.py index 25333edd6..f1d1cf5f8 100644 --- a/service/character.py +++ b/service/character.py @@ -27,6 +27,7 @@ from xml.etree import ElementTree from xml.dom import minidom import gzip +# noinspection PyPackageRequirements import wx import config diff --git a/service/crest.py b/service/crest.py index 6ce59040e..e672e3df6 100644 --- a/service/crest.py +++ b/service/crest.py @@ -1,3 +1,4 @@ +# noinspection PyPackageRequirements import wx import thread import logging diff --git a/service/market.py b/service/market.py index 902b06fe6..074e9618a 100644 --- a/service/market.py +++ b/service/market.py @@ -22,6 +22,7 @@ import threading import logging import Queue +# noinspection PyPackageRequirements import wx from sqlalchemy.sql import or_ diff --git a/service/port.py b/service/port.py index 2cfcff05c..fd347db4f 100644 --- a/service/port.py +++ b/service/port.py @@ -33,6 +33,7 @@ import xml.parsers.expat from eos import db from service.fit import Fit as svcFit +# noinspection PyPackageRequirements import wx from eos.saveddata.cargo import Cargo diff --git a/service/server.py b/service/server.py index 268637515..5a2bdb564 100644 --- a/service/server.py +++ b/service/server.py @@ -4,6 +4,7 @@ import socket import thread import logging +# noinspection PyPackageRequirements import wx from service.settings import CRESTSettings diff --git a/service/update.py b/service/update.py index 2c09910d7..6ca8a61a8 100644 --- a/service/update.py +++ b/service/update.py @@ -21,7 +21,9 @@ import threading import json import calendar +# noinspection PyPackageRequirements import wx +# noinspection PyPackageRequirements import dateutil.parser import config diff --git a/setup.py b/setup.py index b4738824a..35f87fb62 100644 --- a/setup.py +++ b/setup.py @@ -22,6 +22,7 @@ excludes = ['Tkinter', 'collections.abc', 'IPython', 'PyQt4', 'PIL', 'nose', 'to if __name__ == "__main__": import sys + # noinspection PyPackageRequirements from cx_Freeze import setup, Executable import config diff --git a/tests/test_package.py b/tests/test_package.py index 19299a942..2788e4509 100644 --- a/tests/test_package.py +++ b/tests/test_package.py @@ -4,6 +4,7 @@ import os import sys import importlib +# noinspection PyPackageRequirements import pytest From 3b91ec8c06ca8bdf494db078819d96d631cd8ef6 Mon Sep 17 00:00:00 2001 From: Ebag333 Date: Wed, 8 Feb 2017 21:24:24 -0800 Subject: [PATCH 14/52] Move check for module state being valid out of effectHandlerHelpers and into service\fit. We can't have it there because of cyclical imports. Plus we're already checking the module state here, so makes lots of sense to merge them. --- eos/effectHandlerHelpers.py | 7 ------- service/fit.py | 8 ++++++-- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/eos/effectHandlerHelpers.py b/eos/effectHandlerHelpers.py index f4854d577..daa68c5c4 100644 --- a/eos/effectHandlerHelpers.py +++ b/eos/effectHandlerHelpers.py @@ -136,13 +136,6 @@ class HandledModuleList(HandledList): self.remove(mod) return - # fix for #529, where a module may be in incorrect state after CCP changes mechanics of module - # TODO: This can't point to es_module, cyclical import loop - ''' - if not mod.isValidState(mod.state): - mod.state = es_State.ONLINE - ''' - def insert(self, index, mod): mod.position = index i = index diff --git a/service/fit.py b/service/fit.py index 5f92bd949..6f6943d37 100644 --- a/service/fit.py +++ b/service/fit.py @@ -905,13 +905,17 @@ class Fit(object): changed = False for mod in fit.modules: if mod != base: - if not mod.canHaveState(mod.state): + # fix for #529, where a module may be in incorrect state after CCP changes mechanics of module + if not mod.canHaveState(mod.state) or not mod.isValidState(mod.state): mod.state = State.ONLINE changed = True + for mod in fit.projectedModules: - if not mod.canHaveState(mod.state, fit): + # fix for #529, where a module may be in incorrect state after CCP changes mechanics of module + if not mod.canHaveState(mod.state, fit) or not mod.isValidState(mod.state): mod.state = State.OFFLINE changed = True + for drone in fit.projectedDrones: if drone.amountActive > 0 and not drone.canBeApplied(fit): drone.amountActive = 0 From 7a2feb91526b390ab361e6475273560041814cad Mon Sep 17 00:00:00 2001 From: Ebag333 Date: Wed, 8 Feb 2017 22:20:56 -0800 Subject: [PATCH 15/52] Fix a bunch of calls to functions that pass the wrong type of parameter, the wrong number, etc. --- eos/saveddata/fit.py | 29 +++++++++++----------- eos/saveddata/implantSet.py | 4 +-- gui/builtinStatsViews/capacitorViewFull.py | 4 +-- gui/itemStats.py | 2 +- service/eveapi.py | 13 ---------- service/prefetch.py | 5 ---- tox.ini | 1 - 7 files changed, 19 insertions(+), 39 deletions(-) diff --git a/eos/saveddata/fit.py b/eos/saveddata/fit.py index 2632707c7..359ba6a0f 100644 --- a/eos/saveddata/fit.py +++ b/eos/saveddata/fit.py @@ -17,7 +17,6 @@ # along with eos. If not, see . # =============================================================================== -import copy import time from copy import deepcopy from itertools import chain @@ -645,7 +644,7 @@ class Fit(object): shadow = True # Don't inspect this, we genuinely want to reassign self # noinspection PyMethodFirstArgAssignment - self = copy.deepcopy(self) + self = deepcopy(self) logger.debug("Handling self projection - making shadow copy of fit. %r => %r", copied, self) # we delete the fit because when we copy a fit, flush() is # called to properly handle projection updates. However, we do @@ -1257,16 +1256,16 @@ class Fit(object): return True - def __deepcopy__(self, memo): - copy = Fit() + def __deepcopy__(self, memo=None): + copy_ship = Fit() # Character and owner are not copied - copy.character = self.__character - copy.owner = self.owner - copy.ship = deepcopy(self.ship, memo) - copy.name = "%s copy" % self.name - copy.damagePattern = self.damagePattern - copy.targetResists = self.targetResists - copy.notes = self.notes + copy_ship.character = self.__character + copy_ship.owner = self.owner + copy_ship.ship = deepcopy(self.ship) + copy_ship.name = "%s copy" % self.name + copy_ship.damagePattern = self.damagePattern + copy_ship.targetResists = self.targetResists + copy_ship.notes = self.notes toCopy = ( "modules", @@ -1280,17 +1279,17 @@ class Fit(object): "projectedFighters") for name in toCopy: orig = getattr(self, name) - c = getattr(copy, name) + c = getattr(copy_ship, name) for i in orig: - c.append(deepcopy(i, memo)) + c.append(deepcopy(i)) for fit in self.projectedFits: - copy.__projectedFits[fit.ID] = fit + copy_ship.__projectedFits[fit.ID] = fit # this bit is required -- see GH issue # 83 eos.db.saveddata_session.flush() eos.db.saveddata_session.refresh(fit) - return copy + return copy_ship def __repr__(self): return u"Fit(ID={}, ship={}, name={}) at {}".format( diff --git a/eos/saveddata/implantSet.py b/eos/saveddata/implantSet.py index 2daaaa3eb..ca0334fff 100644 --- a/eos/saveddata/implantSet.py +++ b/eos/saveddata/implantSet.py @@ -48,13 +48,13 @@ class ImplantSet(object): return out.strip() - def __deepcopy__(self, memo): + def __deepcopy__(self): copy = ImplantSet(self.name) copy.name = "%s copy" % self.name orig = getattr(self, 'implants') c = getattr(copy, 'implants') for i in orig: - c.append(deepcopy(i, memo)) + c.append(deepcopy(i)) return copy diff --git a/gui/builtinStatsViews/capacitorViewFull.py b/gui/builtinStatsViews/capacitorViewFull.py index 6dab28404..f85b35e4c 100644 --- a/gui/builtinStatsViews/capacitorViewFull.py +++ b/gui/builtinStatsViews/capacitorViewFull.py @@ -131,8 +131,8 @@ class CapacitorViewFull(StatsView): capStable = fit.capStable if fit is not None else False lblNameTime = "label%sCapacitorTime" lblNameState = "label%sCapacitorState" - if isinstance(capState, tuple): - t = "%.1f%%-%.1f%%" % capState + if isinstance(capState, tuple) and len(capState) >= 2: + t = ("{0}%-{1}%", capState[0], capState[1]) s = "" else: if capStable: diff --git a/gui/itemStats.py b/gui/itemStats.py index 9e4145fff..e14ecc27a 100644 --- a/gui/itemStats.py +++ b/gui/itemStats.py @@ -856,7 +856,7 @@ class ItemEffects(wx.Panel): elif 'wxMac' in wx.PlatformInfo: os.system("open " + file_) else: - subprocess.call(["xdg-open", file_]) + subprocess.call({"xdg-open": file_}) def RefreshValues(self, event): self.Freeze() diff --git a/service/eveapi.py b/service/eveapi.py index 67a238f47..d0bb067a7 100644 --- a/service/eveapi.py +++ b/service/eveapi.py @@ -346,19 +346,6 @@ class _Context(object): # perform arcane attribute majick trick return _Context(self._root, self._path + "/" + this, self.parameters) - def __call__(self, **kw): - if kw: - # specified keywords override contextual ones - for k, v in self.parameters.iteritems(): - if k not in kw: - kw[k] = v - else: - # no keywords provided, just update with contextual ones. - kw.update(self.parameters) - - # now let the root context handle it further - return self._root(self._path, **kw) - class _AuthContext(_Context): def character(self, characterID): diff --git a/service/prefetch.py b/service/prefetch.py index dda8a319f..06e6894c2 100644 --- a/service/prefetch.py +++ b/service/prefetch.py @@ -29,11 +29,6 @@ import logging logger = logging.getLogger(__name__) -# The following code does not belong here, however until we rebuild skeletons -# to include modified pyfa.py, this is the best place to put it. See GH issue -# #176 -# @ todo: move this to pyfa.py - # Make sure the saveddata db exists if config.savePath and not os.path.exists(config.savePath): os.mkdir(config.savePath) diff --git a/tox.ini b/tox.ini index 9e9d26985..adafb434a 100644 --- a/tox.ini +++ b/tox.ini @@ -12,6 +12,5 @@ commands = py.test -vv --cov Pyfa tests/ [testenv:pep8] deps = flake8 -# TODO: Remove F class exceptions once all imports are fixed # TODO: Remove E731 and convert lambdas to defs commands = flake8 --exclude=.svn,CVS,.bzr,.hg,.git,__pycache__,venv,tests,.tox,build,dist,__init__.py --ignore=E126,E127,E128,E731 service gui eos utils config.py pyfa.py --max-line-length=165 From e535f050c1af86308e3aa8025b212883e13032fe Mon Sep 17 00:00:00 2001 From: Ebag333 Date: Wed, 8 Feb 2017 22:32:12 -0800 Subject: [PATCH 16/52] Disable inspection of writing to some wx properties. These do seem to get written, so it is likely pyCharm doesn't understand wx --- gui/builtinViews/fittingView.py | 1 + gui/display.py | 1 + gui/utils/drawUtils.py | 1 + 3 files changed, 3 insertions(+) diff --git a/gui/builtinViews/fittingView.py b/gui/builtinViews/fittingView.py index a06a77300..ce54fd8f7 100644 --- a/gui/builtinViews/fittingView.py +++ b/gui/builtinViews/fittingView.py @@ -647,6 +647,7 @@ class FittingView(d.Display): def Snapshot(self): return self.FVsnapshot + # noinspection PyPropertyAccess def MakeSnapshot(self, maxColumns=1337): if self.FVsnapshot: diff --git a/gui/display.py b/gui/display.py index 71043f379..53bb5e6cc 100644 --- a/gui/display.py +++ b/gui/display.py @@ -144,6 +144,7 @@ class Display(wx.ListCtrl): else: event.Skip() + # noinspection PyPropertyAccess def addColumn(self, i, col): self.activeColumns.append(col) info = wx.ListItem() diff --git a/gui/utils/drawUtils.py b/gui/utils/drawUtils.py index 185cbb109..d7034ece7 100644 --- a/gui/utils/drawUtils.py +++ b/gui/utils/drawUtils.py @@ -33,6 +33,7 @@ def DrawFilledBitmap(width, height, color): return canvas +# noinspection PyPropertyAccess def DrawGradientBar(width, height, gStart, gEnd, gMid=None, fillRatio=4): # we need to have dimensions to draw # assert width > 0 and height > 0 From 23c6f2add537b5dc25b84db353aeb6a7e3dc9e48 Mon Sep 17 00:00:00 2001 From: Ebag333 Date: Wed, 8 Feb 2017 22:42:19 -0800 Subject: [PATCH 17/52] We have two of the exact same backported file. Get rid of one. Also, handle the except if we can't import so we don't get stacktraces. (Currently the three functions affected are not used.) --- gui/builtinContextMenus/damagePattern.py | 2 +- gui/builtinContextMenus/targetResists.py | 2 +- gui/utils/compat.py | 262 ----------------------- utils/compat.py | 17 +- 4 files changed, 15 insertions(+), 268 deletions(-) delete mode 100644 gui/utils/compat.py diff --git a/gui/builtinContextMenus/damagePattern.py b/gui/builtinContextMenus/damagePattern.py index 6fd1778c3..20e1b4343 100644 --- a/gui/builtinContextMenus/damagePattern.py +++ b/gui/builtinContextMenus/damagePattern.py @@ -10,7 +10,7 @@ from service.damagePattern import DamagePattern as import_DamagePattern try: from collections import OrderedDict except ImportError: - from gui.utils.compat import OrderedDict + from utils.compat import OrderedDict class DamagePattern(ContextMenu): diff --git a/gui/builtinContextMenus/targetResists.py b/gui/builtinContextMenus/targetResists.py index c8224104b..8ebd4076d 100644 --- a/gui/builtinContextMenus/targetResists.py +++ b/gui/builtinContextMenus/targetResists.py @@ -10,7 +10,7 @@ from service.fit import Fit try: from collections import OrderedDict except ImportError: - from gui.utils.compat import OrderedDict + from utils.compat import OrderedDict class TargetResists(ContextMenu): diff --git a/gui/utils/compat.py b/gui/utils/compat.py deleted file mode 100644 index e010cef29..000000000 --- a/gui/utils/compat.py +++ /dev/null @@ -1,262 +0,0 @@ -# Backport of OrderedDict() class that runs on Python 2.4, 2.5, 2.6, 2.7 and pypy. -# Passes Python2.7's test suite and incorporates all the latest updates. - -try: - from thread import get_ident as _get_ident -except ImportError: - from dummy_thread import get_ident as _get_ident - -try: - from _abcoll import KeysView, ValuesView, ItemsView -except ImportError: - pass - - -class OrderedDict(dict): - 'Dictionary that remembers insertion order' - - # An inherited dict maps keys to values. - # The inherited dict provides __getitem__, __len__, __contains__, and get. - # The remaining methods are order-aware. - # Big-O running times for all methods are the same as for regular dictionaries. - - # The internal self.__map dictionary maps keys to links in a doubly linked list. - # The circular doubly linked list starts and ends with a sentinel element. - # The sentinel element never gets deleted (this simplifies the algorithm). - # Each link is stored as a list of length three: [PREV, NEXT, KEY]. - - def __init__(self, *args, **kwds): - '''Initialize an ordered dictionary. Signature is the same as for - regular dictionaries, but keyword arguments are not recommended - because their insertion order is arbitrary. - - ''' - super(OrderedDict, self).__init__(**kwds) - if len(args) > 1: - raise TypeError('expected at most 1 arguments, got %d' % len(args)) - try: - self.__root - except AttributeError: - self.__root = root = [] # sentinel node - root[:] = [root, root, None] - self.__map = {} - self.__update(*args, **kwds) - - def __setitem__(self, key, value, dict_setitem=dict.__setitem__): - 'od.__setitem__(i, y) <==> od[i]=y' - # Setting a new item creates a new link which goes at the end of the linked - # list, and the inherited dictionary is updated with the new key/value pair. - if key not in self: - root = self.__root - last = root[0] - last[1] = root[0] = self.__map[key] = [last, root, key] - dict_setitem(self, key, value) - - def __delitem__(self, key, dict_delitem=dict.__delitem__): - 'od.__delitem__(y) <==> del od[y]' - # Deleting an existing item uses self.__map to find the link which is - # then removed by updating the links in the predecessor and successor nodes. - dict_delitem(self, key) - link_prev, link_next, key = self.__map.pop(key) - link_prev[1] = link_next - link_next[0] = link_prev - - def __iter__(self): - 'od.__iter__() <==> iter(od)' - root = self.__root - curr = root[1] - while curr is not root: - yield curr[2] - curr = curr[1] - - def __reversed__(self): - 'od.__reversed__() <==> reversed(od)' - root = self.__root - curr = root[0] - while curr is not root: - yield curr[2] - curr = curr[0] - - def clear(self): - 'od.clear() -> None. Remove all items from od.' - try: - for node in self.__map.itervalues(): - del node[:] - root = self.__root - root[:] = [root, root, None] - self.__map.clear() - except AttributeError: - pass - dict.clear(self) - - def popitem(self, last=True): - '''od.popitem() -> (k, v), return and remove a (key, value) pair. - Pairs are returned in LIFO order if last is true or FIFO order if false. - - ''' - if not self: - raise KeyError('dictionary is empty') - root = self.__root - if last: - link = root[0] - link_prev = link[0] - link_prev[1] = root - root[0] = link_prev - else: - link = root[1] - link_next = link[1] - root[1] = link_next - link_next[0] = root - key = link[2] - del self.__map[key] - value = dict.pop(self, key) - return key, value - - # -- the following methods do not depend on the internal structure -- - - def keys(self): - 'od.keys() -> list of keys in od' - return list(self) - - def values(self): - 'od.values() -> list of values in od' - return [self[key] for key in self] - - def items(self): - 'od.items() -> list of (key, value) pairs in od' - return [(key, self[key]) for key in self] - - def iterkeys(self): - 'od.iterkeys() -> an iterator over the keys in od' - return iter(self) - - def itervalues(self): - 'od.itervalues -> an iterator over the values in od' - for k in self: - yield self[k] - - def iteritems(self): - 'od.iteritems -> an iterator over the (key, value) items in od' - for k in self: - yield (k, self[k]) - - def update(*args, **kwds): - '''od.update(E, **F) -> None. Update od from dict/iterable E and F. - - If E is a dict instance, does: for k in E: od[k] = E[k] - If E has a .keys() method, does: for k in E.keys(): od[k] = E[k] - Or if E is an iterable of items, does: for k, v in E: od[k] = v - In either case, this is followed by: for k, v in F.items(): od[k] = v - - ''' - if len(args) > 2: - raise TypeError('update() takes at most 2 positional ' - 'arguments (%d given)' % (len(args),)) - elif not args: - raise TypeError('update() takes at least 1 argument (0 given)') - self = args[0] - # Make progressively weaker assumptions about "other" - other = () - if len(args) == 2: - other = args[1] - if isinstance(other, dict): - for key in other: - self[key] = other[key] - elif hasattr(other, 'keys'): - for key in other.keys(): - self[key] = other[key] - else: - for key, value in other: - self[key] = value - for key, value in kwds.items(): - self[key] = value - - __update = update # let subclasses override update without breaking __init__ - - __marker = object() - - def pop(self, key, default=__marker): - '''od.pop(k[,d]) -> v, remove specified key and return the corresponding value. - If key is not found, d is returned if given, otherwise KeyError is raised. - - ''' - if key in self: - result = self[key] - del self[key] - return result - if default is self.__marker: - raise KeyError(key) - return default - - def setdefault(self, key, default=None): - 'od.setdefault(k[,d]) -> od.get(k,d), also set od[k]=d if k not in od' - if key in self: - return self[key] - self[key] = default - return default - - def __repr__(self, _repr_running=None): - 'od.__repr__() <==> repr(od)' - if _repr_running is None: - _repr_running = {} - call_key = id(self), _get_ident() - if call_key in _repr_running: - return '...' - _repr_running[call_key] = 1 - try: - if not self: - return '%s()' % (self.__class__.__name__,) - return '%s(%r)' % (self.__class__.__name__, self.items()) - finally: - del _repr_running[call_key] - - def __reduce__(self): - 'Return state information for pickling' - items = [[k, self[k]] for k in self] - inst_dict = vars(self).copy() - for k in vars(OrderedDict()): - inst_dict.pop(k, None) - if inst_dict: - return (self.__class__, (items,), inst_dict) - return self.__class__, (items,) - - def copy(self): - 'od.copy() -> a shallow copy of od' - return self.__class__(self) - - @classmethod - def fromkeys(cls, iterable, value=None): - '''OD.fromkeys(S[, v]) -> New ordered dictionary with keys from S - and values equal to v (which defaults to None). - - ''' - d = cls() - for key in iterable: - d[key] = value - return d - - def __eq__(self, other): - '''od.__eq__(y) <==> od==y. Comparison to another OD is order-sensitive - while comparison to a regular mapping is order-insensitive. - - ''' - if isinstance(other, OrderedDict): - return len(self) == len(other) and self.items() == other.items() - return dict.__eq__(self, other) - - def __ne__(self, other): - return not self == other - - # -- the following methods are only used in Python 2.7 -- - - def viewkeys(self): - "od.viewkeys() -> a set-like object providing a view on od's keys" - return KeysView(self) - - def viewvalues(self): - "od.viewvalues() -> an object providing a view on od's values" - return ValuesView(self) - - def viewitems(self): - "od.viewitems() -> a set-like object providing a view on od's items" - return ItemsView(self) diff --git a/utils/compat.py b/utils/compat.py index d95b155df..9673d3a77 100644 --- a/utils/compat.py +++ b/utils/compat.py @@ -9,7 +9,7 @@ except ImportError: try: from _abcoll import KeysView, ValuesView, ItemsView except ImportError: - pass + KeysView = ValuesView = ItemsView = None class OrderedDict(dict): @@ -250,12 +250,21 @@ class OrderedDict(dict): def viewkeys(self): "od.viewkeys() -> a set-like object providing a view on od's keys" - return KeysView(self) + if KeysView: + return KeysView(self) + else: + return None def viewvalues(self): "od.viewvalues() -> an object providing a view on od's values" - return ValuesView(self) + if ValuesView: + return ValuesView(self) + else: + return None def viewitems(self): "od.viewitems() -> a set-like object providing a view on od's items" - return ItemsView(self) + if ItemsView: + return ItemsView(self) + else: + return None From 32944f4c9c5babd492cb19afa28ad7bee238ae48 Mon Sep 17 00:00:00 2001 From: Ebag333 Date: Wed, 8 Feb 2017 22:47:02 -0800 Subject: [PATCH 18/52] More import fixes --- eos/db/__init__.py | 5 +---- gui/contextMenu.py | 1 + gui/graph.py | 1 + gui/graphFrame.py | 1 + gui/mainFrame.py | 1 + gui/preferenceView.py | 1 + gui/statsView.py | 1 + gui/viewColumn.py | 1 + pyfa.py | 1 + setup.py | 2 +- 10 files changed, 10 insertions(+), 5 deletions(-) diff --git a/eos/db/__init__.py b/eos/db/__init__.py index cb6742d19..796799e99 100644 --- a/eos/db/__init__.py +++ b/eos/db/__init__.py @@ -20,10 +20,7 @@ import threading from sqlalchemy import MetaData, create_engine -from sqlalchemy.orm import sessionmaker, scoped_session -from sqlalchemy.ext.declarative import declarative_base -from sqlalchemy import pool - +from sqlalchemy.orm import sessionmaker import migration from eos import config diff --git a/gui/contextMenu.py b/gui/contextMenu.py index 376a8b813..dc587be24 100644 --- a/gui/contextMenu.py +++ b/gui/contextMenu.py @@ -178,6 +178,7 @@ class ContextMenu(object): return None +# noinspection PyUnresolvedReferences from gui.builtinContextMenus import ( # noqa: E402,F401 ammoPattern, amount, diff --git a/gui/graph.py b/gui/graph.py index 9c2739479..a2b2239de 100644 --- a/gui/graph.py +++ b/gui/graph.py @@ -35,4 +35,5 @@ class Graph(object): return None +# noinspection PyUnresolvedReferences from gui.builtinGraphs import fitDps # noqa: E402, F401 diff --git a/gui/graphFrame.py b/gui/graphFrame.py index 059bd3fa7..df43b2cb5 100644 --- a/gui/graphFrame.py +++ b/gui/graphFrame.py @@ -59,6 +59,7 @@ class GraphFrame(wx.Frame): from matplotlib.figure import Figure enabled = True except ImportError: + mpl = Canvas = Figure = None enabled = False self.legendFix = False diff --git a/gui/mainFrame.py b/gui/mainFrame.py index 665b4c603..db5f4b769 100644 --- a/gui/mainFrame.py +++ b/gui/mainFrame.py @@ -59,6 +59,7 @@ from gui.graphFrame import GraphFrame from gui.copySelectDialog import CopySelectDialog from gui.utils.clipboard import toClipboard, fromClipboard from gui.updateDialog import UpdateDialog +# noinspection PyUnresolvedReferences from gui.builtinViews import emptyView, entityEditor, fittingView, implantEditor # noqa: F401 from gui import graphFrame diff --git a/gui/preferenceView.py b/gui/preferenceView.py index 5a9064ae2..1d3b018aa 100644 --- a/gui/preferenceView.py +++ b/gui/preferenceView.py @@ -38,6 +38,7 @@ class PreferenceView(object): return wx.NullBitmap +# noinspection PyUnresolvedReferences from gui.builtinPreferenceViews import (# noqa: E402, F401 pyfaGeneralPreferences, pyfaNetworkPreferences, diff --git a/gui/statsView.py b/gui/statsView.py index 62993ade0..773063ca4 100644 --- a/gui/statsView.py +++ b/gui/statsView.py @@ -42,6 +42,7 @@ class StatsView(object): raise NotImplementedError() +# noinspection PyUnresolvedReferences from gui.builtinStatsViews import ( # noqa: E402, F401 resourcesViewFull, resistancesViewFull, diff --git a/gui/viewColumn.py b/gui/viewColumn.py index c047ebece..4777999a7 100644 --- a/gui/viewColumn.py +++ b/gui/viewColumn.py @@ -66,6 +66,7 @@ class ViewColumn(object): raise NotImplementedError() +# noinspection PyUnresolvedReferences from gui.builtinViewColumns import ( # noqa: E402, F401 abilities, ammo, diff --git a/pyfa.py b/pyfa.py index f5aab70a3..f89677534 100755 --- a/pyfa.py +++ b/pyfa.py @@ -127,6 +127,7 @@ if __name__ == "__main__": import os.path import eos.db + # noinspection PyUnresolvedReferences import service.prefetch # noqa: F401 from gui.mainFrame import MainFrame diff --git a/setup.py b/setup.py index 35f87fb62..d32b7120e 100644 --- a/setup.py +++ b/setup.py @@ -22,7 +22,7 @@ excludes = ['Tkinter', 'collections.abc', 'IPython', 'PyQt4', 'PIL', 'nose', 'to if __name__ == "__main__": import sys - # noinspection PyPackageRequirements + # noinspection PyPackageRequirements,PyUnresolvedReferences from cx_Freeze import setup, Executable import config From 9a137bb1584ed3081cfea91a8ed3f641b9ccc13e Mon Sep 17 00:00:00 2001 From: Ebag333 Date: Wed, 8 Feb 2017 23:06:39 -0800 Subject: [PATCH 19/52] Convert old style classes to new --- eos/db/saveddata/databaseRepair.py | 22 ++- eos/db/saveddata/loadDefaultDatabaseValues.py | 2 +- eos/enum.py | 2 +- eos/modifiedAttributeDict.py | 4 +- gui/bitmapLoader.py | 2 +- gui/chromeTabs.py | 20 +- gui/commandView.py | 4 +- gui/projectedView.py | 4 +- gui/utils/exportHtml.py | 2 +- service/attribute.py | 2 +- service/crest.py | 18 +- service/damagePattern.py | 2 +- service/market.py | 183 +++++++++--------- service/network.py | 8 +- service/update.py | 2 +- utils/timer.py | 10 +- 16 files changed, 149 insertions(+), 138 deletions(-) diff --git a/eos/db/saveddata/databaseRepair.py b/eos/db/saveddata/databaseRepair.py index 185f8bed1..8061d524d 100644 --- a/eos/db/saveddata/databaseRepair.py +++ b/eos/db/saveddata/databaseRepair.py @@ -23,7 +23,7 @@ import logging logger = logging.getLogger(__name__) -class DatabaseCleanup: +class DatabaseCleanup(object): def __init__(self): pass @@ -86,7 +86,8 @@ class DatabaseCleanup: else: uniform_damage_pattern_id = rows[0]['ID'] update_query = "UPDATE 'fits' SET 'damagePatternID' = {} " \ - "WHERE damagePatternID NOT IN (SELECT ID FROM damagePatterns) OR damagePatternID IS NULL".format(uniform_damage_pattern_id) + "WHERE damagePatternID NOT IN (SELECT ID FROM damagePatterns) OR damagePatternID IS NULL".format( + uniform_damage_pattern_id) update_results = DatabaseCleanup.ExecuteSQLQuery(saveddata_engine, update_query) logger.error("Database corruption found. Cleaning up %d records.", update_results.rowcount) @@ -118,7 +119,7 @@ class DatabaseCleanup: logger.error("More than one 'All 5' character found.") else: all5_id = rows[0]['ID'] - update_query = "UPDATE 'fits' SET 'characterID' = " + str(all5_id) + \ + update_query = "UPDATE 'fits' SET 'characterID' = " + str(all5_id) + \ " WHERE characterID not in (select ID from characters) OR characterID IS NULL" update_results = DatabaseCleanup.ExecuteSQLQuery(saveddata_engine, update_query) logger.error("Database corruption found. Cleaning up %d records.", update_results.rowcount) @@ -167,7 +168,8 @@ class DatabaseCleanup: # See issue #954 for table in ['drones', 'cargo', 'fighters']: logger.debug("Running database cleanup for orphaned %s items.", table) - query = "SELECT COUNT(*) AS num FROM {} WHERE itemID IS NULL OR itemID = '' or itemID = '0' or fitID IS NULL OR fitID = '' or fitID = '0'".format(table) + query = "SELECT COUNT(*) AS num FROM {} WHERE itemID IS NULL OR itemID = '' or itemID = '0' or fitID IS NULL OR fitID = '' or fitID = '0'".format( + table) results = DatabaseCleanup.ExecuteSQLQuery(saveddata_engine, query) if results is None: @@ -176,13 +178,15 @@ class DatabaseCleanup: row = results.first() if row and row['num']: - query = "DELETE FROM {} WHERE itemID IS NULL OR itemID = '' or itemID = '0' or fitID IS NULL OR fitID = '' or fitID = '0'".format(table) + query = "DELETE FROM {} WHERE itemID IS NULL OR itemID = '' or itemID = '0' or fitID IS NULL OR fitID = '' or fitID = '0'".format( + table) delete = DatabaseCleanup.ExecuteSQLQuery(saveddata_engine, query) logger.error("Database corruption found. Cleaning up %d records.", delete.rowcount) for table in ['modules']: logger.debug("Running database cleanup for orphaned %s items.", table) - query = "SELECT COUNT(*) AS num FROM {} WHERE itemID = '0' or fitID IS NULL OR fitID = '' or fitID = '0'".format(table) + query = "SELECT COUNT(*) AS num FROM {} WHERE itemID = '0' or fitID IS NULL OR fitID = '' or fitID = '0'".format( + table) results = DatabaseCleanup.ExecuteSQLQuery(saveddata_engine, query) if results is None: @@ -202,7 +206,8 @@ class DatabaseCleanup: for profileType in ['damagePatterns', 'targetResists']: for damageType in ['em', 'thermal', 'kinetic', 'explosive']: logger.debug("Running database cleanup for null %s values. (%s)", profileType, damageType) - query = "SELECT COUNT(*) AS num FROM {0} WHERE {1}Amount IS NULL OR {1}Amount = ''".format(profileType, damageType) + query = "SELECT COUNT(*) AS num FROM {0} WHERE {1}Amount IS NULL OR {1}Amount = ''".format(profileType, + damageType) results = DatabaseCleanup.ExecuteSQLQuery(saveddata_engine, query) if results is None: @@ -211,7 +216,8 @@ class DatabaseCleanup: row = results.first() if row and row['num']: - query = "UPDATE '{0}' SET '{1}Amount' = '0' WHERE {1}Amount IS NULL OR Amount = ''".format(profileType, damageType) + query = "UPDATE '{0}' SET '{1}Amount' = '0' WHERE {1}Amount IS NULL OR Amount = ''".format(profileType, + damageType) delete = DatabaseCleanup.ExecuteSQLQuery(saveddata_engine, query) logger.error("Database corruption found. Cleaning up %d records.", delete.rowcount) diff --git a/eos/db/saveddata/loadDefaultDatabaseValues.py b/eos/db/saveddata/loadDefaultDatabaseValues.py index 29534bc5e..befaad44b 100644 --- a/eos/db/saveddata/loadDefaultDatabaseValues.py +++ b/eos/db/saveddata/loadDefaultDatabaseValues.py @@ -26,7 +26,7 @@ class ImportError(Exception): pass -class DefaultDatabaseValues(): +class DefaultDatabaseValues(object): def __init__(self): pass diff --git a/eos/enum.py b/eos/enum.py index 04caea536..12e8e09e1 100644 --- a/eos/enum.py +++ b/eos/enum.py @@ -1,4 +1,4 @@ -class Enum(): +class Enum(object): def __init__(self): pass diff --git a/eos/modifiedAttributeDict.py b/eos/modifiedAttributeDict.py index e558dc64d..c09b8f59a 100644 --- a/eos/modifiedAttributeDict.py +++ b/eos/modifiedAttributeDict.py @@ -43,7 +43,7 @@ class ChargeAttrShortcut(object): class ModifiedAttributeDict(collections.MutableMapping): OVERRIDES = False - class CalculationPlaceholder(): + class CalculationPlaceholder(object): def __init__(self): pass @@ -359,7 +359,7 @@ class ModifiedAttributeDict(collections.MutableMapping): self.__afflict(attributeName, u"\u2263", value) -class Affliction(): +class Affliction(object): def __init__(self, type, amount): self.type = type self.amount = amount diff --git a/gui/bitmapLoader.py b/gui/bitmapLoader.py index c6c932b4b..cb47e24bd 100644 --- a/gui/bitmapLoader.py +++ b/gui/bitmapLoader.py @@ -33,7 +33,7 @@ except ImportError: from utils.compat import OrderedDict -class BitmapLoader(): +class BitmapLoader(object): try: archive = zipfile.ZipFile(config.getPyfaPath('imgs.zip'), 'r') except IOError: diff --git a/gui/chromeTabs.py b/gui/chromeTabs.py index f5033baf3..600a49950 100644 --- a/gui/chromeTabs.py +++ b/gui/chromeTabs.py @@ -36,7 +36,7 @@ PageAdded, EVT_NOTEBOOK_PAGE_ADDED = wx.lib.newevent.NewEvent() PageClosed, EVT_NOTEBOOK_PAGE_CLOSED = wx.lib.newevent.NewEvent() -class VetoAble(): +class VetoAble(object): def __init__(self): self.__vetoed = False @@ -47,7 +47,7 @@ class VetoAble(): return self.__vetoed -class NotebookTabChangeEvent(): +class NotebookTabChangeEvent(object): def __init__(self, old, new): self.__old = old self.__new = new @@ -337,7 +337,7 @@ class PFNotebook(wx.Panel): event.Skip() -class PFTabRenderer: +class PFTabRenderer(object): def __init__(self, size=(36, 24), text=wx.EmptyString, img=None, inclination=6, closeButton=True): """ Renders a new tab @@ -529,8 +529,8 @@ class PFTabRenderer: self.tabRegion = wx.RegionFromBitmap(self.tabBackBitmap) self.closeBtnRegion = wx.RegionFromBitmap(self.ctabCloseBmp) self.closeBtnRegion.Offset( - self.contentWidth + self.leftWidth - self.ctabCloseBmp.GetWidth() / 2, - (self.tabHeight - self.ctabCloseBmp.GetHeight()) / 2 + self.contentWidth + self.leftWidth - self.ctabCloseBmp.GetWidth() / 2, + (self.tabHeight - self.ctabCloseBmp.GetHeight()) / 2 ) def InitColors(self): @@ -593,9 +593,9 @@ class PFTabRenderer: cbmp = wx.BitmapFromImage(cimg) mdc.DrawBitmap( - cbmp, - self.contentWidth + self.leftWidth - self.ctabCloseBmp.GetWidth() / 2, - (height - self.ctabCloseBmp.GetHeight()) / 2, + cbmp, + self.contentWidth + self.leftWidth - self.ctabCloseBmp.GetWidth() / 2, + (height - self.ctabCloseBmp.GetHeight()) / 2, ) mdc.SelectObject(wx.NullBitmap) @@ -611,11 +611,11 @@ class PFTabRenderer: def __repr__(self): return "PFTabRenderer(text={}, disabled={}) at {}".format( - self.text, self.disabled, hex(id(self)) + self.text, self.disabled, hex(id(self)) ) -class PFAddRenderer: +class PFAddRenderer(object): def __init__(self): """Renders the add tab button""" self.addImg = BitmapLoader.getImage("ctabadd", "gui") diff --git a/gui/commandView.py b/gui/commandView.py index 4a3850f19..9ec44dcb9 100644 --- a/gui/commandView.py +++ b/gui/commandView.py @@ -29,13 +29,13 @@ from service.fit import Fit from eos.saveddata.drone import Drone as es_Drone -class DummyItem: +class DummyItem(object): def __init__(self, txt): self.name = txt self.icon = None -class DummyEntry: +class DummyEntry(object): def __init__(self, txt): self.item = DummyItem(txt) diff --git a/gui/projectedView.py b/gui/projectedView.py index bfd5736ea..da96734e5 100644 --- a/gui/projectedView.py +++ b/gui/projectedView.py @@ -31,13 +31,13 @@ from eos.saveddata.fighter import Fighter as es_Fighter from eos.saveddata.module import Module as es_Module -class DummyItem: +class DummyItem(object): def __init__(self, txt): self.name = txt self.icon = None -class DummyEntry: +class DummyEntry(object): def __init__(self, txt): self.item = DummyItem(txt) diff --git a/gui/utils/exportHtml.py b/gui/utils/exportHtml.py index 5cdec552f..023d18cce 100644 --- a/gui/utils/exportHtml.py +++ b/gui/utils/exportHtml.py @@ -7,7 +7,7 @@ from service.fit import Fit from service.market import Market -class exportHtml(): +class exportHtml(object): _instance = None @classmethod diff --git a/service/attribute.py b/service/attribute.py index ee4f43328..68b998f07 100644 --- a/service/attribute.py +++ b/service/attribute.py @@ -20,7 +20,7 @@ import eos.db -class Attribute(): +class Attribute(object): instance = None @classmethod diff --git a/service/crest.py b/service/crest.py index e672e3df6..39863fb31 100644 --- a/service/crest.py +++ b/service/crest.py @@ -28,9 +28,9 @@ class CrestModes(Enum): USER = 1 -class Crest(): +class Crest(object): clientIDs = { - Servers.TQ: 'f9be379951c046339dc13a00e6be7704', + Servers.TQ : 'f9be379951c046339dc13a00e6be7704', Servers.SISI: 'af87365240d644f7950af563b8418bad' } @@ -78,11 +78,11 @@ class Crest(): # Base EVE connection that is copied to all characters self.eve = EVE( - client_id=self.settings.get('clientID') if self.settings.get( - 'mode') == CrestModes.USER else self.clientIDs.get(self.settings.get('server')), - api_key=self.settings.get('clientSecret') if self.settings.get('mode') == CrestModes.USER else None, - redirect_uri=self.clientCallback, - testing=self.isTestServer + client_id=self.settings.get('clientID') if self.settings.get( + 'mode') == CrestModes.USER else self.clientIDs.get(self.settings.get('server')), + api_key=self.settings.get('clientSecret') if self.settings.get('mode') == CrestModes.USER else None, + redirect_uri=self.clientCallback, + testing=self.isTestServer ) self.implicitCharacter = None @@ -187,8 +187,8 @@ class Crest(): if 'access_token' in message: # implicit eve = copy.deepcopy(self.eve) eve.temptoken_authorize( - access_token=message['access_token'][0], - expires_in=int(message['expires_in'][0]) + access_token=message['access_token'][0], + expires_in=int(message['expires_in'][0]) ) self.ssoTimer = threading.Timer(int(message['expires_in'][0]), self.logout) self.ssoTimer.start() diff --git a/service/damagePattern.py b/service/damagePattern.py index 2343693d3..21536e53e 100644 --- a/service/damagePattern.py +++ b/service/damagePattern.py @@ -27,7 +27,7 @@ class ImportError(Exception): pass -class DamagePattern(): +class DamagePattern(object): instance = None @classmethod diff --git a/service/market.py b/service/market.py index 074e9618a..e5bc16117 100644 --- a/service/market.py +++ b/service/market.py @@ -169,7 +169,7 @@ class SearchWorkerThread(threading.Thread): self.cv.release() -class Market(): +class Market(object): instance = None def __init__(self): @@ -179,7 +179,7 @@ class Market(): serviceMarketRecentlyUsedModules = {"pyfaMarketRecentlyUsedModules": []} self.serviceMarketRecentlyUsedModules = SettingsProvider.getInstance().getSettings( - "pyfaMarketRecentlyUsedModules", serviceMarketRecentlyUsedModules) + "pyfaMarketRecentlyUsedModules", serviceMarketRecentlyUsedModules) # Start price fetcher self.priceWorkerThread = PriceWorkerThread() @@ -209,41 +209,41 @@ class Market(): self.les_grp.description = "" self.les_grp.icon = None self.ITEMS_FORCEGROUP = { - "Opux Luxury Yacht": self.les_grp, + "Opux Luxury Yacht" : self.les_grp, # One of those is wedding present at CCP fanfest, another was hijacked from ISD guy during an event - "Silver Magnate": self.les_grp, # Amarr Championship prize - "Gold Magnate": self.les_grp, # Amarr Championship prize - "Armageddon Imperial Issue": self.les_grp, # Amarr Championship prize - "Apocalypse Imperial Issue": self.les_grp, # Amarr Championship prize - "Guardian-Vexor": self.les_grp, # Illegal rewards for the Gallente Frontier Tour Lines event arc - "Megathron Federate Issue": self.les_grp, # Reward during Crielere event - "Raven State Issue": self.les_grp, # AT4 prize - "Tempest Tribal Issue": self.les_grp, # AT4 prize - "Apotheosis": self.les_grp, # 5th EVE anniversary present - "Zephyr": self.les_grp, # 2010 new year gift - "Primae": self.les_grp, # Promotion of planetary interaction - "Freki": self.les_grp, # AT7 prize - "Mimir": self.les_grp, # AT7 prize - "Utu": self.les_grp, # AT8 prize - "Adrestia": self.les_grp, # AT8 prize - "Echelon": self.les_grp, # 2011 new year gift - "Malice": self.les_grp, # AT9 prize - "Vangel": self.les_grp, # AT9 prize - "Cambion": self.les_grp, # AT10 prize - "Etana": self.les_grp, # AT10 prize - "Chremoas": self.les_grp, # AT11 prize :( - "Moracha": self.les_grp, # AT11 prize + "Silver Magnate" : self.les_grp, # Amarr Championship prize + "Gold Magnate" : self.les_grp, # Amarr Championship prize + "Armageddon Imperial Issue" : self.les_grp, # Amarr Championship prize + "Apocalypse Imperial Issue" : self.les_grp, # Amarr Championship prize + "Guardian-Vexor" : self.les_grp, # Illegal rewards for the Gallente Frontier Tour Lines event arc + "Megathron Federate Issue" : self.les_grp, # Reward during Crielere event + "Raven State Issue" : self.les_grp, # AT4 prize + "Tempest Tribal Issue" : self.les_grp, # AT4 prize + "Apotheosis" : self.les_grp, # 5th EVE anniversary present + "Zephyr" : self.les_grp, # 2010 new year gift + "Primae" : self.les_grp, # Promotion of planetary interaction + "Freki" : self.les_grp, # AT7 prize + "Mimir" : self.les_grp, # AT7 prize + "Utu" : self.les_grp, # AT8 prize + "Adrestia" : self.les_grp, # AT8 prize + "Echelon" : self.les_grp, # 2011 new year gift + "Malice" : self.les_grp, # AT9 prize + "Vangel" : self.les_grp, # AT9 prize + "Cambion" : self.les_grp, # AT10 prize + "Etana" : self.les_grp, # AT10 prize + "Chremoas" : self.les_grp, # AT11 prize :( + "Moracha" : self.les_grp, # AT11 prize "Stratios Emergency Responder": self.les_grp, # Issued for Somer Blink lottery - "Miasmos Quafe Ultra Edition": self.les_grp, # Gift to people who purchased FF HD stream - "InterBus Shuttle": self.les_grp, - "Leopard": self.les_grp, # 2013 new year gift - "Whiptail": self.les_grp, # AT12 prize - "Chameleon": self.les_grp, # AT12 prize - "Victorieux Luxury Yacht": self.les_grp, # Worlds Collide prize \o/ chinese getting owned - "Imp": self.les_grp, # AT13 prize - "Fiend": self.les_grp, # AT13 prize - "Caedes": self.les_grp, # AT14 prize - "Rabisu": self.les_grp, # AT14 prize + "Miasmos Quafe Ultra Edition" : self.les_grp, # Gift to people who purchased FF HD stream + "InterBus Shuttle" : self.les_grp, + "Leopard" : self.les_grp, # 2013 new year gift + "Whiptail" : self.les_grp, # AT12 prize + "Chameleon" : self.les_grp, # AT12 prize + "Victorieux Luxury Yacht" : self.les_grp, # Worlds Collide prize \o/ chinese getting owned + "Imp" : self.les_grp, # AT13 prize + "Fiend" : self.les_grp, # AT13 prize + "Caedes" : self.les_grp, # AT14 prize + "Rabisu" : self.les_grp, # AT14 prize } self.ITEMS_FORCEGROUP_R = self.__makeRevDict(self.ITEMS_FORCEGROUP) @@ -252,26 +252,26 @@ class Market(): # List of items which are forcibly published or hidden self.ITEMS_FORCEPUBLISHED = { - "Data Subverter I": False, # Not used in EVE, probably will appear with Dust link - "QA Cross Protocol Analyzer": False, # QA modules used by CCP internally - "QA Damage Module": False, - "QA ECCM": False, - "QA Immunity Module": False, - "QA Multiship Module - 10 Players": False, - "QA Multiship Module - 20 Players": False, - "QA Multiship Module - 40 Players": False, - "QA Multiship Module - 5 Players": False, + "Data Subverter I" : False, # Not used in EVE, probably will appear with Dust link + "QA Cross Protocol Analyzer" : False, # QA modules used by CCP internally + "QA Damage Module" : False, + "QA ECCM" : False, + "QA Immunity Module" : False, + "QA Multiship Module - 10 Players" : False, + "QA Multiship Module - 20 Players" : False, + "QA Multiship Module - 40 Players" : False, + "QA Multiship Module - 5 Players" : False, "QA Remote Armor Repair System - 5 Players": False, - "QA Shield Transporter - 5 Players": False, - "Goru's Shuttle": False, - "Guristas Shuttle": False, - "Mobile Decoy Unit": False, # Seems to be left over test mod for deployables - "Tournament Micro Jump Unit": False, # Normally seen only on tournament arenas - "Council Diplomatic Shuttle": False, # CSM X celebration - "Civilian Gatling Railgun": True, - "Civilian Gatling Pulse Laser": True, - "Civilian Gatling Autocannon": True, - "Civilian Light Electron Blaster": True, + "QA Shield Transporter - 5 Players" : False, + "Goru's Shuttle" : False, + "Guristas Shuttle" : False, + "Mobile Decoy Unit" : False, # Seems to be left over test mod for deployables + "Tournament Micro Jump Unit" : False, # Normally seen only on tournament arenas + "Council Diplomatic Shuttle" : False, # CSM X celebration + "Civilian Gatling Railgun" : True, + "Civilian Gatling Pulse Laser" : True, + "Civilian Gatling Autocannon" : True, + "Civilian Light Electron Blaster" : True, } # do not publish ships that we convert @@ -289,16 +289,18 @@ class Market(): # List of groups which are forcibly published self.GROUPS_FORCEPUBLISHED = { - "Prototype Exploration Ship": False} # We moved the only ship from this group to other group anyway + "Prototype Exploration Ship": False + } # We moved the only ship from this group to other group anyway # Dictionary of items with forced meta groups, uses following format: # Item name: (metagroup name, parent type name) self.ITEMS_FORCEDMETAGROUP = { - "'Habitat' Miner I": ("Storyline", "Miner I"), - "'Wild' Miner I": ("Storyline", "Miner I"), - "Medium Nano Armor Repair Unit I": ("Tech I", "Medium Armor Repairer I"), + "'Habitat' Miner I" : ("Storyline", "Miner I"), + "'Wild' Miner I" : ("Storyline", "Miner I"), + "Medium Nano Armor Repair Unit I" : ("Tech I", "Medium Armor Repairer I"), "Large 'Reprieve' Vestment Reconstructer I": ("Storyline", "Large Armor Repairer I"), - "Khanid Navy Torpedo Launcher": ("Faction", "Torpedo Launcher I"), } + "Khanid Navy Torpedo Launcher" : ("Faction", "Torpedo Launcher I"), + } # Parent type name: set(item names) self.ITEMS_FORCEDMETAGROUP_R = {} for item, value in self.ITEMS_FORCEDMETAGROUP.items(): @@ -309,57 +311,58 @@ class Market(): # Dictionary of items with forced market group (service assumes they have no # market group assigned in db, otherwise they'll appear in both original and forced groups) self.ITEMS_FORCEDMARKETGROUP = { - "'Alpha' Data Analyzer I": 714, + "'Alpha' Data Analyzer I" : 714, # Ship Equipment > Electronics and Sensor Upgrades > Scanners > Data and Composition Scanners - "'Codex' Data Analyzer I": 714, + "'Codex' Data Analyzer I" : 714, # Ship Equipment > Electronics and Sensor Upgrades > Scanners > Data and Composition Scanners - "'Daemon' Data Analyzer I": 714, + "'Daemon' Data Analyzer I" : 714, # Ship Equipment > Electronics and Sensor Upgrades > Scanners > Data and Composition Scanners - "'Libram' Data Analyzer I": 714, + "'Libram' Data Analyzer I" : 714, # Ship Equipment > Electronics and Sensor Upgrades > Scanners > Data and Composition Scanners - "Advanced Cerebral Accelerator": 977, # Implants & Boosters > Booster - "Civilian Damage Control": 615, # Ship Equipment > Hull & Armor > Damage Controls - "Civilian EM Ward Field": 1695, # Ship Equipment > Shield > Shield Hardeners > EM Shield Hardeners - "Civilian Explosive Deflection Field": 1694, + "Advanced Cerebral Accelerator" : 977, # Implants & Boosters > Booster + "Civilian Damage Control" : 615, # Ship Equipment > Hull & Armor > Damage Controls + "Civilian EM Ward Field" : 1695, + # Ship Equipment > Shield > Shield Hardeners > EM Shield Hardeners + "Civilian Explosive Deflection Field" : 1694, # Ship Equipment > Shield > Shield Hardeners > Explosive Shield Hardeners - "Civilian Hobgoblin": 837, # Drones > Combat Drones > Light Scout Drones - "Civilian Kinetic Deflection Field": 1693, + "Civilian Hobgoblin" : 837, # Drones > Combat Drones > Light Scout Drones + "Civilian Kinetic Deflection Field" : 1693, # Ship Equipment > Shield > Shield Hardeners > Kinetic Shield Hardeners - "Civilian Light Missile Launcher": 640, + "Civilian Light Missile Launcher" : 640, # Ship Equipment > Turrets & Bays > Missile Launchers > Light Missile Launchers - "Civilian Scourge Light Missile": 920, + "Civilian Scourge Light Missile" : 920, # Ammunition & Charges > Missiles > Light Missiles > Standard Light Missiles - "Civilian Small Remote Armor Repairer": 1059, + "Civilian Small Remote Armor Repairer" : 1059, # Ship Equipment > Hull & Armor > Remote Armor Repairers > Small - "Civilian Small Remote Shield Booster": 603, # Ship Equipment > Shield > Remote Shield Boosters > Small - "Civilian Stasis Webifier": 683, # Ship Equipment > Electronic Warfare > Stasis Webifiers - "Civilian Thermic Dissipation Field": 1692, + "Civilian Small Remote Shield Booster" : 603, # Ship Equipment > Shield > Remote Shield Boosters > Small + "Civilian Stasis Webifier" : 683, # Ship Equipment > Electronic Warfare > Stasis Webifiers + "Civilian Thermic Dissipation Field" : 1692, # Ship Equipment > Shield > Shield Hardeners > Thermal Shield Hardeners - "Civilian Warp Disruptor": 1935, # Ship Equipment > Electronic Warfare > Warp Disruptors - "Hardwiring - Zainou 'Sharpshooter' ZMX10": 1493, + "Civilian Warp Disruptor" : 1935, # Ship Equipment > Electronic Warfare > Warp Disruptors + "Hardwiring - Zainou 'Sharpshooter' ZMX10" : 1493, # Implants & Boosters > Implants > Skill Hardwiring > Missile Implants > Implant Slot 06 - "Hardwiring - Zainou 'Sharpshooter' ZMX100": 1493, + "Hardwiring - Zainou 'Sharpshooter' ZMX100" : 1493, # Implants & Boosters > Implants > Skill Hardwiring > Missile Implants > Implant Slot 06 "Hardwiring - Zainou 'Sharpshooter' ZMX1000": 1493, # Implants & Boosters > Implants > Skill Hardwiring > Missile Implants > Implant Slot 06 - "Hardwiring - Zainou 'Sharpshooter' ZMX11": 1493, + "Hardwiring - Zainou 'Sharpshooter' ZMX11" : 1493, # Implants & Boosters > Implants > Skill Hardwiring > Missile Implants > Implant Slot 06 - "Hardwiring - Zainou 'Sharpshooter' ZMX110": 1493, + "Hardwiring - Zainou 'Sharpshooter' ZMX110" : 1493, # Implants & Boosters > Implants > Skill Hardwiring > Missile Implants > Implant Slot 06 "Hardwiring - Zainou 'Sharpshooter' ZMX1100": 1493, # Implants & Boosters > Implants > Skill Hardwiring > Missile Implants > Implant Slot 06 - "Nugoehuvi Synth Blue Pill Booster": 977, # Implants & Boosters > Booster - "Prototype Cerebral Accelerator": 977, # Implants & Boosters > Booster - "Prototype Iris Probe Launcher": 712, # Ship Equipment > Turrets & Bays > Scan Probe Launchers - "Shadow": 1310, # Drones > Combat Drones > Fighter Bombers - "Sleeper Data Analyzer I": 714, + "Nugoehuvi Synth Blue Pill Booster" : 977, # Implants & Boosters > Booster + "Prototype Cerebral Accelerator" : 977, # Implants & Boosters > Booster + "Prototype Iris Probe Launcher" : 712, # Ship Equipment > Turrets & Bays > Scan Probe Launchers + "Shadow" : 1310, # Drones > Combat Drones > Fighter Bombers + "Sleeper Data Analyzer I" : 714, # Ship Equipment > Electronics and Sensor Upgrades > Scanners > Data and Composition Scanners - "Standard Cerebral Accelerator": 977, # Implants & Boosters > Booster - "Talocan Data Analyzer I": 714, + "Standard Cerebral Accelerator" : 977, # Implants & Boosters > Booster + "Talocan Data Analyzer I" : 714, # Ship Equipment > Electronics and Sensor Upgrades > Scanners > Data and Composition Scanners - "Terran Data Analyzer I": 714, + "Terran Data Analyzer I" : 714, # Ship Equipment > Electronics and Sensor Upgrades > Scanners > Data and Composition Scanners - "Tetrimon Data Analyzer I": 714 + "Tetrimon Data Analyzer I" : 714 # Ship Equipment > Electronics and Sensor Upgrades > Scanners > Data and Composition Scanners } @@ -617,7 +620,7 @@ class Market(): if hasattr(group, 'addItems'): groupItems.update(group.addItems) items = set( - filter(lambda item: self.getPublicityByItem(item) and self.getGroupByItem(item) == group, groupItems)) + filter(lambda item: self.getPublicityByItem(item) and self.getGroupByItem(item) == group, groupItems)) return items def getItemsByMarketGroup(self, mg, vars_=True): diff --git a/service/network.py b/service/network.py index 481c77a41..d050e88e2 100644 --- a/service/network.py +++ b/service/network.py @@ -51,7 +51,7 @@ class TimeoutError(StandardError): pass -class Network(): +class Network(object): # Request constants - every request must supply this, as it is checked if # enabled or not via settings ENABLED = 1 @@ -90,8 +90,10 @@ class Network(): # proxy_auth is a tuple of (login, password) or None if proxy_auth is not None: # add login:password@ in front of proxy address - proxy_handler = urllib2.ProxyHandler({'https': '{0}:{1}@{2}:{3}'.format( - proxy_auth[0], proxy_auth[1], proxy[0], proxy[1])}) + proxy_handler = urllib2.ProxyHandler({ + 'https': '{0}:{1}@{2}:{3}'.format( + proxy_auth[0], proxy_auth[1], proxy[0], proxy[1]) + }) else: # build proxy handler with no login/pass info proxy_handler = urllib2.ProxyHandler({'https': "{0}:{1}".format(proxy[0], proxy[1])}) diff --git a/service/update.py b/service/update.py index 6ca8a61a8..cbbc4867f 100644 --- a/service/update.py +++ b/service/update.py @@ -89,7 +89,7 @@ class CheckUpdateThread(threading.Thread): return tuple(map(int, (v.split(".")))) -class Update(): +class Update(object): instance = None def CheckUpdate(self, callback): diff --git a/utils/timer.py b/utils/timer.py index 41b5f78b7..8139f9101 100644 --- a/utils/timer.py +++ b/utils/timer.py @@ -1,7 +1,7 @@ import time -class Timer(): +class Timer(object): def __init__(self, name='', logger=None): self.name = name self.start = time.time() @@ -18,10 +18,10 @@ class Timer(): def checkpoint(self, name=''): text = u'Timer - {timer} - {checkpoint} - {last:.2f}ms ({elapsed:.2f}ms elapsed)'.format( - timer=self.name, - checkpoint=unicode(name, "utf-8"), - last=self.last, - elapsed=self.elapsed + timer=self.name, + checkpoint=unicode(name, "utf-8"), + last=self.last, + elapsed=self.elapsed ).strip() self.__last = time.time() if self.logger: From 72633825cf0e9ba6d925e908614528ed5e1100d7 Mon Sep 17 00:00:00 2001 From: Ebag333 Date: Wed, 8 Feb 2017 23:32:51 -0800 Subject: [PATCH 20/52] Formatting and layout changes --- eos/db/__init__.py | 4 ++ eos/db/gamedata/item.py | 4 +- eos/db/saveddata/databaseRepair.py | 3 +- eos/db/saveddata/fit.py | 12 ++-- eos/graph/__init__.py | 2 +- eos/graph/fitDps.py | 2 +- gui/PFListPane.py | 4 +- gui/PFSearchBox.py | 9 +-- gui/boosterView.py | 4 +- .../pyfaUpdatePreferences.py | 2 +- gui/builtinStatsViews/priceViewFull.py | 3 +- .../targetingMiscViewFull.py | 12 ++-- gui/builtinViewColumns/attributeDisplay.py | 2 +- gui/builtinViewColumns/maxRange.py | 2 +- gui/builtinViewColumns/misc.py | 2 +- gui/builtinViewColumns/propertyDisplay.py | 2 +- gui/builtinViews/fittingView.py | 28 ++++---- gui/cargoView.py | 6 +- gui/commandView.py | 10 +-- gui/contextMenu.py | 2 +- gui/copySelectDialog.py | 2 +- gui/crestFittings.py | 1 - gui/display.py | 10 +-- gui/droneView.py | 4 +- gui/fighterView.py | 4 +- gui/mainFrame.py | 2 +- gui/marketBrowser.py | 2 +- gui/preferenceView.py | 2 +- gui/projectedView.py | 8 +-- gui/propertyEditor.py | 2 +- gui/pyfatogglepanel.py | 2 +- gui/pygauge.py | 13 ++-- gui/resistsEditor.py | 10 +-- gui/setEditor.py | 4 +- gui/sfBrowserItem.py | 4 +- gui/shipBrowser.py | 21 +++--- gui/updateDialog.py | 4 +- gui/utils/animEffects.py | 2 +- gui/utils/animUtils.py | 2 +- gui/utils/colorUtils.py | 2 +- gui/utils/fonts.py | 4 +- gui/utils/numberFormatter.py | 2 +- gui/viewColumn.py | 4 +- service/character.py | 4 +- service/eveapi.py | 8 +-- service/fit.py | 2 +- service/market.py | 8 +-- service/network.py | 2 +- service/port.py | 4 +- service/pycrest/weak_ciphers.py | 2 +- service/server.py | 2 +- service/settings.py | 4 +- service/update.py | 4 +- setup.py | 9 +-- tox.ini | 2 +- utils/compat.py | 64 +++++++++---------- 56 files changed, 168 insertions(+), 173 deletions(-) diff --git a/eos/db/__init__.py b/eos/db/__init__.py index 796799e99..aa320892a 100644 --- a/eos/db/__init__.py +++ b/eos/db/__init__.py @@ -66,11 +66,15 @@ else: sd_lock = threading.Lock() # Import all the definitions for all our database stuff +# noinspection PyPep8 from eos.db.gamedata import alphaClones, attribute, category, effect, group, icon, item, marketGroup, metaData, metaGroup, queries, traits, unit +# noinspection PyPep8 from eos.db.saveddata import booster, cargo, character, crest, damagePattern, databaseRepair, drone, fighter, fit, implant, implantSet, loadDefaultDatabaseValues, miscData, module, override, price, queries, skill, targetResists, user # Import queries +# noinspection PyPep8 from eos.db.gamedata.queries import * +# noinspection PyPep8 from eos.db.saveddata.queries import * # If using in memory saveddata, you'll want to reflect it so the data structure is good. diff --git a/eos/db/gamedata/item.py b/eos/db/gamedata/item.py index 1eaa15c95..da43f9ef2 100644 --- a/eos/db/gamedata/item.py +++ b/eos/db/gamedata/item.py @@ -39,8 +39,8 @@ items_table = Table("invtypes", gamedata_meta, Column("iconID", Integer, ForeignKey("icons.iconID")), Column("groupID", Integer, ForeignKey("invgroups.groupID"), index=True)) -from .metaGroup import metatypes_table # noqa -from .traits import traits_table # noqa +from .metaGroup import metatypes_table # noqa +from .traits import traits_table # noqa mapper(Item, items_table, properties={"group": relation(Group, backref="items"), diff --git a/eos/db/saveddata/databaseRepair.py b/eos/db/saveddata/databaseRepair.py index 8061d524d..67339b3a7 100644 --- a/eos/db/saveddata/databaseRepair.py +++ b/eos/db/saveddata/databaseRepair.py @@ -86,8 +86,7 @@ class DatabaseCleanup(object): else: uniform_damage_pattern_id = rows[0]['ID'] update_query = "UPDATE 'fits' SET 'damagePatternID' = {} " \ - "WHERE damagePatternID NOT IN (SELECT ID FROM damagePatterns) OR damagePatternID IS NULL".format( - uniform_damage_pattern_id) + "WHERE damagePatternID NOT IN (SELECT ID FROM damagePatterns) OR damagePatternID IS NULL".format(uniform_damage_pattern_id) update_results = DatabaseCleanup.ExecuteSQLQuery(saveddata_engine, update_query) logger.error("Database corruption found. Cleaning up %d records.", update_results.rowcount) diff --git a/eos/db/saveddata/fit.py b/eos/db/saveddata/fit.py index b3082d372..8cbdb4d6f 100644 --- a/eos/db/saveddata/fit.py +++ b/eos/db/saveddata/fit.py @@ -140,7 +140,7 @@ mapper(es_Fit, fits_table, "_Fit__modules": relation( Module, collection_class=HandledModuleList, - primaryjoin=and_(modules_table.c.fitID == fits_table.c.ID, modules_table.c.projected == False), # noqa + primaryjoin=and_(modules_table.c.fitID == fits_table.c.ID, modules_table.c.projected == False), # noqa order_by=modules_table.c.position, cascade='all, delete, delete-orphan'), "_Fit__projectedModules": relation( @@ -148,7 +148,7 @@ mapper(es_Fit, fits_table, collection_class=HandledProjectedModList, cascade='all, delete, delete-orphan', single_parent=True, - primaryjoin=and_(modules_table.c.fitID == fits_table.c.ID, modules_table.c.projected == True)), # noqa + primaryjoin=and_(modules_table.c.fitID == fits_table.c.ID, modules_table.c.projected == True)), # noqa "owner": relation( User, backref="fits"), @@ -164,13 +164,13 @@ mapper(es_Fit, fits_table, collection_class=HandledDroneCargoList, cascade='all, delete, delete-orphan', single_parent=True, - primaryjoin=and_(drones_table.c.fitID == fits_table.c.ID, drones_table.c.projected == False)), # noqa + primaryjoin=and_(drones_table.c.fitID == fits_table.c.ID, drones_table.c.projected == False)), # noqa "_Fit__fighters": relation( Fighter, collection_class=HandledDroneCargoList, cascade='all, delete, delete-orphan', single_parent=True, - primaryjoin=and_(fighters_table.c.fitID == fits_table.c.ID, fighters_table.c.projected == False)), # noqa + primaryjoin=and_(fighters_table.c.fitID == fits_table.c.ID, fighters_table.c.projected == False)), # noqa "_Fit__cargo": relation( Cargo, collection_class=HandledDroneCargoList, @@ -182,13 +182,13 @@ mapper(es_Fit, fits_table, collection_class=HandledProjectedDroneList, cascade='all, delete, delete-orphan', single_parent=True, - primaryjoin=and_(drones_table.c.fitID == fits_table.c.ID, drones_table.c.projected == True)), # noqa + primaryjoin=and_(drones_table.c.fitID == fits_table.c.ID, drones_table.c.projected == True)), # noqa "_Fit__projectedFighters": relation( Fighter, collection_class=HandledProjectedDroneList, cascade='all, delete, delete-orphan', single_parent=True, - primaryjoin=and_(fighters_table.c.fitID == fits_table.c.ID, fighters_table.c.projected == True)), # noqa + primaryjoin=and_(fighters_table.c.fitID == fits_table.c.ID, fighters_table.c.projected == True)), # noqa "_Fit__implants": relation( Implant, collection_class=HandledImplantBoosterList, diff --git a/eos/graph/__init__.py b/eos/graph/__init__.py index 44f6905c7..7127afa73 100644 --- a/eos/graph/__init__.py +++ b/eos/graph/__init__.py @@ -62,7 +62,7 @@ class Data(object): def parseString(self, dataString): if not isinstance(dataString, basestring): - return (Constant(dataString),) + return Constant(dataString), dataList = [] for data in dataString.split(";"): diff --git a/eos/graph/fitDps.py b/eos/graph/fitDps.py index d13b742fe..7603be598 100644 --- a/eos/graph/fitDps.py +++ b/eos/graph/fitDps.py @@ -179,4 +179,4 @@ class FitDpsGraph(Graph): turretFalloff = mod.falloff rangeEq = ((max(0, distance - turretOptimal)) / turretFalloff) ** 2 - return 0.5 ** (rangeEq) + return 0.5 ** rangeEq diff --git a/gui/PFListPane.py b/gui/PFListPane.py index c138e72b8..2c0b35d16 100644 --- a/gui/PFListPane.py +++ b/gui/PFListPane.py @@ -80,11 +80,11 @@ class PFListPane(wx.ScrolledWindow): new_vs_x, new_vs_y = -1, -1 # is it before the left edge? - if cr.x < 0 and sppu_x > 0: + if cr.x < 0 < sppu_x: new_vs_x = vs_x + (cr.x / sppu_x) # is it above the top? - if cr.y < 0 and sppu_y > 0: + if cr.y < 0 < sppu_y: new_vs_y = vs_y + (cr.y / sppu_y) # For the right and bottom edges, scroll enough to show the diff --git a/gui/PFSearchBox.py b/gui/PFSearchBox.py index b0337c2e1..8a5cd369c 100644 --- a/gui/PFSearchBox.py +++ b/gui/PFSearchBox.py @@ -103,14 +103,15 @@ class PFSearchBox(wx.Window): x, y = target px, py = position aX, aY = area - if (px > x and px < x + aX) and (py > y and py < y + aY): + if (x < px < x + aX) and (y < py < y + aY): return True return False def GetButtonsPos(self): - btnpos = [] - btnpos.append((self.searchButtonX, self.searchButtonY)) - btnpos.append((self.cancelButtonX, self.cancelButtonY)) + btnpos = [ + (self.searchButtonX, self.searchButtonY), + (self.cancelButtonX, self.cancelButtonY) + ] return btnpos def GetButtonsSize(self): diff --git a/gui/boosterView.py b/gui/boosterView.py index 3f0c08d59..8b9209339 100644 --- a/gui/boosterView.py +++ b/gui/boosterView.py @@ -68,13 +68,13 @@ class BoosterView(d.Display): self.Bind(wx.EVT_RIGHT_DOWN, self.scheduleMenu) def handleListDrag(self, x, y, data): - ''' + """ Handles dragging of items from various pyfa displays which support it data is list with two indices: data[0] is hard-coded str of originating source data[1] is typeID or index of data we want to manipulate - ''' + """ if data[0] == "market": wx.PostEvent(self.mainFrame, mb.ItemSelected(itemID=int(data[1]))) diff --git a/gui/builtinPreferenceViews/pyfaUpdatePreferences.py b/gui/builtinPreferenceViews/pyfaUpdatePreferences.py index fcb3fe003..4e3519e2f 100644 --- a/gui/builtinPreferenceViews/pyfaUpdatePreferences.py +++ b/gui/builtinPreferenceViews/pyfaUpdatePreferences.py @@ -40,7 +40,7 @@ class PFUpdatePref(PreferenceView): mainSizer.Add(self.suppressPrerelease, 0, wx.ALL | wx.EXPAND, 5) - if (self.UpdateSettings.get('version')): + if self.UpdateSettings.get('version'): self.versionSizer = wx.BoxSizer(wx.VERTICAL) self.versionTitle = wx.StaticText(panel, wx.ID_ANY, "Suppressing {0} Notifications".format( diff --git a/gui/builtinStatsViews/priceViewFull.py b/gui/builtinStatsViews/priceViewFull.py index d33459865..e5e9b85a7 100644 --- a/gui/builtinStatsViews/priceViewFull.py +++ b/gui/builtinStatsViews/priceViewFull.py @@ -75,8 +75,7 @@ class PriceViewFull(StatsView): if fit is not None: self.fit = fit # Compose a list of all the data we need & request it - typeIDs = [] - typeIDs.append(fit.ship.item.ID) + typeIDs = [fit.ship.item.ID] for mod in fit.modules: if not mod.isEmpty: diff --git a/gui/builtinStatsViews/targetingMiscViewFull.py b/gui/builtinStatsViews/targetingMiscViewFull.py index bcdd2ca60..27e83fea8 100644 --- a/gui/builtinStatsViews/targetingMiscViewFull.py +++ b/gui/builtinStatsViews/targetingMiscViewFull.py @@ -203,16 +203,14 @@ class TargetingMiscViewFull(StatsView): label.SetToolTip( wx.ToolTip("Type: %s\n%.1f%% Chance of Jam" % (fit.scanType, fit.jamChance))) else: - label.SetToolTip(wx.ToolTip("Type: %s" % (fit.scanType))) + label.SetToolTip(wx.ToolTip("Type: %s" % fit.scanType)) elif labelName == "labelFullAlignTime": alignTime = "Align:\t%.3fs" % mainValue mass = 'Mass:\t{:,.0f}kg'.format(fit.ship.getModifiedItemAttr("mass")) agility = "Agility:\t%.3fx" % (fit.ship.getModifiedItemAttr("agility") or 0) label.SetToolTip(wx.ToolTip("%s\n%s\n%s" % (alignTime, mass, agility))) elif labelName == "labelFullCargo": - tipLines = [] - tipLines.append( - u"Cargohold: {:,.2f}m\u00B3 / {:,.2f}m\u00B3".format(fit.cargoBayUsed, newValues["main"])) + tipLines = [u"Cargohold: {:,.2f}m\u00B3 / {:,.2f}m\u00B3".format(fit.cargoBayUsed, newValues["main"])] for attrName, tipAlias in cargoNamesOrder.items(): if newValues[attrName] > 0: tipLines.append(u"{}: {:,.2f}m\u00B3".format(tipAlias, newValues[attrName])) @@ -232,7 +230,7 @@ class TargetingMiscViewFull(StatsView): if fit.jamChance > 0: label.SetToolTip(wx.ToolTip("Type: %s\n%.1f%% Chance of Jam" % (fit.scanType, fit.jamChance))) else: - label.SetToolTip(wx.ToolTip("Type: %s" % (fit.scanType))) + label.SetToolTip(wx.ToolTip("Type: %s" % fit.scanType)) else: label.SetToolTip(wx.ToolTip("")) elif labelName == "labelFullCargo": @@ -240,9 +238,7 @@ class TargetingMiscViewFull(StatsView): cachedCargo = self._cachedValues[counter] # if you add stuff to cargo, the capacity doesn't change and thus it is still cached # This assures us that we force refresh of cargo tooltip - tipLines = [] - tipLines.append( - u"Cargohold: {:,.2f}m\u00B3 / {:,.2f}m\u00B3".format(fit.cargoBayUsed, cachedCargo["main"])) + tipLines = [u"Cargohold: {:,.2f}m\u00B3 / {:,.2f}m\u00B3".format(fit.cargoBayUsed, cachedCargo["main"])] for attrName, tipAlias in cargoNamesOrder.items(): if cachedCargo[attrName] > 0: tipLines.append(u"{}: {:,.2f}m\u00B3".format(tipAlias, cachedCargo[attrName])) diff --git a/gui/builtinViewColumns/attributeDisplay.py b/gui/builtinViewColumns/attributeDisplay.py index 5996b0f74..855bfe2a1 100644 --- a/gui/builtinViewColumns/attributeDisplay.py +++ b/gui/builtinViewColumns/attributeDisplay.py @@ -83,7 +83,7 @@ class AttributeDisplay(ViewColumn): if self.info.name == "volume": str_ = (formatAmount(attr, 3, 0, 3)) if hasattr(mod, "amount"): - str_ = str_ + u"m\u00B3 (%s m\u00B3)" % (formatAmount(attr * mod.amount, 3, 0, 3)) + str_ += u"m\u00B3 (%s m\u00B3)" % (formatAmount(attr * mod.amount, 3, 0, 3)) attr = str_ if isinstance(attr, (float, int)): diff --git a/gui/builtinViewColumns/maxRange.py b/gui/builtinViewColumns/maxRange.py index f10335b37..d4b3367da 100644 --- a/gui/builtinViewColumns/maxRange.py +++ b/gui/builtinViewColumns/maxRange.py @@ -74,7 +74,7 @@ class MaxRange(ViewColumn): return -1 def getParameters(self): - return (("displayName", bool, False), ("showIcon", bool, True)) + return ("displayName", bool, False), ("showIcon", bool, True) def getToolTip(self, mod): return "Optimal + Falloff" diff --git a/gui/builtinViewColumns/misc.py b/gui/builtinViewColumns/misc.py index f5ba2c89a..c1e12f29c 100644 --- a/gui/builtinViewColumns/misc.py +++ b/gui/builtinViewColumns/misc.py @@ -59,7 +59,7 @@ class Miscellanea(ViewColumn): return -1 def getParameters(self): - return (("displayName", bool, False), ("showIcon", bool, True)) + return ("displayName", bool, False), ("showIcon", bool, True) def __getData(self, stuff): item = stuff.item diff --git a/gui/builtinViewColumns/propertyDisplay.py b/gui/builtinViewColumns/propertyDisplay.py index 1972cfae1..b4faa177a 100644 --- a/gui/builtinViewColumns/propertyDisplay.py +++ b/gui/builtinViewColumns/propertyDisplay.py @@ -56,7 +56,7 @@ class PropertyDisplay(ViewColumn): def getText(self, stuff): attr = getattr(stuff, self.propertyName, None) if attr: - return (formatAmount(attr, 3, 0, 3)) + return formatAmount(attr, 3, 0, 3) else: return "" diff --git a/gui/builtinViews/fittingView.py b/gui/builtinViews/fittingView.py index ce54fd8f7..bcaa15aa7 100644 --- a/gui/builtinViews/fittingView.py +++ b/gui/builtinViews/fittingView.py @@ -188,13 +188,13 @@ class FittingView(d.Display): event.Skip() def handleListDrag(self, x, y, data): - ''' + """ Handles dragging of items from various pyfa displays which support it data is list with two items: data[0] is hard-coded str of originating source data[1] is typeID or index of data we want to manipulate - ''' + """ if data[0] == "fitting": self.swapItems(x, y, int(data[1])) @@ -262,11 +262,11 @@ class FittingView(d.Display): event.Skip() def fitRemoved(self, event): - ''' + """ If fit is removed and active, the page is deleted. We also refresh the fit of the new current page in case delete fit caused change in stats (projected) - ''' + """ fitID = event.fitID if fitID == self.getActiveFit(): @@ -358,7 +358,7 @@ class FittingView(d.Display): wx.PostEvent(self.mainFrame, GE.FitChanged(fitID=self.activeFitID)) def addModule(self, x, y, srcIdx): - '''Add a module from the market browser''' + """Add a module from the market browser""" dstRow, _ = self.HitTest((x, y)) if dstRow != -1 and dstRow not in self.blanks: @@ -371,7 +371,7 @@ class FittingView(d.Display): wx.PostEvent(self.mainFrame, GE.FitChanged(fitID=self.mainFrame.getActiveFit())) def swapCargo(self, x, y, srcIdx): - '''Swap a module from cargo to fitting window''' + """Swap a module from cargo to fitting window""" mstate = wx.GetMouseState() dstRow, _ = self.HitTest((x, y)) @@ -385,7 +385,7 @@ class FittingView(d.Display): wx.PostEvent(self.mainFrame, GE.FitChanged(fitID=self.mainFrame.getActiveFit())) def swapItems(self, x, y, srcIdx): - '''Swap two modules in fitting window''' + """Swap two modules in fitting window""" mstate = wx.GetMouseState() sFit = Fit.getInstance() fit = sFit.getFit(self.activeFitID) @@ -414,12 +414,12 @@ class FittingView(d.Display): wx.PostEvent(self.mainFrame, GE.FitChanged(fitID=self.mainFrame.getActiveFit())) def generateMods(self): - ''' + """ Generate module list. This also injects dummy modules to visually separate racks. These modules are only known to the display, and not the backend, so it's safe. - ''' + """ sFit = Fit.getInstance() fit = sFit.getFit(self.activeFitID) @@ -539,13 +539,13 @@ class FittingView(d.Display): self.PopupMenu(menu) def click(self, event): - ''' + """ Handle click event on modules. This is only useful for the State column. If multiple items are selected, and we have clicked the State column, iterate through the selections and change State - ''' + """ row, _, col = self.HitTestSubItem(event.Position) # only do State column and ignore invalid rows @@ -587,12 +587,12 @@ class FittingView(d.Display): return self.slotColourMap.get(slot) or self.GetBackgroundColour() def refresh(self, stuff): - ''' + """ Displays fitting Sends data to d.Display.refresh where the rows and columns are set up, then does a bit of post-processing (colors) - ''' + """ self.Freeze() d.Display.refresh(self, stuff) @@ -745,7 +745,7 @@ class FittingView(d.Display): maxWidth += columnsWidths[i] mdc = wx.MemoryDC() - mbmp = wx.EmptyBitmap(maxWidth, (maxRowHeight) * rows + padding * 4 + headerSize) + mbmp = wx.EmptyBitmap(maxWidth, maxRowHeight * rows + padding * 4 + headerSize) mdc.SelectObject(mbmp) diff --git a/gui/cargoView.py b/gui/cargoView.py index bacd5c8aa..e50f68354 100644 --- a/gui/cargoView.py +++ b/gui/cargoView.py @@ -68,13 +68,13 @@ class CargoView(d.Display): self.Bind(wx.EVT_RIGHT_DOWN, self.scheduleMenu) def handleListDrag(self, x, y, data): - ''' + """ Handles dragging of items from various pyfa displays which support it data is list with two indices: data[0] is hard-coded str of originating source data[1] is typeID or index of data we want to manipulate - ''' + """ if data[0] == "fitting": self.swapModule(x, y, int(data[1])) @@ -106,7 +106,7 @@ class CargoView(d.Display): event.Skip() def swapModule(self, x, y, modIdx): - '''Swap a module from fitting window with cargo''' + """Swap a module from fitting window with cargo""" sFit = Fit.getInstance() fit = sFit.getFit(self.mainFrame.getActiveFit()) dstRow, _ = self.HitTest((x, y)) diff --git a/gui/commandView.py b/gui/commandView.py index 9ec44dcb9..c47832451 100644 --- a/gui/commandView.py +++ b/gui/commandView.py @@ -81,13 +81,13 @@ class CommandView(d.Display): self.SetDropTarget(CommandViewDrop(self.handleListDrag)) def handleListDrag(self, x, y, data): - ''' + """ Handles dragging of items from various pyfa displays which support it data is list with two indices: data[0] is hard-coded str of originating source data[1] is typeID or index of data we want to manipulate - ''' + """ pass def kbEvent(self, event): @@ -153,7 +153,7 @@ class CommandView(d.Display): self.deselectItems() # todo: verify - if stuff == []: + if not stuff: stuff = [DummyEntry("Drag a fit to this area")] self.update(stuff) @@ -161,7 +161,7 @@ class CommandView(d.Display): def get(self, row): numFits = len(self.fits) - if (numFits) == 0: + if numFits == 0: return None return self.fits[row] @@ -193,7 +193,7 @@ class CommandView(d.Display): fitSrcContext = "commandFit" fitItemContext = item.name context = ((fitSrcContext, fitItemContext),) - context = context + (("command",),) + context += ("command",), menu = ContextMenu.getMenu((item,), *context) elif sel == -1: fitID = self.mainFrame.getActiveFit() diff --git a/gui/contextMenu.py b/gui/contextMenu.py index dc587be24..7731c0120 100644 --- a/gui/contextMenu.py +++ b/gui/contextMenu.py @@ -120,7 +120,7 @@ class ContextMenu(object): rootMenu.AppendSeparator() debug_end = len(cls._ids) - if (debug_end - debug_start): + if debug_end - debug_start: logger.debug("%d new IDs created for this menu" % (debug_end - debug_start)) return rootMenu if empty is False else None diff --git a/gui/copySelectDialog.py b/gui/copySelectDialog.py index 2f0a55e60..57ce48f47 100644 --- a/gui/copySelectDialog.py +++ b/gui/copySelectDialog.py @@ -54,7 +54,7 @@ class CopySelectDialog(wx.Dialog): mainSizer.Add(selector, 0, wx.EXPAND | wx.ALL, 5) buttonSizer = self.CreateButtonSizer(wx.OK | wx.CANCEL) - if (buttonSizer): + if buttonSizer: mainSizer.Add(buttonSizer, 0, wx.EXPAND | wx.ALL, 5) self.SetSizer(mainSizer) diff --git a/gui/crestFittings.py b/gui/crestFittings.py index ff2ec8527..9eb625d04 100644 --- a/gui/crestFittings.py +++ b/gui/crestFittings.py @@ -149,7 +149,6 @@ class CrestFittings(wx.Frame): except requests.exceptions.ConnectionError: self.statusbar.SetStatusText("Connection error, please check your internet connection") - def importFitting(self, event): selection = self.fitView.fitSelection if not selection: diff --git a/gui/display.py b/gui/display.py index 53bb5e6cc..4bbdc7b40 100644 --- a/gui/display.py +++ b/gui/display.py @@ -89,11 +89,11 @@ class Display(wx.ListCtrl): # Did the point hit any item? if (flags & wx.LIST_HITTEST_ONITEM) == 0: - return (-1, 0, -1) + return -1, 0, -1 # If it did hit an item and we are not in report mode, it must be the primary cell if not self.InReportView(): - return (rowIndex, wx.LIST_HITTEST_ONITEM, 0) + return rowIndex, wx.LIST_HITTEST_ONITEM, 0 # Find which subitem is hit right = 0 @@ -106,9 +106,9 @@ class Display(wx.ListCtrl): flag = wx.LIST_HITTEST_ONITEMICON else: flag = wx.LIST_HITTEST_ONITEMLABEL - return (rowIndex, flag, i) + return rowIndex, flag, i - return (rowIndex, 0, -1) + return rowIndex, 0, -1 def OnEraseBk(self, event): if self.GetItemCount() > 0: @@ -219,7 +219,7 @@ class Display(wx.ListCtrl): self.InsertStringItem(sys.maxint, "") if listItemCount > stuffItemCount: - if listItemCount - stuffItemCount > 20 and stuffItemCount < 20: + if listItemCount - stuffItemCount > 20 > stuffItemCount: self.DeleteAllItems() for i in range(stuffItemCount): self.InsertStringItem(sys.maxint, "") diff --git a/gui/droneView.py b/gui/droneView.py index b3836785c..5c6c44db4 100644 --- a/gui/droneView.py +++ b/gui/droneView.py @@ -130,13 +130,13 @@ class DroneView(Display): dropSource.DoDragDrop() def handleDragDrop(self, x, y, data): - ''' + """ Handles dragging of items from various pyfa displays which support it data is list with two indices: data[0] is hard-coded str of originating source data[1] is typeID or index of data we want to manipulate - ''' + """ if data[0] == "drone": # we want to merge drones srcRow = int(data[1]) dstRow, _ = self.HitTest((x, y)) diff --git a/gui/fighterView.py b/gui/fighterView.py index 803707c37..79923daa2 100644 --- a/gui/fighterView.py +++ b/gui/fighterView.py @@ -192,13 +192,13 @@ class FighterDisplay(d.Display): dropSource.DoDragDrop() def handleDragDrop(self, x, y, data): - ''' + """ Handles dragging of items from various pyfa displays which support it data is list with two indices: data[0] is hard-coded str of originating source data[1] is typeID or index of data we want to manipulate - ''' + """ if data[0] == "fighter": # we want to merge fighters srcRow = int(data[1]) dstRow, _ = self.HitTest((x, y)) diff --git a/gui/mainFrame.py b/gui/mainFrame.py index db5f4b769..ec8845884 100644 --- a/gui/mainFrame.py +++ b/gui/mainFrame.py @@ -794,7 +794,7 @@ class MainFrame(wx.Frame): "All Files (*)|*"), style=wx.FD_OPEN | wx.FD_FILE_MUST_EXIST | wx.FD_MULTIPLE ) - if (dlg.ShowModal() == wx.ID_OK): + if dlg.ShowModal() == wx.ID_OK: self.progressDialog = wx.ProgressDialog( "Importing fits", " " * 100, # set some arbitrary spacing to create width in window diff --git a/gui/marketBrowser.py b/gui/marketBrowser.py index 8b00a4378..0ee1b008b 100644 --- a/gui/marketBrowser.py +++ b/gui/marketBrowser.py @@ -400,7 +400,7 @@ class ItemView(Display): metagrpid = sMkt.getMetaGroupIdByItem(item) metatab = self.metaMap.get(metagrpid) metalvl = self.metalvls.get(item.ID, 0) - return (catname, mktgrpid, parentname, metatab, metalvl, item.name) + return catname, mktgrpid, parentname, metatab, metalvl, item.name def contextMenu(self, event): # Check if something is selected, if so, spawn the menu for it diff --git a/gui/preferenceView.py b/gui/preferenceView.py index 1d3b018aa..662a2ff20 100644 --- a/gui/preferenceView.py +++ b/gui/preferenceView.py @@ -39,7 +39,7 @@ class PreferenceView(object): # noinspection PyUnresolvedReferences -from gui.builtinPreferenceViews import (# noqa: E402, F401 +from gui.builtinPreferenceViews import ( # noqa: E402, F401 pyfaGeneralPreferences, pyfaNetworkPreferences, pyfaHTMLExportPreferences, diff --git a/gui/projectedView.py b/gui/projectedView.py index da96734e5..40cde2e3b 100644 --- a/gui/projectedView.py +++ b/gui/projectedView.py @@ -87,13 +87,13 @@ class ProjectedView(d.Display): self.SetDropTarget(ProjectedViewDrop(self.handleListDrag)) def handleListDrag(self, x, y, data): - ''' + """ Handles dragging of items from various pyfa displays which support it data is list with two indices: data[0] is hard-coded str of originating source data[1] is typeID or index of data we want to manipulate - ''' + """ if data[0] == "projected": # if source is coming from projected, we are trying to combine drones. @@ -205,7 +205,7 @@ class ProjectedView(d.Display): self.deselectItems() - if stuff == []: + if not stuff: stuff = [DummyEntry("Drag an item or fit, or use right-click menu for system effects")] self.update(stuff) @@ -278,7 +278,7 @@ class ProjectedView(d.Display): fitSrcContext = "projectedFit" fitItemContext = item.name context = ((fitSrcContext, fitItemContext),) - context = context + (("projected",),) + context += ("projected",), menu = ContextMenu.getMenu((item,), *context) elif sel == -1: fitID = self.mainFrame.getActiveFit() diff --git a/gui/propertyEditor.py b/gui/propertyEditor.py index 32c1e0485..81a305a11 100644 --- a/gui/propertyEditor.py +++ b/gui/propertyEditor.py @@ -100,7 +100,7 @@ class AttributeEditor(wx.Frame): dlg = wx.FileDialog(self, "Import pyfa override file", wildcard="pyfa override file (*.csv)|*.csv", style=wx.FD_OPEN | wx.FD_FILE_MUST_EXIST) - if (dlg.ShowModal() == wx.ID_OK): + if dlg.ShowModal() == wx.ID_OK: path = dlg.GetPath() with open(path, 'rb') as csvfile: spamreader = csv.reader(csvfile) diff --git a/gui/pyfatogglepanel.py b/gui/pyfatogglepanel.py index 71ccec124..cdd4398bb 100644 --- a/gui/pyfatogglepanel.py +++ b/gui/pyfatogglepanel.py @@ -146,7 +146,7 @@ class TogglePanel(wx.Panel): """ Handles the status changes (collapsing/expanding). - :param `sz`: an instance of `wx.Size`. + :param sz: an instance of `wx.Size`. """ # minimal size has priority over the best size so set here our min size diff --git a/gui/pygauge.py b/gui/pygauge.py index 6605d19f8..3020bd2e7 100644 --- a/gui/pygauge.py +++ b/gui/pygauge.py @@ -144,7 +144,7 @@ class PyGauge(wx.PyWindow): """ Sets the bar gradient. This overrides the BarColour. - :param `gradient`: a tuple containing the gradient start and end colours. + :param gradient: a tuple containing the gradient start and end colours. """ if gradient is None: self._barGradient = None @@ -163,7 +163,7 @@ class PyGauge(wx.PyWindow): """ Sets the border padding. - :param `padding`: pixels between the border and the progress bar. + :param padding: pixels between the border and the progress bar. """ self._border_padding = padding @@ -189,7 +189,8 @@ class PyGauge(wx.PyWindow): Sets the range of the gauge. The gauge length is its value as a proportion of the range. - :param `range`: The maximum value of the gauge. + :param reinit: + :param range: The maximum value of the gauge. """ if self._range == range: @@ -267,7 +268,7 @@ class PyGauge(wx.PyWindow): """ Handles the ``wx.EVT_ERASE_BACKGROUND`` event for L{PyGauge}. - :param `event`: a `wx.EraseEvent` event to be processed. + :param event: a `wx.EraseEvent` event to be processed. :note: This method is intentionally empty to reduce flicker. """ @@ -278,7 +279,7 @@ class PyGauge(wx.PyWindow): """ Handles the ``wx.EVT_PAINT`` event for L{PyGauge}. - :param `event`: a `wx.PaintEvent` event to be processed. + :param event: a `wx.PaintEvent` event to be processed. """ dc = wx.BufferedPaintDC(self) @@ -409,7 +410,7 @@ class PyGauge(wx.PyWindow): """ Handles the ``wx.EVT_TIMER`` event for L{PyfaGauge}. - :param `event`: a timer event + :param event: a timer event """ oldValue = self._oldPercentage value = self._percentage diff --git a/gui/resistsEditor.py b/gui/resistsEditor.py index dedf0914e..7e5e3cd62 100644 --- a/gui/resistsEditor.py +++ b/gui/resistsEditor.py @@ -189,12 +189,12 @@ class ResistsEditorDlg(wx.Dialog): self.Destroy() def ValuesUpdated(self, event=None): - ''' + """ Event that is fired when resists values change. Iterates through all resist edit fields. If blank, sets it to 0.0. If it is not a proper decimal value, sets text color to red and refuses to save changes until issue is resolved - ''' + """ if self.block: return @@ -238,7 +238,7 @@ class ResistsEditorDlg(wx.Dialog): self.Refresh() def patternChanged(self, event=None): - "Event fired when user selects pattern. Can also be called from script" + """Event fired when user selects pattern. Can also be called from script""" if not self.entityEditor.checkEntitiesExist(): self.Destroy() @@ -262,7 +262,7 @@ class ResistsEditorDlg(wx.Dialog): pass def importPatterns(self, event): - "Event fired when import from clipboard button is clicked" + """Event fired when import from clipboard button is clicked""" text = fromClipboard() if text: @@ -280,7 +280,7 @@ class ResistsEditorDlg(wx.Dialog): self.stNotice.SetLabel("Could not import from clipboard") def exportPatterns(self, event): - "Event fired when export to clipboard button is clicked" + """Event fired when export to clipboard button is clicked""" sTR = TargetResists.getInstance() toClipboard(sTR.exportPatterns()) self.stNotice.SetLabel("Patterns exported to clipboard") diff --git a/gui/setEditor.py b/gui/setEditor.py index 3a1d2874a..036444e18 100644 --- a/gui/setEditor.py +++ b/gui/setEditor.py @@ -188,7 +188,7 @@ class ImplantSetEditorDlg(wx.Dialog): pass def importPatterns(self, event): - "Event fired when import from clipboard button is clicked" + """Event fired when import from clipboard button is clicked""" text = fromClipboard() if text: @@ -208,7 +208,7 @@ class ImplantSetEditorDlg(wx.Dialog): self.stNotice.SetLabel("Could not import from clipboard") def exportPatterns(self, event): - "Event fired when export to clipboard button is clicked" + """Event fired when export to clipboard button is clicked""" sIS = ImplantSets.getInstance() toClipboard(sIS.exportSets()) diff --git a/gui/sfBrowserItem.py b/gui/sfBrowserItem.py index 52989c932..471ef04c4 100644 --- a/gui/sfBrowserItem.py +++ b/gui/sfBrowserItem.py @@ -58,7 +58,7 @@ class PFBaseButton(object): def GetSize(self): w = self.normalBmp.GetWidth() h = self.normalBmp.GetHeight() - return (w, h) + return w, h def GetBitmap(self): return self.normalBmp @@ -201,7 +201,7 @@ class PFToolbar(object): x, y = target px, py = position aX, aY = area - if (px > x and px < x + aX) and (py > y and py < y + aY): + if (x < px < x + aX) and (y < py < y + aY): return True return False diff --git a/gui/shipBrowser.py b/gui/shipBrowser.py index a0302f74b..d91077176 100644 --- a/gui/shipBrowser.py +++ b/gui/shipBrowser.py @@ -197,7 +197,7 @@ class RaceSelector(wx.Window): padding = self.buttonsPadding for bmp in self.raceBmps: - if (mx > x and mx < x + bmp.GetWidth()) and (my > y and my < y + bmp.GetHeight()): + if (x < mx < x + bmp.GetWidth()) and (y < my < y + bmp.GetHeight()): return self.raceBmps.index(bmp) if self.layout == wx.VERTICAL: y += bmp.GetHeight() + padding @@ -1191,8 +1191,7 @@ class ShipItem(SFItem.SFBrowserItem): def OnShowPopup(self, event): pos = event.GetPosition() pos = self.ScreenToClient(pos) - contexts = [] - contexts.append(("baseShip", "Ship Basic")) + contexts = [("baseShip", "Ship Basic")] menu = ContextMenu.getMenu(self.baseItem, *contexts) self.PopupMenu(menu, pos) @@ -1271,17 +1270,17 @@ class ShipItem(SFItem.SFBrowserItem): self.toolbarx = rect.width - self.toolbar.GetWidth() - self.padding self.toolbary = (rect.height - self.toolbar.GetHeight()) / 2 - self.toolbarx = self.toolbarx + self.animCount + self.toolbarx += self.animCount self.shipEffx = self.padding + (rect.height - self.shipEffBk.GetWidth()) / 2 self.shipEffy = (rect.height - self.shipEffBk.GetHeight()) / 2 - self.shipEffx = self.shipEffx - self.animCount + self.shipEffx -= self.animCount self.shipBmpx = self.padding + (rect.height - self.shipBmp.GetWidth()) / 2 self.shipBmpy = (rect.height - self.shipBmp.GetHeight()) / 2 - self.shipBmpx = self.shipBmpx - self.animCount + self.shipBmpx -= self.animCount self.raceBmpx = self.shipEffx + self.shipEffBk.GetWidth() + self.padding self.raceBmpy = (rect.height - self.raceBmp.GetHeight()) / 2 @@ -1575,7 +1574,7 @@ class FitItem(SFItem.SFBrowserItem): self.mainFrame.additionsPane.select("Command") def OnMouseCaptureLost(self, event): - ''' Destroy drag information (GH issue #479)''' + """ Destroy drag information (GH issue #479)""" if self.dragging and self.dragged: self.dragging = False self.dragged = False @@ -1585,7 +1584,7 @@ class FitItem(SFItem.SFBrowserItem): self.dragWindow = None def OnContextMenu(self, event): - ''' Handles context menu for fit. Dragging is handled by MouseLeftUp() ''' + """ Handles context menu for fit. Dragging is handled by MouseLeftUp() """ sFit = Fit.getInstance() fit = sFit.getFit(self.mainFrame.getActiveFit()) @@ -1815,17 +1814,17 @@ class FitItem(SFItem.SFBrowserItem): self.toolbarx = rect.width - self.toolbar.GetWidth() - self.padding self.toolbary = (rect.height - self.toolbar.GetHeight()) / 2 - self.toolbarx = self.toolbarx + self.animCount + self.toolbarx += self.animCount self.shipEffx = self.padding + (rect.height - self.shipEffBk.GetWidth()) / 2 self.shipEffy = (rect.height - self.shipEffBk.GetHeight()) / 2 - self.shipEffx = self.shipEffx - self.animCount + self.shipEffx -= self.animCount self.shipBmpx = self.padding + (rect.height - self.shipBmp.GetWidth()) / 2 self.shipBmpy = (rect.height - self.shipBmp.GetHeight()) / 2 - self.shipBmpx = self.shipBmpx - self.animCount + self.shipBmpx -= self.animCount self.textStartx = self.shipEffx + self.shipEffBk.GetWidth() + self.padding diff --git a/gui/updateDialog.py b/gui/updateDialog.py index 10d978a1f..019901819 100644 --- a/gui/updateDialog.py +++ b/gui/updateDialog.py @@ -50,7 +50,7 @@ class UpdateDialog(wx.Dialog): versionSizer = wx.BoxSizer(wx.HORIZONTAL) - if (self.releaseInfo['prerelease']): + if self.releaseInfo['prerelease']: self.releaseText = wx.StaticText(self, wx.ID_ANY, "Pre-release", wx.DefaultPosition, wx.DefaultSize, wx.ALIGN_RIGHT) self.releaseText.SetFont(wx.Font(12, 74, 90, 92, False)) @@ -120,7 +120,7 @@ class UpdateDialog(wx.Dialog): self.Close() def SuppressChange(self, e): - if (self.supressCheckbox.IsChecked()): + if self.supressCheckbox.IsChecked(): self.UpdateSettings.set('version', self.releaseInfo['tag_name']) else: self.UpdateSettings.set('version', None) diff --git a/gui/utils/animEffects.py b/gui/utils/animEffects.py index a705374a0..beb1b30aa 100644 --- a/gui/utils/animEffects.py +++ b/gui/utils/animEffects.py @@ -42,7 +42,7 @@ def IN_CUBIC(t, b, c, d): c = float(c) d = float(d) - t = t / d + t /= d return c * t * t * t + b diff --git a/gui/utils/animUtils.py b/gui/utils/animUtils.py index d30375fe2..4003e7760 100644 --- a/gui/utils/animUtils.py +++ b/gui/utils/animUtils.py @@ -60,7 +60,7 @@ class LoadAnimation(wx.Window): barColor = wx.SystemSettings_GetColour(wx.SYS_COLOUR_WINDOWTEXT) shadeColor = colorUtils.GetSuitableColor(barColor, 0.75) - barWidth = (rect.width) / self.bars + barWidth = rect.width / self.bars barHeight = rect.height - self.padding * 2 x = self.padding diff --git a/gui/utils/colorUtils.py b/gui/utils/colorUtils.py index aeeb508c8..d2f10336b 100644 --- a/gui/utils/colorUtils.py +++ b/gui/utils/colorUtils.py @@ -43,7 +43,7 @@ def GetBrightnessO1(color): # Calculates the brightness of a color, different options r, g, b = color - return (0.299 * r + 0.587 * g + 0.114 * b) + return 0.299 * r + 0.587 * g + 0.114 * b def GetBrightnessO2(color): diff --git a/gui/utils/fonts.py b/gui/utils/fonts.py index 359957147..6f8e109d3 100644 --- a/gui/utils/fonts.py +++ b/gui/utils/fonts.py @@ -1,7 +1,7 @@ -''' +""" Font file to handle the differences in font calculations between different wxPython versions -''' +""" # noinspection PyPackageRequirements import wx diff --git a/gui/utils/numberFormatter.py b/gui/utils/numberFormatter.py index cd8140dce..46aaf7d5a 100644 --- a/gui/utils/numberFormatter.py +++ b/gui/utils/numberFormatter.py @@ -67,7 +67,7 @@ def formatAmount(val, prec=3, lowest=0, highest=0, currency=False, forceSign=Fal except IndexError: nextKey = 0 # Check if mantissa with next suffix is in range [1, 1000) - if abs(val) < 10 ** (nextKey) and key >= lowest: + if abs(val) < 10 ** nextKey and key >= lowest: mantissa, suffix = val / float(10 ** key), negSuffixMap[key] # Do additional step to eliminate results like 0.9999 => 1000m # Check if the key we're potentially switching to is greater than our diff --git a/gui/viewColumn.py b/gui/viewColumn.py index 4777999a7..34c3c89ce 100644 --- a/gui/viewColumn.py +++ b/gui/viewColumn.py @@ -22,11 +22,11 @@ import wx class ViewColumn(object): - ''' + """ Abstract class that columns can inherit from. Once the missing methods are correctly implemented, they can be used as columns in a view. - ''' + """ columns = {} def __init__(self, fittingView): diff --git a/service/character.py b/service/character.py index f1d1cf5f8..c5bbc4d02 100644 --- a/service/character.py +++ b/service/character.py @@ -270,7 +270,7 @@ class Character(object): def getSkillLevel(self, charID, skillID): skill = eos.db.getCharacter(charID).getSkill(skillID) - return (skill.level if skill.learned else "Not learned", skill.isDirty) + return skill.level if skill.learned else "Not learned", skill.isDirty def getDirtySkills(self, charID): return eos.db.getCharacter(charID).dirtySkills @@ -304,7 +304,7 @@ class Character(object): chars = json.loads(char.chars) else: chars = None - return (char.apiID or "", char.apiKey or "", char.defaultChar or "", chars or []) + return char.apiID or "", char.apiKey or "", char.defaultChar or "", chars or [] def apiEnabled(self, charID): id_, key, default, _ = self.getApiDetails(charID) diff --git a/service/eveapi.py b/service/eveapi.py index d0bb067a7..89b7ed68e 100644 --- a/service/eveapi.py +++ b/service/eveapi.py @@ -860,10 +860,10 @@ class Rowset(object): self._rows.sort(*args, **kw) def __str__(self): - return ("Rowset(columns=[%s], rows=%d)" % (','.join(self._cols), len(self))) + return "Rowset(columns=[%s], rows=%d)" % (','.join(self._cols), len(self)) def __getstate__(self): - return (self._cols, self._rows) + return self._cols, self._rows def __setstate__(self, state): self._cols, self._rows = state @@ -922,7 +922,7 @@ class IndexRowset(Rowset): self._items[row[self._ki]] = row def __getstate__(self): - return (Rowset.__getstate__(self), self._items, self._ki) + return Rowset.__getstate__(self), self._items, self._ki def __setstate__(self, state): state, self._items, self._ki = state @@ -990,7 +990,7 @@ class FilterRowset(object): return Rowset(self._cols, self._items[i]) def __getstate__(self): - return (self._cols, self._rows, self._items, self.key, self.key2) + return self._cols, self._rows, self._items, self.key, self.key2 def __setstate__(self, state): self._cols, self._rows, self._items, self.key, self.key2 = state diff --git a/service/fit.py b/service/fit.py index 6f6943d37..bafbfea0d 100644 --- a/service/fit.py +++ b/service/fit.py @@ -640,7 +640,7 @@ class Fit(object): total = fit.getNumSlots(fighter.slot) standardAttackActive = False for ability in fighter.abilities: - if (ability.effect.isImplemented and ability.effect.handlerName == u'fighterabilityattackm'): + if ability.effect.isImplemented and ability.effect.handlerName == u'fighterabilityattackm': # Activate "standard attack" if available ability.active = True standardAttackActive = True diff --git a/service/market.py b/service/market.py index e5bc16117..55ddc3ec7 100644 --- a/service/market.py +++ b/service/market.py @@ -322,7 +322,7 @@ class Market(object): "Advanced Cerebral Accelerator" : 977, # Implants & Boosters > Booster "Civilian Damage Control" : 615, # Ship Equipment > Hull & Armor > Damage Controls "Civilian EM Ward Field" : 1695, - # Ship Equipment > Shield > Shield Hardeners > EM Shield Hardeners + # Ship Equipment > Shield > Shield Hardeners > EM Shield Hardeners "Civilian Explosive Deflection Field" : 1694, # Ship Equipment > Shield > Shield Hardeners > Explosive Shield Hardeners "Civilian Hobgoblin" : 837, # Drones > Combat Drones > Light Scout Drones @@ -588,8 +588,8 @@ class Market(object): parents.add(parent) # Check for overrides and add them if any if parent.name in self.ITEMS_FORCEDMETAGROUP_R: - for item in self.ITEMS_FORCEDMETAGROUP_R[parent.name]: - i = self.getItem(item) + for _item in self.ITEMS_FORCEDMETAGROUP_R[parent.name]: + i = self.getItem(_item) if i: variations.add(i) # Add all parents to variations set @@ -766,7 +766,7 @@ class Market(object): overrides = eos.db.getAllOverrides() items = set() for x in overrides: - if (x.item is None): + if x.item is None: eos.db.saveddata_session.delete(x) eos.db.commit() else: diff --git a/service/network.py b/service/network.py index d050e88e2..b191ad57f 100644 --- a/service/network.py +++ b/service/network.py @@ -51,7 +51,7 @@ class TimeoutError(StandardError): pass -class Network(object): +class Network: # Request constants - every request must supply this, as it is checked if # enabled or not via settings ENABLED = 1 diff --git a/service/port.py b/service/port.py index fd347db4f..b76068bcb 100644 --- a/service/port.py +++ b/service/port.py @@ -543,7 +543,7 @@ class Port(object): elif item.category.name == "Fighter": extraAmount = int(extraAmount) if extraAmount is not None else 1 fighterItem = Fighter(item) - if (extraAmount > fighterItem.fighterSquadronMaxSize): # Amount bigger then max fightergroup size + if extraAmount > fighterItem.fighterSquadronMaxSize: # Amount bigger then max fightergroup size extraAmount = fighterItem.fighterSquadronMaxSize if fighterItem.fits(fit): fit.fighters.append(fighterItem) @@ -1092,7 +1092,7 @@ class Port(object): @staticmethod def exportMultiBuy(fit): - export = "%s\n" % (fit.ship.item.name) + export = "%s\n" % fit.ship.item.name stuff = {} sFit = svcFit.getInstance() for module in fit.modules: diff --git a/service/pycrest/weak_ciphers.py b/service/pycrest/weak_ciphers.py index 48da3c909..b18a1a552 100644 --- a/service/pycrest/weak_ciphers.py +++ b/service/pycrest/weak_ciphers.py @@ -109,7 +109,7 @@ class WeakCiphersHTTPSConnectionPool(urllib3.connectionpool.HTTPSConnectionPool) class WeakCiphersPoolManager(urllib3.poolmanager.PoolManager): def _new_pool(self, scheme, host, port): if scheme == 'https': - return WeakCiphersHTTPSConnectionPool(host, port, **(self.connection_pool_kw)) + return WeakCiphersHTTPSConnectionPool(host, port, **self.connection_pool_kw) return super(WeakCiphersPoolManager, self)._new_pool(scheme, host, port) diff --git a/service/server.py b/service/server.py index 5a2bdb564..9fc93f05f 100644 --- a/service/server.py +++ b/service/server.py @@ -97,7 +97,7 @@ class StoppableHTTPServer(BaseHTTPServer.HTTPServer): try: sock, addr = self.socket.accept() sock.settimeout(None) - return (sock, addr) + return sock, addr except socket.timeout: pass diff --git a/service/settings.py b/service/settings.py index 1d5923985..cf4b67b1e 100644 --- a/service/settings.py +++ b/service/settings.py @@ -217,7 +217,7 @@ class NetworkSettings(object): if self.getMode() == self.PROXY_MODE_AUTODETECT: return self.autodetect() if self.getMode() == self.PROXY_MODE_MANUAL: - return (self.getAddress(), int(self.getPort())) + return self.getAddress(), int(self.getPort()) def getProxyAuthDetails(self): if self.getMode() == self.PROXY_MODE_NONE: @@ -225,7 +225,7 @@ class NetworkSettings(object): if (self.serviceNetworkSettings["login"] is None) or (self.serviceNetworkSettings["password"] is None): return None # in all other cases, return tuple of (login, password) - return (self.serviceNetworkSettings["login"], self.serviceNetworkSettings["password"]) + return self.serviceNetworkSettings["login"], self.serviceNetworkSettings["password"] def setProxyAuthDetails(self, login, password): if (login is None) or (password is None): diff --git a/service/update.py b/service/update.py index cbbc4867f..9ae296ad7 100644 --- a/service/update.py +++ b/service/update.py @@ -52,7 +52,7 @@ class CheckUpdateThread(threading.Thread): for release in jsonResponse: # Suppress pre releases - if (release['prerelease'] and self.settings.get('prerelease')): + if release['prerelease'] and self.settings.get('prerelease'): continue # Handle use-case of updating to suppressed version @@ -60,7 +60,7 @@ class CheckUpdateThread(threading.Thread): self.settings.set('version', None) # Suppress version - if (release['tag_name'] == self.settings.get('version')): + if release['tag_name'] == self.settings.get('version'): break # Set the release version that we will be comparing with. diff --git a/setup.py b/setup.py index d32b7120e..d35f69e87 100644 --- a/setup.py +++ b/setup.py @@ -9,7 +9,7 @@ import requests.certs # The modules that contain the bulk of teh source packages = ['eos', 'gui', 'service', 'utils'] # Extra files that will be copied into the root directory -include_files = ['eve.db', 'LICENSE', 'README.md', (requests.certs.where(),'cacert.pem')] +include_files = ['eve.db', 'LICENSE', 'README.md', (requests.certs.where(), 'cacert.pem')] # this is read by dist.py to package the icons icon_dirs = ['gui', 'icons', 'renders'] @@ -26,7 +26,6 @@ if __name__ == "__main__": from cx_Freeze import setup, Executable import config - app_name = 'pyfa' app_version = '{}'.format(config.version) app_description = 'Python fitting assistant' @@ -48,7 +47,6 @@ if __name__ == "__main__": 'initial_target_dir': r'[ProgramFilesFolder]\{}'.format(app_name), } - # Mac-specific options (untested) build_options_macapp = { 'iconfile': 'dist_assets/mac/pyfa.icns', @@ -60,13 +58,12 @@ if __name__ == "__main__": 'applications-shortcut': True, } - # Generic executable options executable_options = { 'script': 'pyfa.py', # Following are windows-specific options, they are stored # on a per-executable basis - 'base': 'Win32GUI' if sys.platform=='win32' else None, + 'base': 'Win32GUI' if sys.platform == 'win32' else None, 'icon': 'dist_assets/win/pyfa.ico', 'shortcutDir': 'DesktopFolder', 'shortcutName': app_name, @@ -76,7 +73,7 @@ if __name__ == "__main__": name=app_name, version=app_version, description=app_description, - options = { + options={ 'build_exe': build_options_winexe, 'bdist_msi': build_options_winmsi, 'bdist_mac': build_options_macapp, diff --git a/tox.ini b/tox.ini index adafb434a..b92d0b45b 100644 --- a/tox.ini +++ b/tox.ini @@ -13,4 +13,4 @@ commands = py.test -vv --cov Pyfa tests/ [testenv:pep8] deps = flake8 # TODO: Remove E731 and convert lambdas to defs -commands = flake8 --exclude=.svn,CVS,.bzr,.hg,.git,__pycache__,venv,tests,.tox,build,dist,__init__.py --ignore=E126,E127,E128,E731 service gui eos utils config.py pyfa.py --max-line-length=165 +commands = flake8 --exclude=.svn,CVS,.bzr,.hg,.git,__pycache__,venv,tests,.tox,build,dist,__init__.py --ignore=E126,E127,E128,E203,E731 service gui eos utils config.py pyfa.py --max-line-length=165 diff --git a/utils/compat.py b/utils/compat.py index 9673d3a77..8dcf8a4d9 100644 --- a/utils/compat.py +++ b/utils/compat.py @@ -13,7 +13,7 @@ except ImportError: class OrderedDict(dict): - 'Dictionary that remembers insertion order' + """Dictionary that remembers insertion order""" # An inherited dict maps keys to values. # The inherited dict provides __getitem__, __len__, __contains__, and get. # The remaining methods are order-aware. @@ -25,11 +25,11 @@ class OrderedDict(dict): # Each link is stored as a list of length three: [PREV, NEXT, KEY]. def __init__(self, *args, **kwds): - '''Initialize an ordered dictionary. Signature is the same as for + """Initialize an ordered dictionary. Signature is the same as for regular dictionaries, but keyword arguments are not recommended because their insertion order is arbitrary. - ''' + """ super(OrderedDict, self).__init__(**kwds) if len(args) > 1: raise TypeError('expected at most 1 arguments, got %d' % len(args)) @@ -42,7 +42,7 @@ class OrderedDict(dict): self.__update(*args, **kwds) def __setitem__(self, key, value, dict_setitem=dict.__setitem__): - 'od.__setitem__(i, y) <==> od[i]=y' + """od.__setitem__(i, y) <==> od[i]=y""" # Setting a new item creates a new link which goes at the end of the linked # list, and the inherited dictionary is updated with the new key/value pair. if key not in self: @@ -52,7 +52,7 @@ class OrderedDict(dict): dict_setitem(self, key, value) def __delitem__(self, key, dict_delitem=dict.__delitem__): - 'od.__delitem__(y) <==> del od[y]' + """od.__delitem__(y) <==> del od[y]""" # Deleting an existing item uses self.__map to find the link which is # then removed by updating the links in the predecessor and successor nodes. dict_delitem(self, key) @@ -61,7 +61,7 @@ class OrderedDict(dict): link_next[0] = link_prev def __iter__(self): - 'od.__iter__() <==> iter(od)' + """od.__iter__() <==> iter(od)""" root = self.__root curr = root[1] while curr is not root: @@ -69,7 +69,7 @@ class OrderedDict(dict): curr = curr[1] def __reversed__(self): - 'od.__reversed__() <==> reversed(od)' + """od.__reversed__() <==> reversed(od)""" root = self.__root curr = root[0] while curr is not root: @@ -77,7 +77,7 @@ class OrderedDict(dict): curr = curr[0] def clear(self): - 'od.clear() -> None. Remove all items from od.' + """od.clear() -> None. Remove all items from od.""" try: for node in self.__map.itervalues(): del node[:] @@ -89,10 +89,10 @@ class OrderedDict(dict): dict.clear(self) def popitem(self, last=True): - '''od.popitem() -> (k, v), return and remove a (key, value) pair. + """od.popitem() -> (k, v), return and remove a (key, value) pair. Pairs are returned in LIFO order if last is true or FIFO order if false. - ''' + """ if not self: raise KeyError('dictionary is empty') root = self.__root @@ -114,40 +114,40 @@ class OrderedDict(dict): # -- the following methods do not depend on the internal structure -- def keys(self): - 'od.keys() -> list of keys in od' + """od.keys() -> list of keys in od""" return list(self) def values(self): - 'od.values() -> list of values in od' + """od.values() -> list of values in od""" return [self[key] for key in self] def items(self): - 'od.items() -> list of (key, value) pairs in od' + """od.items() -> list of (key, value) pairs in od""" return [(key, self[key]) for key in self] def iterkeys(self): - 'od.iterkeys() -> an iterator over the keys in od' + """od.iterkeys() -> an iterator over the keys in od""" return iter(self) def itervalues(self): - 'od.itervalues -> an iterator over the values in od' + """od.itervalues -> an iterator over the values in od""" for k in self: yield self[k] def iteritems(self): - 'od.iteritems -> an iterator over the (key, value) items in od' + """od.iteritems -> an iterator over the (key, value) items in od""" for k in self: yield (k, self[k]) def update(*args, **kwds): - '''od.update(E, **F) -> None. Update od from dict/iterable E and F. + """od.update(E, **F) -> None. Update od from dict/iterable E and F. If E is a dict instance, does: for k in E: od[k] = E[k] If E has a .keys() method, does: for k in E.keys(): od[k] = E[k] Or if E is an iterable of items, does: for k, v in E: od[k] = v In either case, this is followed by: for k, v in F.items(): od[k] = v - ''' + """ if len(args) > 2: raise TypeError('update() takes at most 2 positional ' 'arguments (%d given)' % (len(args),)) @@ -175,10 +175,10 @@ class OrderedDict(dict): __marker = object() def pop(self, key, default=__marker): - '''od.pop(k[,d]) -> v, remove specified key and return the corresponding value. + """od.pop(k[,d]) -> v, remove specified key and return the corresponding value. If key is not found, d is returned if given, otherwise KeyError is raised. - ''' + """ if key in self: result = self[key] del self[key] @@ -188,14 +188,14 @@ class OrderedDict(dict): return default def setdefault(self, key, default=None): - 'od.setdefault(k[,d]) -> od.get(k,d), also set od[k]=d if k not in od' + """od.setdefault(k[,d]) -> od.get(k,d), also set od[k]=d if k not in od""" if key in self: return self[key] self[key] = default return default def __repr__(self, _repr_running=None): - 'od.__repr__() <==> repr(od)' + """od.__repr__() <==> repr(od)""" if _repr_running is None: _repr_running = {} call_key = id(self), _get_ident() @@ -210,35 +210,35 @@ class OrderedDict(dict): del _repr_running[call_key] def __reduce__(self): - 'Return state information for pickling' + """Return state information for pickling""" items = [[k, self[k]] for k in self] inst_dict = vars(self).copy() for k in vars(OrderedDict()): inst_dict.pop(k, None) if inst_dict: - return (self.__class__, (items,), inst_dict) + return self.__class__, (items,), inst_dict return self.__class__, (items,) def copy(self): - 'od.copy() -> a shallow copy of od' + """od.copy() -> a shallow copy of od""" return self.__class__(self) @classmethod def fromkeys(cls, iterable, value=None): - '''OD.fromkeys(S[, v]) -> New ordered dictionary with keys from S + """OD.fromkeys(S[, v]) -> New ordered dictionary with keys from S and values equal to v (which defaults to None). - ''' + """ d = cls() for key in iterable: d[key] = value return d def __eq__(self, other): - '''od.__eq__(y) <==> od==y. Comparison to another OD is order-sensitive + """od.__eq__(y) <==> od==y. Comparison to another OD is order-sensitive while comparison to a regular mapping is order-insensitive. - ''' + """ if isinstance(other, OrderedDict): return len(self) == len(other) and self.items() == other.items() return dict.__eq__(self, other) @@ -249,21 +249,21 @@ class OrderedDict(dict): # -- the following methods are only used in Python 2.7 -- def viewkeys(self): - "od.viewkeys() -> a set-like object providing a view on od's keys" + """od.viewkeys() -> a set-like object providing a view on od's keys""" if KeysView: return KeysView(self) else: return None def viewvalues(self): - "od.viewvalues() -> an object providing a view on od's values" + """od.viewvalues() -> an object providing a view on od's values""" if ValuesView: return ValuesView(self) else: return None def viewitems(self): - "od.viewitems() -> a set-like object providing a view on od's items" + """od.viewitems() -> a set-like object providing a view on od's items""" if ItemsView: return ItemsView(self) else: From 11d7f9d02926f82815aa6f57daaea4fd1125c940 Mon Sep 17 00:00:00 2001 From: Ebag333 Date: Thu, 9 Feb 2017 00:04:41 -0800 Subject: [PATCH 21/52] Make modules static if they do not use self. --- eos/graph/__init__.py | 6 +- eos/graph/fitDps.py | 12 ++- eos/saveddata/booster.py | 3 +- eos/saveddata/fit.py | 6 +- eos/saveddata/implant.py | 3 +- eos/saveddata/module.py | 6 +- gui/PFSearchBox.py | 3 +- gui/builtinContextMenus/amount.py | 3 +- gui/builtinContextMenus/moduleAmmoPicker.py | 6 +- .../pyfaGaugePreferences.py | 3 +- gui/chromeTabs.py | 12 ++- gui/commandView.py | 6 +- gui/crestFittings.py | 3 +- gui/fighterView.py | 3 +- gui/itemStats.py | 9 +- gui/mainFrame.py | 9 +- gui/projectedView.py | 9 +- gui/pygauge.py | 3 +- gui/sfBrowserItem.py | 6 +- gui/shipBrowser.py | 21 +++-- gui/statsPane.py | 3 +- service/attribute.py | 3 +- service/character.py | 93 ++++++++++++------- service/damagePattern.py | 21 +++-- service/fit.py | 51 ++++++---- service/implantSet.py | 30 ++++-- service/market.py | 24 +++-- service/port.py | 12 ++- service/pycrest/eve.py | 3 +- service/targetResists.py | 21 +++-- service/update.py | 6 +- 31 files changed, 266 insertions(+), 133 deletions(-) diff --git a/eos/graph/__init__.py b/eos/graph/__init__.py index 7127afa73..44802171f 100644 --- a/eos/graph/__init__.py +++ b/eos/graph/__init__.py @@ -93,7 +93,8 @@ class Constant(object): def __iter__(self): yield self.value - def isConstant(self): + @staticmethod + def isConstant(): return True @@ -114,5 +115,6 @@ class Range(object): i += 1 yield current - def isConstant(self): + @staticmethod + def isConstant(): return False diff --git a/eos/graph/fitDps.py b/eos/graph/fitDps.py index 7603be598..a13a41cc5 100644 --- a/eos/graph/fitDps.py +++ b/eos/graph/fitDps.py @@ -95,7 +95,8 @@ class FitDpsGraph(Graph): return total - def calculateMissileMultiplier(self, mod, data): + @staticmethod + def calculateMissileMultiplier(mod, data): targetSigRad = data["signatureRadius"] targetVelocity = data["velocity"] explosionRadius = mod.getModifiedChargeAttr("aoeCloudSize") @@ -126,7 +127,8 @@ class FitDpsGraph(Graph): multiplier = min(1, (float(targetSigRad) / dmgScaling) ** 2) return multiplier - def calculateFighterMissileMultiplier(self, ability, data): + @staticmethod + def calculateFighterMissileMultiplier(ability, data): prefix = ability.attrPrefix targetSigRad = data["signatureRadius"] @@ -156,7 +158,8 @@ class FitDpsGraph(Graph): return min(sigRadiusFactor, velocityFactor, 1) - def calculateTurretChanceToHit(self, mod, data): + @staticmethod + def calculateTurretChanceToHit(mod, data): distance = data["distance"] * 1000 tracking = mod.getModifiedItemAttr("trackingSpeed") turretOptimal = mod.maxRange @@ -171,7 +174,8 @@ class FitDpsGraph(Graph): return 0.5 ** (trackingEq + rangeEq) - def calculateModuleMultiplier(self, mod, data): + @staticmethod + def calculateModuleMultiplier(mod, data): # Simplified formula, we make some assumptions about the module # This is basically the calculateTurretChanceToHit without tracking values distance = data["distance"] * 1000 diff --git a/eos/saveddata/booster.py b/eos/saveddata/booster.py index 93f0a4bc3..97a90cde0 100644 --- a/eos/saveddata/booster.py +++ b/eos/saveddata/booster.py @@ -103,7 +103,8 @@ class Booster(HandledItem, ItemAttrShortcut): def item(self): return self.__item - def __calculateSlot(self, item): + @staticmethod + def __calculateSlot(item): if "boosterness" not in item.attributes: raise ValueError("Passed item is not a booster") diff --git a/eos/saveddata/fit.py b/eos/saveddata/fit.py index 359ba6a0f..3b4b7a99f 100644 --- a/eos/saveddata/fit.py +++ b/eos/saveddata/fit.py @@ -796,7 +796,8 @@ class Fit(object): x += 1 return x - def getItemAttrSum(self, dict, attr): + @staticmethod + def getItemAttrSum(dict, attr): amount = 0 for mod in dict: add = mod.getModifiedItemAttr(attr) @@ -805,7 +806,8 @@ class Fit(object): return amount - def getItemAttrOnlineSum(self, dict, attr): + @staticmethod + def getItemAttrOnlineSum(dict, attr): amount = 0 for mod in dict: add = mod.getModifiedItemAttr(attr) if mod.state >= State.ONLINE else None diff --git a/eos/saveddata/implant.py b/eos/saveddata/implant.py index a77190bc4..837642ca6 100644 --- a/eos/saveddata/implant.py +++ b/eos/saveddata/implant.py @@ -78,7 +78,8 @@ class Implant(HandledItem, ItemAttrShortcut): def item(self): return self.__item - def __calculateSlot(self, item): + @staticmethod + def __calculateSlot(item): if "implantness" not in item.attributes: raise ValueError("Passed item is not an implant") diff --git a/eos/saveddata/module.py b/eos/saveddata/module.py index 81e270cb2..993d54765 100644 --- a/eos/saveddata/module.py +++ b/eos/saveddata/module.py @@ -547,7 +547,8 @@ class Module(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut): return validCharges - def __calculateHardpoint(self, item): + @staticmethod + def __calculateHardpoint(item): effectHardpointMap = {"turretFitted": Hardpoint.TURRET, "launcherFitted": Hardpoint.MISSILE} @@ -560,7 +561,8 @@ class Module(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut): return Hardpoint.NONE - def __calculateSlot(self, item): + @staticmethod + def __calculateSlot(item): effectSlotMap = {"rigSlot": Slot.RIG, "loPower": Slot.LOW, "medPower": Slot.MED, diff --git a/gui/PFSearchBox.py b/gui/PFSearchBox.py index 8a5cd369c..f5f8d8c6d 100644 --- a/gui/PFSearchBox.py +++ b/gui/PFSearchBox.py @@ -69,7 +69,8 @@ class PFSearchBox(wx.Window): wx.PostEvent(self, TextEnter()) event.Skip() - def OnEditSetFocus(self, event): + @staticmethod + def OnEditSetFocus(event): # value = self.EditBox.GetValue() # if value == self.descriptiveText: # self.EditBox.ChangeValue("") diff --git a/gui/builtinContextMenus/amount.py b/gui/builtinContextMenus/amount.py index 3d51a1963..95dba33f4 100644 --- a/gui/builtinContextMenus/amount.py +++ b/gui/builtinContextMenus/amount.py @@ -71,7 +71,8 @@ class AmountChanger(wx.Dialog): event.Skip() # checks to make sure it's valid number - def onChar(self, event): + @staticmethod + def onChar(event): key = event.GetKeyCode() acceptable_characters = "1234567890" diff --git a/gui/builtinContextMenus/moduleAmmoPicker.py b/gui/builtinContextMenus/moduleAmmoPicker.py index ef0a8a742..b6791662d 100644 --- a/gui/builtinContextMenus/moduleAmmoPicker.py +++ b/gui/builtinContextMenus/moduleAmmoPicker.py @@ -97,7 +97,8 @@ class ModuleAmmoPicker(ContextMenu): return chargeDamageType, totalDamage - def numericConverter(self, string): + @staticmethod + def numericConverter(string): return int(string) if string.isdigit() else string def nameSorter(self, charge): @@ -118,7 +119,8 @@ class ModuleAmmoPicker(ContextMenu): return item - def addSeperator(self, m, text): + @staticmethod + def addSeperator(m, text): id_ = ContextMenu.nextID() m.Append(id_, u'─ %s ─' % text) m.Enable(id_, False) diff --git a/gui/builtinPreferenceViews/pyfaGaugePreferences.py b/gui/builtinPreferenceViews/pyfaGaugePreferences.py index c7d832a88..5f6509dc0 100644 --- a/gui/builtinPreferenceViews/pyfaGaugePreferences.py +++ b/gui/builtinPreferenceViews/pyfaGaugePreferences.py @@ -426,7 +426,8 @@ class PFGaugePref(PreferenceView): self.SetColours() event.Skip() - def OnOk(self, event): + @staticmethod + def OnOk(event): # Apply New Settings event.Skip() diff --git a/gui/chromeTabs.py b/gui/chromeTabs.py index 600a49950..db4084e52 100644 --- a/gui/chromeTabs.py +++ b/gui/chromeTabs.py @@ -148,7 +148,8 @@ class PFNotebook(wx.Panel): if self.activePage == page: self.ShowActive() - def GetBorders(self): + @staticmethod + def GetBorders(): """Gets border widths to better determine page size in ShowActive()""" bx = wx.SystemSettings_GetMetric(wx.SYS_BORDER_X) @@ -440,7 +441,8 @@ class PFTabRenderer(object): def SetTabImage(self, img): self.tabImg = img - def CopyRegion(self, region): + @staticmethod + def CopyRegion(region): rect = region.GetBox() newRegion = wx.Region(rect.X, rect.Y, rect.Width, rect.Height) @@ -654,7 +656,8 @@ class PFAddRenderer(object): region = wx.RegionFromBitmap(self.tbmp) return region - def CopyRegion(self, region): + @staticmethod + def CopyRegion(region): rect = region.GetBox() newRegion = wx.Region(rect.X, rect.Y, rect.Width, rect.Height) @@ -975,7 +978,8 @@ class PFTabsContainer(wx.Panel): return tab return None - def TabHitTest(self, tab, x, y): + @staticmethod + def TabHitTest(tab, x, y): tabRegion = tab.GetTabRegion() tabPos = tab.GetPosition() tabPosX, tabPosY = tabPos diff --git a/gui/commandView.py b/gui/commandView.py index c47832451..fc0f1de47 100644 --- a/gui/commandView.py +++ b/gui/commandView.py @@ -80,7 +80,8 @@ class CommandView(d.Display): self.Bind(wx.EVT_LIST_BEGIN_DRAG, self.startDrag) self.SetDropTarget(CommandViewDrop(self.handleListDrag)) - def handleListDrag(self, x, y, data): + @staticmethod + def handleListDrag(x, y, data): """ Handles dragging of items from various pyfa displays which support it @@ -120,7 +121,8 @@ class CommandView(d.Display): dropSource.SetData(data) dropSource.DoDragDrop() - def fitSort(self, fit): + @staticmethod + def fitSort(fit): return fit.name def fitChanged(self, event): diff --git a/gui/crestFittings.py b/gui/crestFittings.py index 9eb625d04..181841712 100644 --- a/gui/crestFittings.py +++ b/gui/crestFittings.py @@ -340,7 +340,8 @@ class CrestMgmt(wx.Dialog): self.lcCharacters.SetColumnWidth(0, wx.LIST_AUTOSIZE) self.lcCharacters.SetColumnWidth(1, wx.LIST_AUTOSIZE) - def addChar(self, event): + @staticmethod + def addChar(event): sCrest = Crest.getInstance() uri = sCrest.startServer() webbrowser.open(uri) diff --git a/gui/fighterView.py b/gui/fighterView.py index 79923daa2..292b7fb80 100644 --- a/gui/fighterView.py +++ b/gui/fighterView.py @@ -207,7 +207,8 @@ class FighterDisplay(d.Display): elif data[0] == "market": wx.PostEvent(self.mainFrame, mb.ItemSelected(itemID=int(data[1]))) - def _merge(self, src, dst): + @staticmethod + def _merge(src, dst): return ''' diff --git a/gui/itemStats.py b/gui/itemStats.py index e14ecc27a..a29340d61 100644 --- a/gui/itemStats.py +++ b/gui/itemStats.py @@ -482,7 +482,8 @@ class ItemParams(wx.Panel): self.totalAttrsLabel.SetLabel("%d attributes. " % idCount) self.Layout() - def TranslateValueUnit(self, value, unitName, unitDisplayName): + @staticmethod + def TranslateValueUnit(value, unitName, unitDisplayName): def itemIDCallback(): item = Market.getInstance().getItem(value) return "%s (%d)" % (item.name, value) if item is not None else str(value) @@ -674,7 +675,8 @@ class ItemCompare(wx.Panel): self.paramList.RefreshRows() self.Layout() - def TranslateValueUnit(self, value, unitName, unitDisplayName): + @staticmethod + def TranslateValueUnit(value, unitName, unitDisplayName): def itemIDCallback(): item = Market.getInstance().getItem(value) return "%s (%d)" % (item.name, value) if item is not None else str(value) @@ -840,7 +842,8 @@ class ItemEffects(wx.Panel): self.RefreshValues(event) - def OnRightClick(self, event): + @staticmethod + def OnRightClick(event): """ Debug use: open effect file with default application. If effect file does not exist, create it diff --git a/gui/mainFrame.py b/gui/mainFrame.py index ec8845884..175e14ab2 100644 --- a/gui/mainFrame.py +++ b/gui/mainFrame.py @@ -442,13 +442,16 @@ class MainFrame(wx.Frame): dlg = PreferenceDialog(self) dlg.ShowModal() - def goWiki(self, event): + @staticmethod + def goWiki(event): webbrowser.open('https://github.com/pyfa-org/Pyfa/wiki') - def goForums(self, event): + @staticmethod + def goForums(event): webbrowser.open('https://forums.eveonline.com/default.aspx?g=posts&t=466425') - def loadDatabaseDefaults(self, event): + @staticmethod + def loadDatabaseDefaults(event): # Import values that must exist otherwise Pyfa breaks DefaultDatabaseValues.importRequiredDefaults() # Import default values for damage profiles diff --git a/gui/projectedView.py b/gui/projectedView.py index 40cde2e3b..2447438d9 100644 --- a/gui/projectedView.py +++ b/gui/projectedView.py @@ -148,10 +148,12 @@ class ProjectedView(d.Display): if sFit.mergeDrones(fitID, self.get(src), dstDrone, True): wx.PostEvent(self.mainFrame, GE.FitChanged(fitID=fitID)) - def moduleSort(self, module): + @staticmethod + def moduleSort(module): return module.item.name - def fighterSort(self, fighter): + @staticmethod + def fighterSort(fighter): return fighter.item.name def droneSort(self, drone): @@ -162,7 +164,8 @@ class ProjectedView(d.Display): return (self.droneView.DRONE_ORDER.index(item.marketGroup.name), drone.item.name) - def fitSort(self, fit): + @staticmethod + def fitSort(fit): return fit.name def fitChanged(self, event): diff --git a/gui/pygauge.py b/gui/pygauge.py index 3020bd2e7..6287bbdf6 100644 --- a/gui/pygauge.py +++ b/gui/pygauge.py @@ -264,7 +264,8 @@ class PyGauge(wx.PyWindow): self.Animate() self._tooltip.SetTip("%.2f/%.2f" % (self._value, self._range if self._range > 0.01 else 0)) - def OnEraseBackground(self, event): + @staticmethod + def OnEraseBackground(event): """ Handles the ``wx.EVT_ERASE_BACKGROUND`` event for L{PyGauge}. diff --git a/gui/sfBrowserItem.py b/gui/sfBrowserItem.py index 471ef04c4..6ecdb0f9a 100644 --- a/gui/sfBrowserItem.py +++ b/gui/sfBrowserItem.py @@ -197,7 +197,8 @@ class PFToolbar(object): return height - def HitTest(self, target, position, area): + @staticmethod + def HitTest(target, position, area): x, y = target px, py = position aX, aY = area @@ -355,7 +356,8 @@ class SFBrowserItem(wx.Window): event.Skip() - def GetType(self): + @staticmethod + def GetType(): return -1 def SetSelected(self, select=True): diff --git a/gui/shipBrowser.py b/gui/shipBrowser.py index d91077176..90b624a41 100644 --- a/gui/shipBrowser.py +++ b/gui/shipBrowser.py @@ -458,7 +458,8 @@ class NavigationPanel(SFItem.SFBrowserItem): stage, data = self.shipBrowser.browseHist.pop() self.gotoStage(stage, data) - def AdjustChannels(self, bitmap): + @staticmethod + def AdjustChannels(bitmap): img = wx.ImageFromBitmap(bitmap) img = img.AdjustChannels(1.05, 1.05, 1.05, 1) return wx.BitmapFromImage(img) @@ -800,7 +801,8 @@ class ShipBrowser(wx.Panel): self.navpanel.ShowNewFitButton(False) self.navpanel.ShowSwitchEmptyGroupsButton(True) - def nameKey(self, info): + @staticmethod + def nameKey(info): return info[1] def stage3(self, event): @@ -972,7 +974,8 @@ class PFStaticText(wx.Panel): self.SetSizer(mainSizer) self.Layout() - def GetType(self): + @staticmethod + def GetType(): return -1 @@ -1031,7 +1034,8 @@ class CategoryItem(SFItem.SFBrowserItem): self.animTimer.Stop() self.Refresh() - def OUT_QUAD(self, t, b, c, d): + @staticmethod + def OUT_QUAD(t, b, c, d): t = float(t) b = float(b) c = float(c) @@ -1204,7 +1208,8 @@ class ShipItem(SFItem.SFBrowserItem): self.animTimer.Stop() self.Refresh() - def OUT_QUAD(self, t, b, c, d): + @staticmethod + def OUT_QUAD(t, b, c, d): t = float(t) b = float(b) c = float(c) @@ -1644,10 +1649,12 @@ class FitItem(SFItem.SFBrowserItem): self.animTimer.Stop() self.Refresh() - def CalculateDelta(self, start, end, delta): + @staticmethod + def CalculateDelta(start, end, delta): return start + (end - start) * delta - def OUT_QUAD(self, t, b, c, d): + @staticmethod + def OUT_QUAD(t, b, c, d): t = float(t) b = float(b) c = float(c) diff --git a/gui/statsPane.py b/gui/statsPane.py index f1ea90e22..6aaf277f5 100644 --- a/gui/statsPane.py +++ b/gui/statsPane.py @@ -93,7 +93,8 @@ class StatsPane(wx.Panel): self.mainFrame = gui.mainFrame.MainFrame.getInstance() self.mainFrame.Bind(GE.FIT_CHANGED, self.fitChanged) - def contextHandler(self, contentPanel): + @staticmethod + def contextHandler(contentPanel): viewName = contentPanel.viewName def handler(event): diff --git a/service/attribute.py b/service/attribute.py index 68b998f07..5b010bcc5 100644 --- a/service/attribute.py +++ b/service/attribute.py @@ -30,7 +30,8 @@ class Attribute(object): return cls.instance - def getAttributeInfo(self, identity): + @staticmethod + def getAttributeInfo(identity): if isinstance(identity, (int, basestring)): info = eos.db.getAttributeInfo(identity, eager=("icon", "unit")) elif isinstance(identity, (int, float)): diff --git a/service/character.py b/service/character.py index c5bbc4d02..830eb5d57 100644 --- a/service/character.py +++ b/service/character.py @@ -190,33 +190,40 @@ class Character(object): return prettydata - def backupSkills(self, path, saveFmt, activeFit, callback): + @staticmethod + def backupSkills(path, saveFmt, activeFit, callback): thread = SkillBackupThread(path, saveFmt, activeFit, callback) thread.start() - def importCharacter(self, path, callback): + @staticmethod + def importCharacter(path, callback): thread = CharacterImportThread(path, callback) thread.start() - def all0(self): + @staticmethod + def all0(): return es_Character.getAll0() def all0ID(self): return self.all0().ID - def all5(self): + @staticmethod + def all5(): return es_Character.getAll5() def all5ID(self): return self.all5().ID - def getAlphaCloneList(self): + @staticmethod + def getAlphaCloneList(): return eos.db.getAlphaCloneList() - def getCharacterList(self): + @staticmethod + def getCharacterList(): return eos.db.getCharacterList() - def getCharacter(self, charID): + @staticmethod + def getCharacter(charID): char = eos.db.getCharacter(charID) return char @@ -227,7 +234,8 @@ class Character(object): char = eos.db.getCharacter(charID) char.saveLevels() - def saveCharacterAs(self, charID, newName): + @staticmethod + def saveCharacterAs(charID, newName): """Save edited skills as a new character""" char = eos.db.getCharacter(charID) newChar = copy.deepcopy(char) @@ -237,12 +245,14 @@ class Character(object): # revert old char char.revertLevels() - def revertCharacter(self, charID): + @staticmethod + def revertCharacter(charID): """Rollback edited skills""" char = eos.db.getCharacter(charID) char.revertLevels() - def getSkillGroups(self): + @staticmethod + def getSkillGroups(): cat = eos.db.getCategory(16) groups = [] for grp in cat.groups: @@ -250,7 +260,8 @@ class Character(object): groups.append((grp.ID, grp.name)) return groups - def getSkills(self, groupID): + @staticmethod + def getSkills(groupID): group = eos.db.getGroup(groupID) skills = [] for skill in group.items: @@ -258,47 +269,58 @@ class Character(object): skills.append((skill.ID, skill.name)) return skills - def setAlphaClone(self, char, cloneID): + @staticmethod + def setAlphaClone(char, cloneID): char.alphaCloneID = cloneID eos.db.commit() - def getSkillDescription(self, itemID): + @staticmethod + def getSkillDescription(itemID): return eos.db.getItem(itemID).description - def getGroupDescription(self, groupID): + @staticmethod + def getGroupDescription(groupID): return eos.db.getMarketGroup(groupID).description - def getSkillLevel(self, charID, skillID): + @staticmethod + def getSkillLevel(charID, skillID): skill = eos.db.getCharacter(charID).getSkill(skillID) return skill.level if skill.learned else "Not learned", skill.isDirty - def getDirtySkills(self, charID): + @staticmethod + def getDirtySkills(charID): return eos.db.getCharacter(charID).dirtySkills - def getCharName(self, charID): + @staticmethod + def getCharName(charID): return eos.db.getCharacter(charID).name - def new(self, name="New Character"): + @staticmethod + def new(name="New Character"): char = es_Character(name) eos.db.save(char) return char - def rename(self, char, newName): + @staticmethod + def rename(char, newName): if char.name in ("All 0", "All 5"): logger.info("Cannot rename built in characters.") else: char.name = newName eos.db.commit() - def copy(self, char): + @staticmethod + def copy(char): newChar = copy.deepcopy(char) eos.db.save(newChar) return newChar - def delete(self, char): + @staticmethod + def delete(char): eos.db.remove(char) - def getApiDetails(self, charID): + @staticmethod + def getApiDetails(charID): char = eos.db.getCharacter(charID) if char.chars is not None: chars = json.loads(char.chars) @@ -310,7 +332,8 @@ class Character(object): id_, key, default, _ = self.getApiDetails(charID) return id_ is not "" and key is not "" and default is not "" - def apiCharList(self, charID, userID, apiKey): + @staticmethod + def apiCharList(charID, userID, apiKey): char = eos.db.getCharacter(charID) char.apiID = userID @@ -324,7 +347,8 @@ class Character(object): char.chars = json.dumps(charList) return charList - def apiFetch(self, charID, charName): + @staticmethod + def apiFetch(charID, charName): dbChar = eos.db.getCharacter(charID) dbChar.defaultChar = charName @@ -344,12 +368,14 @@ class Character(object): dbChar.apiUpdateCharSheet(sheet.skills) eos.db.commit() - def apiUpdateCharSheet(self, charID, skills): + @staticmethod + def apiUpdateCharSheet(charID, skills): char = eos.db.getCharacter(charID) char.apiUpdateCharSheet(skills) eos.db.commit() - def changeLevel(self, charID, skillID, level, persist=False): + @staticmethod + def changeLevel(charID, skillID, level, persist=False): char = eos.db.getCharacter(charID) skill = char.getSkill(skillID) if isinstance(level, basestring) or level > 5 or level < 0: @@ -362,17 +388,20 @@ class Character(object): eos.db.commit() - def revertLevel(self, charID, skillID): + @staticmethod + def revertLevel(charID, skillID): char = eos.db.getCharacter(charID) skill = char.getSkill(skillID) skill.revert() - def saveSkill(self, charID, skillID): + @staticmethod + def saveSkill(charID, skillID): char = eos.db.getCharacter(charID) skill = char.getSkill(skillID) skill.saveLevel() - def addImplant(self, charID, itemID): + @staticmethod + def addImplant(charID, itemID): char = eos.db.getCharacter(charID) if char.ro: logger.error("Trying to add implant to read-only character") @@ -382,12 +411,14 @@ class Character(object): char.implants.append(implant) eos.db.commit() - def removeImplant(self, charID, implant): + @staticmethod + def removeImplant(charID, implant): char = eos.db.getCharacter(charID) char.implants.remove(implant) eos.db.commit() - def getImplants(self, charID): + @staticmethod + def getImplants(charID): char = eos.db.getCharacter(charID) return char.implants diff --git a/service/damagePattern.py b/service/damagePattern.py index 21536e53e..5a169734c 100644 --- a/service/damagePattern.py +++ b/service/damagePattern.py @@ -37,31 +37,38 @@ class DamagePattern(object): return cls.instance - def getDamagePatternList(self): + @staticmethod + def getDamagePatternList(): return eos.db.getDamagePatternList() - def getDamagePattern(self, name): + @staticmethod + def getDamagePattern(name): return eos.db.getDamagePattern(name) - def newPattern(self, name): + @staticmethod + def newPattern(name): p = es_DamagePattern(0, 0, 0, 0) p.name = name eos.db.save(p) return p - def renamePattern(self, p, newName): + @staticmethod + def renamePattern(p, newName): p.name = newName eos.db.save(p) - def deletePattern(self, p): + @staticmethod + def deletePattern(p): eos.db.remove(p) - def copyPattern(self, p): + @staticmethod + def copyPattern(p): newP = copy.deepcopy(p) eos.db.save(newP) return newP - def saveChanges(self, p): + @staticmethod + def saveChanges(p): eos.db.save(p) def importPatterns(self, text): diff --git a/service/fit.py b/service/fit.py index bafbfea0d..dec2ae647 100644 --- a/service/fit.py +++ b/service/fit.py @@ -75,11 +75,13 @@ class Fit(object): self.serviceFittingOptions = SettingsProvider.getInstance().getSettings( "pyfaServiceFittingOptions", serviceFittingDefaultOptions) - def getAllFits(self): + @staticmethod + def getAllFits(): fits = eos.db.getFitList() return fits - def getFitsWithShip(self, shipID): + @staticmethod + def getFitsWithShip(shipID): """ Lists fits of shipID, used with shipBrowser """ fits = eos.db.getFitsWithShip(shipID) names = [] @@ -88,7 +90,8 @@ class Fit(object): return names - def getBoosterFits(self): + @staticmethod + def getBoosterFits(): """ Lists fits flagged as booster """ fits = eos.db.getBoosterFits() names = [] @@ -97,14 +100,17 @@ class Fit(object): return names - def countAllFits(self): + @staticmethod + def countAllFits(): return eos.db.countAllFits() - def countFitsWithShip(self, stuff): + @staticmethod + def countFitsWithShip(stuff): count = eos.db.countFitsWithShip(stuff) return count - def getModule(self, fitID, pos): + @staticmethod + def getModule(fitID, pos): fit = eos.db.getFit(fitID) return fit.modules[pos] @@ -123,17 +129,20 @@ class Fit(object): self.recalc(fit) return fit.ID - def toggleBoostFit(self, fitID): + @staticmethod + def toggleBoostFit(fitID): fit = eos.db.getFit(fitID) fit.booster = not fit.booster eos.db.commit() - def renameFit(self, fitID, newName): + @staticmethod + def renameFit(fitID, newName): fit = eos.db.getFit(fitID) fit.name = newName eos.db.commit() - def deleteFit(self, fitID): + @staticmethod + def deleteFit(fitID): fit = eos.db.getFit(fitID) eos.db.remove(fit) @@ -144,13 +153,15 @@ class Fit(object): if projection.victim_fit in eos.db.saveddata_session: # GH issue #359 eos.db.saveddata_session.refresh(projection.victim_fit) - def copyFit(self, fitID): + @staticmethod + def copyFit(fitID): fit = eos.db.getFit(fitID) newFit = copy.deepcopy(fit) eos.db.save(newFit) return newFit.ID - def clearFit(self, fitID): + @staticmethod + def clearFit(fitID): if fitID is None: return None @@ -214,7 +225,8 @@ class Fit(object): fit.inited = True return fit - def searchFits(self, name): + @staticmethod + def searchFits(name): results = eos.db.searchFits(name) fits = [] for fit in results: @@ -539,7 +551,8 @@ class Fit(object): eos.db.commit() self.recalc(fit) - def swapModules(self, fitID, src, dst): + @staticmethod + def swapModules(fitID, src, dst): fit = eos.db.getFit(fitID) # Gather modules srcMod = fit.modules[src] @@ -720,7 +733,8 @@ class Fit(object): self.recalc(fit) return True - def splitDrones(self, fit, d, amount, l): + @staticmethod + def splitDrones(fit, d, amount, l): total = d.amount active = d.amountActive > 0 d.amount = amount @@ -824,7 +838,8 @@ class Fit(object): fit.character = self.character = eos.db.getCharacter(charID) self.recalc(fit) - def isAmmo(self, itemID): + @staticmethod + def isAmmo(itemID): return eos.db.getItem(itemID).category.name == "Charge" def setAmmo(self, fitID, ammoID, modules): @@ -840,7 +855,8 @@ class Fit(object): self.recalc(fit) - def getTargetResists(self, fitID): + @staticmethod + def getTargetResists(fitID): if fitID is None: return @@ -857,7 +873,8 @@ class Fit(object): self.recalc(fit) - def getDamagePattern(self, fitID): + @staticmethod + def getDamagePattern(fitID): if fitID is None: return diff --git a/service/implantSet.py b/service/implantSet.py index f1da65aed..8d86c816d 100644 --- a/service/implantSet.py +++ b/service/implantSet.py @@ -39,44 +39,54 @@ class ImplantSets(object): return cls.instance - def getImplantSetList(self): + @staticmethod + def getImplantSetList(): return eos.db.getImplantSetList(None) - def getImplantSet(self, name): + @staticmethod + def getImplantSet(name): return eos.db.getImplantSet(name) - def getImplants(self, setID): + @staticmethod + def getImplants(setID): return eos.db.getImplantSet(setID).implants - def addImplant(self, setID, itemID): + @staticmethod + def addImplant(setID, itemID): implant_set = eos.db.getImplantSet(setID) implant = es_Implant(eos.db.getItem(itemID)) implant_set.implants.append(implant) eos.db.commit() - def removeImplant(self, setID, implant): + @staticmethod + def removeImplant(setID, implant): eos.db.getImplantSet(setID).implants.remove(implant) eos.db.commit() - def newSet(self, name): + @staticmethod + def newSet(name): implant_set = es_ImplantSet() implant_set.name = name eos.db.save(implant_set) return implant_set - def renameSet(self, implant_set, newName): + @staticmethod + def renameSet(implant_set, newName): implant_set.name = newName eos.db.save(implant_set) - def deleteSet(self, implant_set): + @staticmethod + def deleteSet(implant_set): eos.db.remove(implant_set) - def copySet(self, implant_set): + @staticmethod + def copySet(implant_set): newS = copy.deepcopy(implant_set) eos.db.save(newS) return newS - def saveChanges(self, implant_set): + @staticmethod + def saveChanges(implant_set): eos.db.save(implant_set) def importSets(self, text): diff --git a/service/market.py b/service/market.py index 55ddc3ec7..8a2abb107 100644 --- a/service/market.py +++ b/service/market.py @@ -410,7 +410,8 @@ class Market(object): cls.instance = Market() return cls.instance - def __makeRevDict(self, orig): + @staticmethod + def __makeRevDict(orig): """Creates reverse dictionary""" rev = {} for item, value in orig.items(): @@ -419,7 +420,8 @@ class Market(object): rev[value].add(item) return rev - def getItem(self, identity, *args, **kwargs): + @staticmethod + def getItem(identity, *args, **kwargs): """Get item by its ID or name""" try: if isinstance(identity, types_Item): @@ -461,7 +463,8 @@ class Market(object): else: raise TypeError("Need Group object, integer, float or string as argument") - def getCategory(self, identity, *args, **kwargs): + @staticmethod + def getCategory(identity, *args, **kwargs): """Get category by its ID or name""" if isinstance(identity, types_Category): category = identity @@ -474,7 +477,8 @@ class Market(object): raise TypeError("Need Category object, integer, float or string as argument") return category - def getMetaGroup(self, identity, *args, **kwargs): + @staticmethod + def getMetaGroup(identity, *args, **kwargs): """Get meta group by its ID or name""" if isinstance(identity, types_MetaGroup): metaGroup = identity @@ -487,7 +491,8 @@ class Market(object): raise TypeError("Need MetaGroup object, integer, float or string as argument") return metaGroup - def getMarketGroup(self, identity, *args, **kwargs): + @staticmethod + def getMarketGroup(identity, *args, **kwargs): """Get market group by its ID""" if isinstance(identity, types_MarketGroup): marketGroup = identity @@ -605,7 +610,8 @@ class Market(object): return groups - def getMarketGroupChildren(self, mg): + @staticmethod + def getMarketGroupChildren(mg): """Get the children marketGroups of marketGroup.""" children = set() for child in mg.children: @@ -762,7 +768,8 @@ class Market(object): """Find items according to given text pattern""" self.searchWorkerThread.scheduleSearch(name, callback, filterOn) - def getItemsWithOverrides(self): + @staticmethod + def getItemsWithOverrides(): overrides = eos.db.getAllOverrides() items = set() for x in overrides: @@ -773,7 +780,8 @@ class Market(object): items.add(x.item) return list(items) - def directAttrRequest(self, items, attribs): + @staticmethod + def directAttrRequest(items, attribs): try: itemIDs = tuple(map(lambda i: i.ID, items)) except TypeError: diff --git a/service/port.py b/service/port.py index b76068bcb..5a6b53fb5 100644 --- a/service/port.py +++ b/service/port.py @@ -81,15 +81,18 @@ class Port(object): return cls.instance - def backupFits(self, path, callback): + @staticmethod + def backupFits(path, callback): thread = FitBackupThread(path, callback) thread.start() - def importFitsThreaded(self, paths, callback): + @staticmethod + def importFitsThreaded(paths, callback): thread = FitImportThread(paths, callback) thread.start() - def importFitFromFiles(self, paths, callback=None): + @staticmethod + def importFitFromFiles(paths, callback=None): """ Imports fits from file(s). First processes all provided paths and stores assembled fits into a list. This allows us to call back to the GUI as @@ -185,7 +188,8 @@ class Port(object): return True, fits - def importFitFromBuffer(self, bufferStr, activeFit=None): + @staticmethod + def importFitFromBuffer(bufferStr, activeFit=None): sFit = svcFit.getInstance() _, fits = Port.importAuto(bufferStr, activeFit=activeFit) for fit in fits: diff --git a/service/pycrest/eve.py b/service/pycrest/eve.py index cd5a82f8c..56b353ad4 100644 --- a/service/pycrest/eve.py +++ b/service/pycrest/eve.py @@ -161,7 +161,8 @@ class APIConnection(object): return ret - def _get_expires(self, response): + @staticmethod + def _get_expires(response): if 'Cache-Control' not in response.headers: return 0 if any([s in response.headers['Cache-Control'] for s in ['no-cache', 'no-store']]): diff --git a/service/targetResists.py b/service/targetResists.py index 2a4863c5d..06df8c8c6 100644 --- a/service/targetResists.py +++ b/service/targetResists.py @@ -37,31 +37,38 @@ class TargetResists(object): return cls.instance - def getTargetResistsList(self): + @staticmethod + def getTargetResistsList(): return db.getTargetResistsList() - def getTargetResists(self, name): + @staticmethod + def getTargetResists(name): return db.getTargetResists(name) - def newPattern(self, name): + @staticmethod + def newPattern(name): p = es_TargetResists(0.0, 0.0, 0.0, 0.0) p.name = name db.save(p) return p - def renamePattern(self, p, newName): + @staticmethod + def renamePattern(p, newName): p.name = newName db.save(p) - def deletePattern(self, p): + @staticmethod + def deletePattern(p): db.remove(p) - def copyPattern(self, p): + @staticmethod + def copyPattern(p): newP = copy.deepcopy(p) db.save(newP) return newP - def saveChanges(self, p): + @staticmethod + def saveChanges(p): db.save(p) def importPatterns(self, text): diff --git a/service/update.py b/service/update.py index 9ae296ad7..969c78432 100644 --- a/service/update.py +++ b/service/update.py @@ -85,14 +85,16 @@ class CheckUpdateThread(threading.Thread): except: pass - def versiontuple(self, v): + @staticmethod + def versiontuple(v): return tuple(map(int, (v.split(".")))) class Update(object): instance = None - def CheckUpdate(self, callback): + @staticmethod + def CheckUpdate(callback): thread = CheckUpdateThread(callback) thread.start() From f61aeb8285516239bdc4665cdd1d2107ebc4283b Mon Sep 17 00:00:00 2001 From: Ebag333 Date: Thu, 9 Feb 2017 00:18:19 -0800 Subject: [PATCH 22/52] Fix bug where the toggle button the compare pane didn't do anything. (Need to check toggleView because you can hit both first and second if otherwise.) --- gui/itemStats.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gui/itemStats.py b/gui/itemStats.py index a29340d61..0823ce7ff 100644 --- a/gui/itemStats.py +++ b/gui/itemStats.py @@ -665,7 +665,7 @@ class ItemCompare(wx.Panel): value = item.attributes[attr].value if self.toggleView != 1: valueUnit = str(value) - if info and info.unit: + elif info and info.unit and self.toggleView == 1: valueUnit = self.TranslateValueUnit(value, info.unit.displayName, info.unit.name) else: valueUnit = formatAmount(value, 3, 0, 0) From f2c84692a98bc1f68982dedbac6afa62cc335fe9 Mon Sep 17 00:00:00 2001 From: Ebag333 Date: Thu, 9 Feb 2017 00:22:14 -0800 Subject: [PATCH 23/52] Clean up a bunch of unused variables --- eos/gamedata.py | 2 +- gui/PFListPane.py | 2 -- gui/builtinContextMenus/amount.py | 1 - gui/builtinViews/fittingView.py | 4 +--- gui/characterEditor.py | 4 ++-- gui/chromeTabs.py | 4 +--- gui/pygauge.py | 2 -- gui/sfBrowserItem.py | 1 - gui/shipBrowser.py | 3 --- 9 files changed, 5 insertions(+), 18 deletions(-) diff --git a/eos/gamedata.py b/eos/gamedata.py index 10317dab2..ce32d3ab7 100644 --- a/eos/gamedata.py +++ b/eos/gamedata.py @@ -179,7 +179,7 @@ class Effect(EqBase): t = t if isinstance(t, tuple) or t is None else (t,) self.__type = t - except (ImportError, AttributeError) as e: + except (ImportError, AttributeError): self.__handler = effectDummy self.__runTime = "normal" self.__activeByDefault = True diff --git a/gui/PFListPane.py b/gui/PFListPane.py index 2c0b35d16..e6689ce8d 100644 --- a/gui/PFListPane.py +++ b/gui/PFListPane.py @@ -144,10 +144,8 @@ class PFListPane(wx.ScrolledWindow): elif doFocus: self.SetFocus() - clientW, clientH = self.GetSize() for i in xrange(len(self._wList)): iwidth, iheight = self._wList[i].GetSize() - itemX, itemY = self._wList[i].GetPosition() self._wList[i].SetSize((cwidth, iheight)) if doRefresh is True: self._wList[i].Refresh() diff --git a/gui/builtinContextMenus/amount.py b/gui/builtinContextMenus/amount.py index 95dba33f4..12d483243 100644 --- a/gui/builtinContextMenus/amount.py +++ b/gui/builtinContextMenus/amount.py @@ -50,7 +50,6 @@ class AmountChanger(wx.Dialog): self.button.Bind(wx.EVT_BUTTON, self.change) def change(self, event): - sFit = Fit.getInstance() if self.input.GetLineText(0).strip() == '': event.Skip() return diff --git a/gui/builtinViews/fittingView.py b/gui/builtinViews/fittingView.py index bcaa15aa7..02a5ae6c0 100644 --- a/gui/builtinViews/fittingView.py +++ b/gui/builtinViews/fittingView.py @@ -681,7 +681,6 @@ class FittingView(d.Display): isize = 16 headerSize = max(isize, tdc.GetTextExtent("W")[0]) + padding * 2 - maxWidth = 0 maxRowHeight = isize rows = 0 for st in self.mods: @@ -775,8 +774,7 @@ class FittingView(d.Display): bmp = col.bitmap opts.m_labelBitmap = bmp - width = render.DrawHeaderButton(self, mdc, (cx, padding, columnsWidths[i], headerSize), wx.CONTROL_CURRENT, - sortArrow=wx.HDR_SORT_ICON_NONE, params=opts) + render.DrawHeaderButton(self, mdc, (cx, padding, columnsWidths[i], headerSize), wx.CONTROL_CURRENT, sortArrow=wx.HDR_SORT_ICON_NONE, params=opts) cx += columnsWidths[i] diff --git a/gui/characterEditor.py b/gui/characterEditor.py index 37855e46c..1c7044f3e 100644 --- a/gui/characterEditor.py +++ b/gui/characterEditor.py @@ -628,9 +628,9 @@ class APIView(wx.Panel): try: activeChar = self.charEditor.entityEditor.getActiveEntity() list = sChar.apiCharList(activeChar.ID, self.inputID.GetLineText(0), self.inputKey.GetLineText(0)) - except AuthenticationError, e: + except AuthenticationError: self.stStatus.SetLabel("Authentication failure. Please check keyID and vCode combination.") - except TimeoutError, e: + except TimeoutError: self.stStatus.SetLabel("Request timed out. Please check network connectivity and/or proxy settings.") except Exception, e: self.stStatus.SetLabel("Error:\n%s" % e.message) diff --git a/gui/chromeTabs.py b/gui/chromeTabs.py index db4084e52..d4b50b713 100644 --- a/gui/chromeTabs.py +++ b/gui/chromeTabs.py @@ -1123,8 +1123,6 @@ class PFTabsContainer(wx.Panel): else: mdc = wx.BufferedPaintDC(self) - selected = 0 - if 'wxMac' in wx.PlatformInfo and wx.VERSION < (3, 0): color = wx.Colour(0, 0, 0) brush = wx.Brush(color) @@ -1260,7 +1258,7 @@ class PFTabsContainer(wx.Panel): if self.tabMinWidth < 1: self.tabMinWidth = 1 for tab in self.tabs: - w, h = tab.GetSize() + tab.GetSize() tab.SetSize((self.tabMinWidth, self.height)) if self.GetTabsCount() > 0: diff --git a/gui/pygauge.py b/gui/pygauge.py index 6287bbdf6..dbb0c4531 100644 --- a/gui/pygauge.py +++ b/gui/pygauge.py @@ -323,8 +323,6 @@ class PyGauge(wx.PyWindow): # time on them if not needed. See GH issue #282 pv = value - xv = 1 - transition = 0 if pv <= 100: xv = pv / 100 diff --git a/gui/sfBrowserItem.py b/gui/sfBrowserItem.py index 6ecdb0f9a..de9eb4001 100644 --- a/gui/sfBrowserItem.py +++ b/gui/sfBrowserItem.py @@ -137,7 +137,6 @@ class PFToolbar(object): return doRefresh def MouseClick(self, event): - mx, my = event.GetPosition() bx = self.toolbarX for button in self.buttons: if not button.IsVisible(): diff --git a/gui/shipBrowser.py b/gui/shipBrowser.py index 90b624a41..6ccc1059b 100644 --- a/gui/shipBrowser.py +++ b/gui/shipBrowser.py @@ -629,7 +629,6 @@ class ShipBrowser(wx.Panel): event.Skip() def SizeRefreshList(self, event): - ewidth, eheight = event.GetSize() self.Layout() self.lpane.Layout() self.lpane.RefreshList(True) @@ -1871,8 +1870,6 @@ class FitItem(SFItem.SFBrowserItem): mdc.DrawBitmap(self.shipBmp, self.shipBmpx, self.shipBmpy, 0) - shipName, shipTrait, fittings, booster, timestamp = self.shipFittingInfo - mdc.SetFont(self.fontNormal) fitDate = time.localtime(self.timestamp) From 7865219164f35cbc9a4e0fceb26667bcc232967a Mon Sep 17 00:00:00 2001 From: Ebag333 Date: Thu, 9 Feb 2017 00:56:33 -0800 Subject: [PATCH 24/52] Add a ton of default values --- eos/db/saveddata/databaseRepair.py | 3 ++- eos/db/saveddata/fit.py | 6 +++++ eos/effectHandlerHelpers.py | 4 +++ eos/eqBase.py | 2 ++ eos/gamedata.py | 37 +++++++++++++++++++++++--- eos/saveddata/character.py | 4 +++ eos/saveddata/crestchar.py | 3 +++ eos/saveddata/damagePattern.py | 3 +++ eos/saveddata/fighter.py | 1 + eos/saveddata/fighterAbility.py | 1 + eos/saveddata/fit.py | 12 +++++++++ eos/saveddata/implant.py | 2 ++ eos/saveddata/module.py | 2 ++ eos/saveddata/override.py | 2 ++ eos/saveddata/targetResists.py | 2 ++ eos/saveddata/user.py | 3 +++ gui/builtinStatsViews/priceViewFull.py | 3 +++ gui/builtinViews/fittingView.py | 6 +++-- gui/display.py | 2 ++ gui/mainFrame.py | 1 + gui/patternEditor.py | 2 ++ gui/statsView.py | 1 + gui/viewColumn.py | 1 + pyfa.py | 4 +++ service/eveapi.py | 2 ++ service/fit.py | 1 + service/market.py | 1 + 27 files changed, 104 insertions(+), 7 deletions(-) diff --git a/eos/db/saveddata/databaseRepair.py b/eos/db/saveddata/databaseRepair.py index 67339b3a7..cbdc0b245 100644 --- a/eos/db/saveddata/databaseRepair.py +++ b/eos/db/saveddata/databaseRepair.py @@ -18,6 +18,7 @@ # =============================================================================== import sqlalchemy +from sqlalchemy.exc import DatabaseError import logging logger = logging.getLogger(__name__) @@ -32,7 +33,7 @@ class DatabaseCleanup(object): try: results = saveddata_engine.execute(query) return results - except sqlalchemy.exc.DatabaseError: + except DatabaseError: logger.error("Failed to connect to database or error executing query:\n%s", query) return None diff --git a/eos/db/saveddata/fit.py b/eos/db/saveddata/fit.py index 8cbdb4d6f..2f681a372 100644 --- a/eos/db/saveddata/fit.py +++ b/eos/db/saveddata/fit.py @@ -74,6 +74,9 @@ commandFits_table = Table("commandFits", saveddata_meta, class ProjectedFit(object): + victim_fit = None + victimID = None + def __init__(self, sourceID, source_fit, amount=1, active=True): self.sourceID = sourceID self.source_fit = source_fit @@ -105,6 +108,9 @@ class ProjectedFit(object): class CommandFit(object): + boosted_fit = None + boostedID = None + def __init__(self, boosterID, booster_fit, active=True): self.boosterID = boosterID self.booster_fit = booster_fit diff --git a/eos/effectHandlerHelpers.py b/eos/effectHandlerHelpers.py index daa68c5c4..7c3837e7a 100644 --- a/eos/effectHandlerHelpers.py +++ b/eos/effectHandlerHelpers.py @@ -242,6 +242,8 @@ class HandledProjectedDroneList(HandledDroneCargoList): class HandledItem(object): + itemModifiedAttributes = None + def preAssignItemAttr(self, *args, **kwargs): self.itemModifiedAttributes.preAssign(*args, **kwargs) @@ -259,6 +261,8 @@ class HandledItem(object): class HandledCharge(object): + chargeModifiedAttributes = None + def preAssignChargeAttr(self, *args, **kwargs): self.chargeModifiedAttributes.preAssign(*args, **kwargs) diff --git a/eos/eqBase.py b/eos/eqBase.py index 2b8d35b33..85a9d1b31 100644 --- a/eos/eqBase.py +++ b/eos/eqBase.py @@ -19,6 +19,8 @@ class EqBase(object): + ID = None + def __eq__(self, other): return type(self) == type(other) and self.ID == other.ID diff --git a/eos/gamedata.py b/eos/gamedata.py index ce32d3ab7..8e0c1806c 100644 --- a/eos/gamedata.py +++ b/eos/gamedata.py @@ -45,6 +45,9 @@ class Effect(EqBase): # Filter to change names of effects to valid python method names nameFilter = re.compile("[^A-Za-z0-9]") + def __init__(self): + self.name = None + @reconstructor def init(self): """ @@ -201,12 +204,25 @@ def effectDummy(*args, **kwargs): class Item(EqBase): + typeID = None + name = None + group = None + effects = None + raceID = None + factionID = None + category = None + ID = None + __attributes = None + MOVE_ATTRS = (4, # Mass 38, # Capacity 161) # Volume MOVE_ATTR_INFO = None + def __init__(self): + pass + @classmethod def getMoveAttrInfo(cls): info = getattr(cls, "MOVE_ATTR_INFO", None) @@ -435,18 +451,22 @@ class EffectInfo(EqBase): class AttributeInfo(EqBase): - pass + name = None class Attribute(EqBase): - pass + value = None + attributeID = None class Category(EqBase): - pass + name = None class AlphaClone(EqBase): + def __init__(self): + self.skills = None + @reconstructor def init(self): self.skillCache = {} @@ -466,7 +486,8 @@ class AlphaCloneSkill(EqBase): class Group(EqBase): - pass + category = None + name = None class Icon(EqBase): @@ -474,6 +495,11 @@ class Icon(EqBase): class MarketGroup(EqBase): + def __init__(self): + self.parent = None + self.name = None + self.ID = None + def __repr__(self): return u"MarketGroup(ID={}, name={}, parent={}) at {}".format( self.ID, self.name, getattr(self.parent, "name", None), self.name, hex(id(self)) @@ -485,6 +511,9 @@ class MetaGroup(EqBase): class MetaType(EqBase): + def __init__(self): + self.parent = None + pass diff --git a/eos/saveddata/character.py b/eos/saveddata/character.py index 142166041..e5837f71d 100644 --- a/eos/saveddata/character.py +++ b/eos/saveddata/character.py @@ -31,9 +31,13 @@ logger = logging.getLogger(__name__) class Character(object): + ownerID = None + savedName = None + ID = None __itemList = None __itemIDMap = None __itemNameMap = None + apiID = None @classmethod def getSkillList(cls): diff --git a/eos/saveddata/crestchar.py b/eos/saveddata/crestchar.py index 51a32fe26..c4584b3e3 100644 --- a/eos/saveddata/crestchar.py +++ b/eos/saveddata/crestchar.py @@ -24,6 +24,9 @@ from sqlalchemy.orm import reconstructor class CrestChar(object): + name = None + ID = None + def __init__(self, id, name, refresh_token=None): self.ID = id self.name = name diff --git a/eos/saveddata/damagePattern.py b/eos/saveddata/damagePattern.py index f10e6b50b..5eb69cad0 100644 --- a/eos/saveddata/damagePattern.py +++ b/eos/saveddata/damagePattern.py @@ -21,6 +21,9 @@ import re class DamagePattern(object): + name = None + ID = None + Name = None DAMAGE_TYPES = ("em", "thermal", "kinetic", "explosive") def __init__(self, emAmount=25, thermalAmount=25, kineticAmount=25, explosiveAmount=25): diff --git a/eos/saveddata/fighter.py b/eos/saveddata/fighter.py index 1e3e5f137..a4d2c349d 100644 --- a/eos/saveddata/fighter.py +++ b/eos/saveddata/fighter.py @@ -33,6 +33,7 @@ logger = logging.getLogger(__name__) class Fighter(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut): DAMAGE_TYPES = ("em", "kinetic", "explosive", "thermal") DAMAGE_TYPES2 = ("EM", "Kin", "Exp", "Therm") + owner = None def __init__(self, item): """Initialize a fighter from the program""" diff --git a/eos/saveddata/fighterAbility.py b/eos/saveddata/fighterAbility.py index cb7c34912..cae7497a7 100644 --- a/eos/saveddata/fighterAbility.py +++ b/eos/saveddata/fighterAbility.py @@ -27,6 +27,7 @@ logger = logging.getLogger(__name__) class FighterAbility(object): DAMAGE_TYPES = ("em", "kinetic", "explosive", "thermal") DAMAGE_TYPES2 = ("EM", "Kin", "Exp", "Therm") + fighter = None # We aren't able to get data on the charges that can be stored with fighters. So we hardcode that data here, keyed # with the fighter squadron role diff --git a/eos/saveddata/fit.py b/eos/saveddata/fit.py index 3b4b7a99f..426f263e3 100644 --- a/eos/saveddata/fit.py +++ b/eos/saveddata/fit.py @@ -49,6 +49,18 @@ class ImplantLocation(Enum): class Fit(object): """Represents a fitting, with modules, ship, implants, etc.""" + name = None + shipID = None + booster = None + ownerID = None + __projectedFits = None + __commandFits = None + projectedOnto = None + boostedOnto = None + ID = None + owner = None + notes = None + PEAK_RECHARGE = 0.25 def __init__(self, ship=None, name=""): diff --git a/eos/saveddata/implant.py b/eos/saveddata/implant.py index 837642ca6..5d8a9a388 100644 --- a/eos/saveddata/implant.py +++ b/eos/saveddata/implant.py @@ -29,6 +29,8 @@ logger = logging.getLogger(__name__) class Implant(HandledItem, ItemAttrShortcut): + ID = None + def __init__(self, item): self.__item = item diff --git a/eos/saveddata/module.py b/eos/saveddata/module.py index 993d54765..38c8e6dd1 100644 --- a/eos/saveddata/module.py +++ b/eos/saveddata/module.py @@ -71,6 +71,8 @@ class Module(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut): def __init__(self, item): """Initialize a module from the program""" + self.owner = None + self.dummySlot = None self.__item = item if item is not None and self.isInvalid: diff --git a/eos/saveddata/override.py b/eos/saveddata/override.py index c4f8a1e02..ba6ff4f14 100644 --- a/eos/saveddata/override.py +++ b/eos/saveddata/override.py @@ -28,6 +28,8 @@ logger = logging.getLogger(__name__) class Override(EqBase): + itemID = None + def __init__(self, item, attr, value): self.itemID = item.ID self.__item = item diff --git a/eos/saveddata/targetResists.py b/eos/saveddata/targetResists.py index 67cd323a8..3082fd319 100644 --- a/eos/saveddata/targetResists.py +++ b/eos/saveddata/targetResists.py @@ -22,6 +22,8 @@ import re class TargetResists(object): # also determined import/export order - VERY IMPORTANT + name = None + ID = None DAMAGE_TYPES = ("em", "thermal", "kinetic", "explosive") def __init__(self, emAmount=0, thermalAmount=0, kineticAmount=0, explosiveAmount=0): diff --git a/eos/saveddata/user.py b/eos/saveddata/user.py index 8c3905a0d..564199a9e 100644 --- a/eos/saveddata/user.py +++ b/eos/saveddata/user.py @@ -25,6 +25,9 @@ from sqlalchemy.orm import validates class User(object): + username = None + ID = None + def __init__(self, username, password=None, admin=False): self.username = username if password is not None: diff --git a/gui/builtinStatsViews/priceViewFull.py b/gui/builtinStatsViews/priceViewFull.py index e5e9b85a7..abda59de4 100644 --- a/gui/builtinStatsViews/priceViewFull.py +++ b/gui/builtinStatsViews/priceViewFull.py @@ -30,6 +30,9 @@ class PriceViewFull(StatsView): def __init__(self, parent): StatsView.__init__(self) + self.labelPriceTotal = None + self.labelPriceFittings = None + self.labelPriceShip = None self.parent = parent self._cachedShip = 0 self._cachedFittings = 0 diff --git a/gui/builtinViews/fittingView.py b/gui/builtinViews/fittingView.py index 02a5ae6c0..94578d8ac 100644 --- a/gui/builtinViews/fittingView.py +++ b/gui/builtinViews/fittingView.py @@ -35,6 +35,8 @@ import gui.builtinViews.emptyView from gui.utils.exportHtml import exportHtml from logging import getLogger +from gui.chromeTabs import EVT_NOTEBOOK_PAGE_CHANGED + from service.fit import Fit from service.market import Market @@ -160,7 +162,7 @@ class FittingView(d.Display): self.Bind(wx.EVT_SHOW, self.OnShow) self.Bind(wx.EVT_MOTION, self.OnMouseMove) self.Bind(wx.EVT_LEAVE_WINDOW, self.OnLeaveWindow) - self.parent.Bind(gui.chromeTabs.EVT_NOTEBOOK_PAGE_CHANGED, self.pageChanged) + self.parent.Bind(EVT_NOTEBOOK_PAGE_CHANGED, self.pageChanged) def OnLeaveWindow(self, event): self.SetToolTip(None) @@ -209,7 +211,7 @@ class FittingView(d.Display): wx.PostEvent(self.mainFrame, gui.shipBrowser.FitSelected(fitID=fitID)) def Destroy(self): - self.parent.Unbind(gui.chromeTabs.EVT_NOTEBOOK_PAGE_CHANGED, handler=self.pageChanged) + self.parent.Unbind(EVT_NOTEBOOK_PAGE_CHANGED, handler=self.pageChanged) self.mainFrame.Unbind(GE.FIT_CHANGED, handler=self.fitChanged) self.mainFrame.Unbind(gui.shipBrowser.EVT_FIT_RENAMED, handler=self.fitRenamed) self.mainFrame.Unbind(gui.shipBrowser.EVT_FIT_REMOVED, handler=self.fitRemoved) diff --git a/gui/display.py b/gui/display.py index 4bbdc7b40..dcc3f7343 100644 --- a/gui/display.py +++ b/gui/display.py @@ -26,6 +26,8 @@ from gui.cachingImageList import CachingImageList class Display(wx.ListCtrl): + DEFAULT_COLS = None + def __init__(self, parent, size=wx.DefaultSize, style=0): wx.ListCtrl.__init__(self, parent, size=size, style=wx.LC_REPORT | style) diff --git a/gui/mainFrame.py b/gui/mainFrame.py index 175e14ab2..85f04c741 100644 --- a/gui/mainFrame.py +++ b/gui/mainFrame.py @@ -90,6 +90,7 @@ if 'wxMac' not in wx.PlatformInfo or ('wxMac' in wx.PlatformInfo and wx.VERSION disableOverrideEditor = False except ImportError as e: + AttributeEditor = None print("Error loading Attribute Editor: %s.\nAccess to Attribute Editor is disabled." % e.message) disableOverrideEditor = True diff --git a/gui/patternEditor.py b/gui/patternEditor.py index ed63fd9a3..c0a9be80c 100644 --- a/gui/patternEditor.py +++ b/gui/patternEditor.py @@ -55,6 +55,8 @@ class DmgPatternTextValidor(BaseValidator): class DmgPatternEntityEditor(EntityEditor): def __init__(self, parent): EntityEditor.__init__(self, parent, "Damage Profile") + self.btnDelete = None + self.btnRename = None self.SetEditorValidator(DmgPatternTextValidor) def getEntitiesFromContext(self): diff --git a/gui/statsView.py b/gui/statsView.py index 773063ca4..7281a4ea1 100644 --- a/gui/statsView.py +++ b/gui/statsView.py @@ -19,6 +19,7 @@ class StatsView(object): + name = None views = {} def __init__(self): diff --git a/gui/viewColumn.py b/gui/viewColumn.py index 34c3c89ce..5cbc5fb61 100644 --- a/gui/viewColumn.py +++ b/gui/viewColumn.py @@ -27,6 +27,7 @@ class ViewColumn(object): Once the missing methods are correctly implemented, they can be used as columns in a view. """ + name = None columns = {} def __init__(self, fittingView): diff --git a/pyfa.py b/pyfa.py index f89677534..3e01338cc 100755 --- a/pyfa.py +++ b/pyfa.py @@ -59,6 +59,7 @@ if not hasattr(sys, 'frozen'): try: import wxversion except ImportError: + wxversion = None print("Cannot find wxPython\nYou can download wxPython (2.8+) from http://www.wxpython.org/") sys.exit(1) @@ -86,6 +87,8 @@ if not hasattr(sys, 'frozen'): "You can download sqlalchemy (0.5.8+) from http://www.sqlalchemy.org/".format(sqlalchemy.__version__)) sys.exit(1) else: + if not sqlalchemy: + sqlalchemy = None print("Unknown sqlalchemy version string format, skipping check") except ImportError: @@ -97,6 +100,7 @@ if not hasattr(sys, 'frozen'): # noinspection PyPackageRequirements import dateutil.parser # noqa - Copied import statement from service/update.py except ImportError: + dateutil = None print("Cannot find python-dateutil.\nYou can download python-dateutil from https://pypi.python.org/pypi/python-dateutil") sys.exit(1) diff --git a/service/eveapi.py b/service/eveapi.py index 89b7ed68e..581819c27 100644 --- a/service/eveapi.py +++ b/service/eveapi.py @@ -699,6 +699,8 @@ class _Parser(object): class Element(object): + _name = None + # Element is a namespace for attributes and nested tags def __str__(self): return "" % self._name diff --git a/service/fit.py b/service/fit.py index dec2ae647..13ef7d078 100644 --- a/service/fit.py +++ b/service/fit.py @@ -41,6 +41,7 @@ logger = logging.getLogger(__name__) class Fit(object): instance = None + ID = None @classmethod def getInstance(cls): diff --git a/service/market.py b/service/market.py index 8a2abb107..7f728c648 100644 --- a/service/market.py +++ b/service/market.py @@ -173,6 +173,7 @@ class Market(object): instance = None def __init__(self): + self.getPrice = None self.priceCache = {} # Init recently used module storage From 579a13da44aeb0b05cdf9ade84129c8216c1b67c Mon Sep 17 00:00:00 2001 From: Ebag333 Date: Thu, 9 Feb 2017 00:59:22 -0800 Subject: [PATCH 25/52] Tox fixes --- eos/db/saveddata/databaseRepair.py | 1 - eos/eqBase.py | 2 +- eos/gamedata.py | 2 +- gui/display.py | 2 +- gui/mainFrame.py | 2 +- service/eveapi.py | 2 +- 6 files changed, 5 insertions(+), 6 deletions(-) diff --git a/eos/db/saveddata/databaseRepair.py b/eos/db/saveddata/databaseRepair.py index cbdc0b245..994583ce5 100644 --- a/eos/db/saveddata/databaseRepair.py +++ b/eos/db/saveddata/databaseRepair.py @@ -17,7 +17,6 @@ # along with pyfa. If not, see . # =============================================================================== -import sqlalchemy from sqlalchemy.exc import DatabaseError import logging diff --git a/eos/eqBase.py b/eos/eqBase.py index 85a9d1b31..73462c5ae 100644 --- a/eos/eqBase.py +++ b/eos/eqBase.py @@ -19,7 +19,7 @@ class EqBase(object): - ID = None + ID = None def __eq__(self, other): return type(self) == type(other) and self.ID == other.ID diff --git a/eos/gamedata.py b/eos/gamedata.py index 8e0c1806c..915ed59ac 100644 --- a/eos/gamedata.py +++ b/eos/gamedata.py @@ -213,7 +213,7 @@ class Item(EqBase): category = None ID = None __attributes = None - + MOVE_ATTRS = (4, # Mass 38, # Capacity 161) # Volume diff --git a/gui/display.py b/gui/display.py index dcc3f7343..3e8c9b247 100644 --- a/gui/display.py +++ b/gui/display.py @@ -26,7 +26,7 @@ from gui.cachingImageList import CachingImageList class Display(wx.ListCtrl): - DEFAULT_COLS = None + DEFAULT_COLS = None def __init__(self, parent, size=wx.DefaultSize, style=0): diff --git a/gui/mainFrame.py b/gui/mainFrame.py index 85f04c741..feb9df659 100644 --- a/gui/mainFrame.py +++ b/gui/mainFrame.py @@ -90,7 +90,7 @@ if 'wxMac' not in wx.PlatformInfo or ('wxMac' in wx.PlatformInfo and wx.VERSION disableOverrideEditor = False except ImportError as e: - AttributeEditor = None + AttributeEditor = None print("Error loading Attribute Editor: %s.\nAccess to Attribute Editor is disabled." % e.message) disableOverrideEditor = True diff --git a/service/eveapi.py b/service/eveapi.py index 581819c27..11a837994 100644 --- a/service/eveapi.py +++ b/service/eveapi.py @@ -699,7 +699,7 @@ class _Parser(object): class Element(object): - _name = None + _name = None # Element is a namespace for attributes and nested tags def __str__(self): From 0f00b7237ab0b658c1524e1e7cc0b5e5d87f2a20 Mon Sep 17 00:00:00 2001 From: Ebag333 Date: Thu, 9 Feb 2017 01:02:55 -0800 Subject: [PATCH 26/52] Another classic class conversion --- gui/display.py | 1 + service/network.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/gui/display.py b/gui/display.py index 3e8c9b247..2ae83aa44 100644 --- a/gui/display.py +++ b/gui/display.py @@ -67,6 +67,7 @@ class Display(wx.ListCtrl): i += 1 info = wx.ListItem() + # noinspection PyPropertyAccess info.m_mask = wx.LIST_MASK_WIDTH self.InsertColumnInfo(i, info) self.SetColumnWidth(i, 0) diff --git a/service/network.py b/service/network.py index b191ad57f..d050e88e2 100644 --- a/service/network.py +++ b/service/network.py @@ -51,7 +51,7 @@ class TimeoutError(StandardError): pass -class Network: +class Network(object): # Request constants - every request must supply this, as it is checked if # enabled or not via settings ENABLED = 1 From dd9924a7a76a30ce08c66af97faa1efd89e06dae Mon Sep 17 00:00:00 2001 From: Ebag333 Date: Thu, 9 Feb 2017 07:22:09 -0800 Subject: [PATCH 27/52] Fix issues where we assume something can exist when it may not. --- eos/saveddata/fit.py | 6 ++++-- gui/builtinViews/fittingView.py | 3 +++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/eos/saveddata/fit.py b/eos/saveddata/fit.py index 426f263e3..a058b8184 100644 --- a/eos/saveddata/fit.py +++ b/eos/saveddata/fit.py @@ -443,9 +443,11 @@ class Fit(object): self.__modifier = currModifier self.__origin = origin if hasattr(currModifier, "itemModifiedAttributes"): - currModifier.itemModifiedAttributes.fit = origin or self + if hasattr(currModifier.itemModifiedAttributes, "fit"): + currModifier.itemModifiedAttributes.fit = origin or self if hasattr(currModifier, "chargeModifiedAttributes"): - currModifier.chargeModifiedAttributes.fit = origin or self + if hasattr(currModifier.itemModifiedAttributes, "fit"): + currModifier.chargeModifiedAttributes.fit = origin or self def getModifier(self): return self.__modifier diff --git a/gui/builtinViews/fittingView.py b/gui/builtinViews/fittingView.py index 94578d8ac..904782ab5 100644 --- a/gui/builtinViews/fittingView.py +++ b/gui/builtinViews/fittingView.py @@ -408,6 +408,9 @@ class FittingView(d.Display): if mod1.slot != mod2.slot: return + if not getattr(mod2, "modPosition"): + self.mods.modPosition = mod2.modPosition = dstRow + if clone and mod2.isEmpty: sFit.cloneModule(self.mainFrame.getActiveFit(), srcIdx, mod2.modPosition) else: From d25673b8fe87b66b65fa207e80f5452da0744fc0 Mon Sep 17 00:00:00 2001 From: petosorus Date: Sun, 27 Nov 2016 11:10:33 +0100 Subject: [PATCH 28/52] Price listing price panel --- gui/builtinStatsViews/priceViewFull.py | 58 ++++++++++++++++++-------- service/price.py | 7 +++- 2 files changed, 46 insertions(+), 19 deletions(-) diff --git a/gui/builtinStatsViews/priceViewFull.py b/gui/builtinStatsViews/priceViewFull.py index f392d31aa..b4800c4ce 100644 --- a/gui/builtinStatsViews/priceViewFull.py +++ b/gui/builtinStatsViews/priceViewFull.py @@ -18,6 +18,7 @@ #=============================================================================== import wx +import gui.mainFrame from gui.statsView import StatsView from gui import builtinStatsViews from gui.bitmapLoader import BitmapLoader @@ -74,30 +75,51 @@ class PriceViewFull(StatsView): self.priceChoice = wx.Choice(contentPanel, choices=Price.systemsList.keys()) contentSizer.Add(self.priceChoice, 1, wx.RIGHT | wx.LEFT, 3) self.priceChoice.SetStringSelection("Jita") + self.priceChoice.Bind(wx.EVT_CHOICE, self.priceSelection) + + def priceSelection(self, event): Price.currentSystemId = Price.systemsList.get(self.priceChoice.GetString(self.priceChoice.GetSelection())) + mainFrame = gui.mainFrame.MainFrame.getInstance() + sFit = service.Fit.getInstance() + fit = sFit.getFit(mainFrame.getActiveFit()) + + typeIDs = self.fitItemsList(fit) + + sMkt = service.Market.getInstance() + sMkt.getPrices(typeIDs, Price.invalidPrices) + + self.refreshPanel(fit); + + + def fitItemsList(self, fit): + # Compose a list of all the data we need & request it + typeIDs = [] + typeIDs.append(fit.ship.item.ID) + + for mod in fit.modules: + if not mod.isEmpty: + typeIDs.append(mod.itemID) + + for drone in fit.drones: + for _ in xrange(drone.amount): + typeIDs.append(drone.itemID) + + for fighter in fit.fighters: + for _ in xrange(fighter.amountActive): + typeIDs.append(fighter.itemID) + + for cargo in fit.cargo: + for _ in xrange(cargo.amount): + typeIDs.append(cargo.itemID) + + return typeIDs + def refreshPanel(self, fit): if fit is not None: self.fit = fit - # Compose a list of all the data we need & request it - typeIDs = [] - typeIDs.append(fit.ship.item.ID) - for mod in fit.modules: - if not mod.isEmpty: - typeIDs.append(mod.itemID) - - for drone in fit.drones: - for _ in xrange(drone.amount): - typeIDs.append(drone.itemID) - - for fighter in fit.fighters: - for _ in xrange(fighter.amountActive): - typeIDs.append(fighter.itemID) - - for cargo in fit.cargo: - for _ in xrange(cargo.amount): - typeIDs.append(cargo.itemID) + typeIDs = self.fitItemsList(fit) sMkt = service.Market.getInstance() sMkt.getPrices(typeIDs, self.processPrices) diff --git a/service/price.py b/service/price.py index 8215a46d9..0a3b3b53d 100644 --- a/service/price.py +++ b/service/price.py @@ -37,7 +37,12 @@ class Price(): "Hek": 30002053 } - currentSystemId = systemsList.get("Jita") + currentSystemId = "" + + @classmethod + def invalidPrices(self, prices): + for price in prices: + price.time = 0 @classmethod def fetchPrices(cls, prices): From d15acf89baafda891ac781e0e28ff6bd34cd3bef Mon Sep 17 00:00:00 2001 From: petosorus Date: Thu, 5 Jan 2017 00:06:25 +0100 Subject: [PATCH 29/52] refresh modules price view --- gui/builtinStatsViews/priceViewFull.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/gui/builtinStatsViews/priceViewFull.py b/gui/builtinStatsViews/priceViewFull.py index b4800c4ce..ac2de40ea 100644 --- a/gui/builtinStatsViews/priceViewFull.py +++ b/gui/builtinStatsViews/priceViewFull.py @@ -25,6 +25,7 @@ from gui.bitmapLoader import BitmapLoader from gui.utils.numberFormatter import formatAmount import service from service import Price +import gui.globalEvents as GE class PriceViewFull(StatsView): @@ -35,6 +36,7 @@ class PriceViewFull(StatsView): self._cachedShip = 0 self._cachedFittings = 0 self._cachedTotal = 0 + self.mainFrame = gui.mainFrame.MainFrame.getInstance() def getHeaderText(self, fit): return "Price" @@ -73,12 +75,13 @@ class PriceViewFull(StatsView): hbox.Add(lbl, 0, wx.ALIGN_LEFT) self.priceChoice = wx.Choice(contentPanel, choices=Price.systemsList.keys()) - contentSizer.Add(self.priceChoice, 1, wx.RIGHT | wx.LEFT, 3) + contentSizer.Add(self.priceChoice) self.priceChoice.SetStringSelection("Jita") self.priceChoice.Bind(wx.EVT_CHOICE, self.priceSelection) def priceSelection(self, event): Price.currentSystemId = Price.systemsList.get(self.priceChoice.GetString(self.priceChoice.GetSelection())) + fitID = self.mainFrame.getActiveFit() mainFrame = gui.mainFrame.MainFrame.getInstance() sFit = service.Fit.getInstance() @@ -89,8 +92,8 @@ class PriceViewFull(StatsView): sMkt = service.Market.getInstance() sMkt.getPrices(typeIDs, Price.invalidPrices) - self.refreshPanel(fit); - + self.refreshPanel(fit) + wx.PostEvent(self.mainFrame, GE.FitChanged(fitID=fitID)) def fitItemsList(self, fit): # Compose a list of all the data we need & request it From bfa772609a21f3469bb59d80aecc459b04ee30a2 Mon Sep 17 00:00:00 2001 From: petosorus Date: Thu, 9 Feb 2017 18:25:27 +0100 Subject: [PATCH 30/52] Transfer of the price dropbox in the preferences pane. Moving of the modules list compiling from priceview to price service. --- .../pyfaGeneralPreferences.py | 26 ++++++++++- gui/builtinStatsViews/priceViewFull.py | 46 +------------------ service/price.py | 24 ++++++++++ 3 files changed, 50 insertions(+), 46 deletions(-) diff --git a/gui/builtinPreferenceViews/pyfaGeneralPreferences.py b/gui/builtinPreferenceViews/pyfaGeneralPreferences.py index a1f43696f..e48277439 100644 --- a/gui/builtinPreferenceViews/pyfaGeneralPreferences.py +++ b/gui/builtinPreferenceViews/pyfaGeneralPreferences.py @@ -6,7 +6,7 @@ from gui.bitmapLoader import BitmapLoader import gui.mainFrame import service import gui.globalEvents as GE - +from service import Price class PFGeneralPref ( PreferenceView): title = "General" @@ -65,6 +65,9 @@ class PFGeneralPref ( PreferenceView): self.cbExportCharges = wx.CheckBox( panel, wx.ID_ANY, u"Export loaded charges", wx.DefaultPosition, wx.DefaultSize, 0 ) mainSizer.Add( self.cbExportCharges, 0, wx.ALL|wx.EXPAND, 5 ) + self.chPriceSystem = wx.Choice( panel, choices=Price.systemsList.keys()) + mainSizer.Add( self.chPriceSystem, 0, wx.ALL|wx.EXPAND, 5) + defCharSizer = wx.BoxSizer( wx.HORIZONTAL ) self.sFit = service.Fit.getInstance() @@ -81,6 +84,7 @@ class PFGeneralPref ( PreferenceView): self.cbMarketShortcuts.SetValue(self.sFit.serviceFittingOptions["showMarketShortcuts"] or False) self.cbGaugeAnimation.SetValue(self.sFit.serviceFittingOptions["enableGaugeAnimation"]) self.cbExportCharges.SetValue(self.sFit.serviceFittingOptions["exportCharges"]) + self.chPriceSystem.SetStringSelection("Jita") self.cbGlobalChar.Bind(wx.EVT_CHECKBOX, self.OnCBGlobalCharStateChange) self.cbGlobalDmgPattern.Bind(wx.EVT_CHECKBOX, self.OnCBGlobalDmgPatternStateChange) @@ -94,6 +98,7 @@ class PFGeneralPref ( PreferenceView): self.cbMarketShortcuts.Bind(wx.EVT_CHECKBOX, self.onCBShowShortcuts) self.cbGaugeAnimation.Bind(wx.EVT_CHECKBOX, self.onCBGaugeAnimation) self.cbExportCharges.Bind(wx.EVT_CHECKBOX, self.onCBExportCharges) + self.chPriceSystem.Bind(wx.EVT_CHOICE, self.onPriceSelection) self.cbRackLabels.Enable(self.sFit.serviceFittingOptions["rackSlots"] or False) @@ -162,4 +167,23 @@ class PFGeneralPref ( PreferenceView): def getImage(self): return BitmapLoader.getBitmap("prefs_settings", "gui") + def onPriceSelection(self, event): + Price.currentSystemId = Price.systemsList.get( + self.chPriceSystem.GetString(self.chPriceSystem.GetSelection()) + ) + + mainFrame = gui.mainFrame.MainFrame.getInstance() + sFit = service.Fit.getInstance() + fitID = self.mainFrame.getActiveFit() + fit = sFit.getFit(fitID) + + sMkt = service.Market.getInstance() + typeIDs = Price.fitItemsList(fit) + sMkt.getPrices(typeIDs, Price.invalidPrices) + + + self.sFit.refreshFit(fitID) + wx.PostEvent(self.mainFrame, GE.FitChanged(fitID=fitID)) + + PFGeneralPref.register() diff --git a/gui/builtinStatsViews/priceViewFull.py b/gui/builtinStatsViews/priceViewFull.py index ac2de40ea..9ce5d62f9 100644 --- a/gui/builtinStatsViews/priceViewFull.py +++ b/gui/builtinStatsViews/priceViewFull.py @@ -25,7 +25,6 @@ from gui.bitmapLoader import BitmapLoader from gui.utils.numberFormatter import formatAmount import service from service import Price -import gui.globalEvents as GE class PriceViewFull(StatsView): @@ -74,55 +73,12 @@ class PriceViewFull(StatsView): setattr(self, "labelPrice%s" % type.capitalize(), lbl) hbox.Add(lbl, 0, wx.ALIGN_LEFT) - self.priceChoice = wx.Choice(contentPanel, choices=Price.systemsList.keys()) - contentSizer.Add(self.priceChoice) - self.priceChoice.SetStringSelection("Jita") - self.priceChoice.Bind(wx.EVT_CHOICE, self.priceSelection) - - def priceSelection(self, event): - Price.currentSystemId = Price.systemsList.get(self.priceChoice.GetString(self.priceChoice.GetSelection())) - fitID = self.mainFrame.getActiveFit() - - mainFrame = gui.mainFrame.MainFrame.getInstance() - sFit = service.Fit.getInstance() - fit = sFit.getFit(mainFrame.getActiveFit()) - - typeIDs = self.fitItemsList(fit) - - sMkt = service.Market.getInstance() - sMkt.getPrices(typeIDs, Price.invalidPrices) - - self.refreshPanel(fit) - wx.PostEvent(self.mainFrame, GE.FitChanged(fitID=fitID)) - - def fitItemsList(self, fit): - # Compose a list of all the data we need & request it - typeIDs = [] - typeIDs.append(fit.ship.item.ID) - - for mod in fit.modules: - if not mod.isEmpty: - typeIDs.append(mod.itemID) - - for drone in fit.drones: - for _ in xrange(drone.amount): - typeIDs.append(drone.itemID) - - for fighter in fit.fighters: - for _ in xrange(fighter.amountActive): - typeIDs.append(fighter.itemID) - - for cargo in fit.cargo: - for _ in xrange(cargo.amount): - typeIDs.append(cargo.itemID) - - return typeIDs def refreshPanel(self, fit): if fit is not None: self.fit = fit - typeIDs = self.fitItemsList(fit) + typeIDs = Price.fitItemsList(fit) sMkt = service.Market.getInstance() sMkt.getPrices(typeIDs, self.processPrices) diff --git a/service/price.py b/service/price.py index 0a3b3b53d..32fd82cd6 100644 --- a/service/price.py +++ b/service/price.py @@ -127,3 +127,27 @@ class Price(): priceobj = priceMap[typeID] priceobj.time = time.time() + REREQUEST priceobj.failed = True + + @classmethod + def fitItemsList(self, fit): + # Compose a list of all the data we need & request it + typeIDs = [] + typeIDs.append(fit.ship.item.ID) + + for mod in fit.modules: + if not mod.isEmpty: + typeIDs.append(mod.itemID) + + for drone in fit.drones: + for _ in xrange(drone.amount): + typeIDs.append(drone.itemID) + + for fighter in fit.fighters: + for _ in xrange(fighter.amountActive): + typeIDs.append(fighter.itemID) + + for cargo in fit.cargo: + for _ in xrange(cargo.amount): + typeIDs.append(cargo.itemID) + + return typeIDs \ No newline at end of file From 64070a0798a12b115599126cc68ebc57cd5ae301 Mon Sep 17 00:00:00 2001 From: Ebag333 Date: Thu, 9 Feb 2017 09:36:16 -0800 Subject: [PATCH 31/52] Revert commit 7865219164f35cbc9a4e0fceb26667bcc232967a This causes too much grief as we are getting a lot of default values from the database. These *SHOULD* be defined, but will have to be done later. --- eos/db/saveddata/fit.py | 6 ------ eos/effectHandlerHelpers.py | 4 ---- eos/gamedata.py | 30 +++++++------------------- eos/saveddata/character.py | 4 ---- eos/saveddata/crestchar.py | 3 --- eos/saveddata/damagePattern.py | 3 --- eos/saveddata/fighter.py | 1 - eos/saveddata/fighterAbility.py | 1 - eos/saveddata/fit.py | 12 ----------- eos/saveddata/implant.py | 2 -- eos/saveddata/module.py | 2 -- eos/saveddata/override.py | 2 -- eos/saveddata/targetResists.py | 2 -- eos/saveddata/user.py | 3 --- gui/builtinStatsViews/priceViewFull.py | 3 --- gui/builtinViews/fittingView.py | 6 ++---- gui/patternEditor.py | 2 -- gui/statsView.py | 1 - gui/viewColumn.py | 1 - pyfa.py | 4 ---- service/fit.py | 1 - service/market.py | 1 - 22 files changed, 10 insertions(+), 84 deletions(-) diff --git a/eos/db/saveddata/fit.py b/eos/db/saveddata/fit.py index 2f681a372..8cbdb4d6f 100644 --- a/eos/db/saveddata/fit.py +++ b/eos/db/saveddata/fit.py @@ -74,9 +74,6 @@ commandFits_table = Table("commandFits", saveddata_meta, class ProjectedFit(object): - victim_fit = None - victimID = None - def __init__(self, sourceID, source_fit, amount=1, active=True): self.sourceID = sourceID self.source_fit = source_fit @@ -108,9 +105,6 @@ class ProjectedFit(object): class CommandFit(object): - boosted_fit = None - boostedID = None - def __init__(self, boosterID, booster_fit, active=True): self.boosterID = boosterID self.booster_fit = booster_fit diff --git a/eos/effectHandlerHelpers.py b/eos/effectHandlerHelpers.py index 7c3837e7a..daa68c5c4 100644 --- a/eos/effectHandlerHelpers.py +++ b/eos/effectHandlerHelpers.py @@ -242,8 +242,6 @@ class HandledProjectedDroneList(HandledDroneCargoList): class HandledItem(object): - itemModifiedAttributes = None - def preAssignItemAttr(self, *args, **kwargs): self.itemModifiedAttributes.preAssign(*args, **kwargs) @@ -261,8 +259,6 @@ class HandledItem(object): class HandledCharge(object): - chargeModifiedAttributes = None - def preAssignChargeAttr(self, *args, **kwargs): self.chargeModifiedAttributes.preAssign(*args, **kwargs) diff --git a/eos/gamedata.py b/eos/gamedata.py index 915ed59ac..d46f1032b 100644 --- a/eos/gamedata.py +++ b/eos/gamedata.py @@ -46,7 +46,7 @@ class Effect(EqBase): nameFilter = re.compile("[^A-Za-z0-9]") def __init__(self): - self.name = None + pass @reconstructor def init(self): @@ -204,16 +204,6 @@ def effectDummy(*args, **kwargs): class Item(EqBase): - typeID = None - name = None - group = None - effects = None - raceID = None - factionID = None - category = None - ID = None - __attributes = None - MOVE_ATTRS = (4, # Mass 38, # Capacity 161) # Volume @@ -451,21 +441,20 @@ class EffectInfo(EqBase): class AttributeInfo(EqBase): - name = None + pass class Attribute(EqBase): - value = None - attributeID = None + pass class Category(EqBase): - name = None + pass class AlphaClone(EqBase): def __init__(self): - self.skills = None + pass @reconstructor def init(self): @@ -486,8 +475,7 @@ class AlphaCloneSkill(EqBase): class Group(EqBase): - category = None - name = None + pass class Icon(EqBase): @@ -496,9 +484,7 @@ class Icon(EqBase): class MarketGroup(EqBase): def __init__(self): - self.parent = None - self.name = None - self.ID = None + pass def __repr__(self): return u"MarketGroup(ID={}, name={}, parent={}) at {}".format( @@ -512,7 +498,7 @@ class MetaGroup(EqBase): class MetaType(EqBase): def __init__(self): - self.parent = None + pass pass diff --git a/eos/saveddata/character.py b/eos/saveddata/character.py index e5837f71d..142166041 100644 --- a/eos/saveddata/character.py +++ b/eos/saveddata/character.py @@ -31,13 +31,9 @@ logger = logging.getLogger(__name__) class Character(object): - ownerID = None - savedName = None - ID = None __itemList = None __itemIDMap = None __itemNameMap = None - apiID = None @classmethod def getSkillList(cls): diff --git a/eos/saveddata/crestchar.py b/eos/saveddata/crestchar.py index c4584b3e3..51a32fe26 100644 --- a/eos/saveddata/crestchar.py +++ b/eos/saveddata/crestchar.py @@ -24,9 +24,6 @@ from sqlalchemy.orm import reconstructor class CrestChar(object): - name = None - ID = None - def __init__(self, id, name, refresh_token=None): self.ID = id self.name = name diff --git a/eos/saveddata/damagePattern.py b/eos/saveddata/damagePattern.py index 5eb69cad0..f10e6b50b 100644 --- a/eos/saveddata/damagePattern.py +++ b/eos/saveddata/damagePattern.py @@ -21,9 +21,6 @@ import re class DamagePattern(object): - name = None - ID = None - Name = None DAMAGE_TYPES = ("em", "thermal", "kinetic", "explosive") def __init__(self, emAmount=25, thermalAmount=25, kineticAmount=25, explosiveAmount=25): diff --git a/eos/saveddata/fighter.py b/eos/saveddata/fighter.py index a4d2c349d..1e3e5f137 100644 --- a/eos/saveddata/fighter.py +++ b/eos/saveddata/fighter.py @@ -33,7 +33,6 @@ logger = logging.getLogger(__name__) class Fighter(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut): DAMAGE_TYPES = ("em", "kinetic", "explosive", "thermal") DAMAGE_TYPES2 = ("EM", "Kin", "Exp", "Therm") - owner = None def __init__(self, item): """Initialize a fighter from the program""" diff --git a/eos/saveddata/fighterAbility.py b/eos/saveddata/fighterAbility.py index cae7497a7..cb7c34912 100644 --- a/eos/saveddata/fighterAbility.py +++ b/eos/saveddata/fighterAbility.py @@ -27,7 +27,6 @@ logger = logging.getLogger(__name__) class FighterAbility(object): DAMAGE_TYPES = ("em", "kinetic", "explosive", "thermal") DAMAGE_TYPES2 = ("EM", "Kin", "Exp", "Therm") - fighter = None # We aren't able to get data on the charges that can be stored with fighters. So we hardcode that data here, keyed # with the fighter squadron role diff --git a/eos/saveddata/fit.py b/eos/saveddata/fit.py index a058b8184..9d79930f2 100644 --- a/eos/saveddata/fit.py +++ b/eos/saveddata/fit.py @@ -49,18 +49,6 @@ class ImplantLocation(Enum): class Fit(object): """Represents a fitting, with modules, ship, implants, etc.""" - name = None - shipID = None - booster = None - ownerID = None - __projectedFits = None - __commandFits = None - projectedOnto = None - boostedOnto = None - ID = None - owner = None - notes = None - PEAK_RECHARGE = 0.25 def __init__(self, ship=None, name=""): diff --git a/eos/saveddata/implant.py b/eos/saveddata/implant.py index 5d8a9a388..837642ca6 100644 --- a/eos/saveddata/implant.py +++ b/eos/saveddata/implant.py @@ -29,8 +29,6 @@ logger = logging.getLogger(__name__) class Implant(HandledItem, ItemAttrShortcut): - ID = None - def __init__(self, item): self.__item = item diff --git a/eos/saveddata/module.py b/eos/saveddata/module.py index 38c8e6dd1..993d54765 100644 --- a/eos/saveddata/module.py +++ b/eos/saveddata/module.py @@ -71,8 +71,6 @@ class Module(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut): def __init__(self, item): """Initialize a module from the program""" - self.owner = None - self.dummySlot = None self.__item = item if item is not None and self.isInvalid: diff --git a/eos/saveddata/override.py b/eos/saveddata/override.py index ba6ff4f14..c4f8a1e02 100644 --- a/eos/saveddata/override.py +++ b/eos/saveddata/override.py @@ -28,8 +28,6 @@ logger = logging.getLogger(__name__) class Override(EqBase): - itemID = None - def __init__(self, item, attr, value): self.itemID = item.ID self.__item = item diff --git a/eos/saveddata/targetResists.py b/eos/saveddata/targetResists.py index 3082fd319..67cd323a8 100644 --- a/eos/saveddata/targetResists.py +++ b/eos/saveddata/targetResists.py @@ -22,8 +22,6 @@ import re class TargetResists(object): # also determined import/export order - VERY IMPORTANT - name = None - ID = None DAMAGE_TYPES = ("em", "thermal", "kinetic", "explosive") def __init__(self, emAmount=0, thermalAmount=0, kineticAmount=0, explosiveAmount=0): diff --git a/eos/saveddata/user.py b/eos/saveddata/user.py index 564199a9e..8c3905a0d 100644 --- a/eos/saveddata/user.py +++ b/eos/saveddata/user.py @@ -25,9 +25,6 @@ from sqlalchemy.orm import validates class User(object): - username = None - ID = None - def __init__(self, username, password=None, admin=False): self.username = username if password is not None: diff --git a/gui/builtinStatsViews/priceViewFull.py b/gui/builtinStatsViews/priceViewFull.py index abda59de4..e5e9b85a7 100644 --- a/gui/builtinStatsViews/priceViewFull.py +++ b/gui/builtinStatsViews/priceViewFull.py @@ -30,9 +30,6 @@ class PriceViewFull(StatsView): def __init__(self, parent): StatsView.__init__(self) - self.labelPriceTotal = None - self.labelPriceFittings = None - self.labelPriceShip = None self.parent = parent self._cachedShip = 0 self._cachedFittings = 0 diff --git a/gui/builtinViews/fittingView.py b/gui/builtinViews/fittingView.py index 904782ab5..8e1342768 100644 --- a/gui/builtinViews/fittingView.py +++ b/gui/builtinViews/fittingView.py @@ -35,8 +35,6 @@ import gui.builtinViews.emptyView from gui.utils.exportHtml import exportHtml from logging import getLogger -from gui.chromeTabs import EVT_NOTEBOOK_PAGE_CHANGED - from service.fit import Fit from service.market import Market @@ -162,7 +160,7 @@ class FittingView(d.Display): self.Bind(wx.EVT_SHOW, self.OnShow) self.Bind(wx.EVT_MOTION, self.OnMouseMove) self.Bind(wx.EVT_LEAVE_WINDOW, self.OnLeaveWindow) - self.parent.Bind(EVT_NOTEBOOK_PAGE_CHANGED, self.pageChanged) + self.parent.Bind(gui.chromeTabs.EVT_NOTEBOOK_PAGE_CHANGED, self.pageChanged) def OnLeaveWindow(self, event): self.SetToolTip(None) @@ -211,7 +209,7 @@ class FittingView(d.Display): wx.PostEvent(self.mainFrame, gui.shipBrowser.FitSelected(fitID=fitID)) def Destroy(self): - self.parent.Unbind(EVT_NOTEBOOK_PAGE_CHANGED, handler=self.pageChanged) + self.parent.Unbind(gui.chromeTabs.EVT_NOTEBOOK_PAGE_CHANGED, handler=self.pageChanged) self.mainFrame.Unbind(GE.FIT_CHANGED, handler=self.fitChanged) self.mainFrame.Unbind(gui.shipBrowser.EVT_FIT_RENAMED, handler=self.fitRenamed) self.mainFrame.Unbind(gui.shipBrowser.EVT_FIT_REMOVED, handler=self.fitRemoved) diff --git a/gui/patternEditor.py b/gui/patternEditor.py index c0a9be80c..ed63fd9a3 100644 --- a/gui/patternEditor.py +++ b/gui/patternEditor.py @@ -55,8 +55,6 @@ class DmgPatternTextValidor(BaseValidator): class DmgPatternEntityEditor(EntityEditor): def __init__(self, parent): EntityEditor.__init__(self, parent, "Damage Profile") - self.btnDelete = None - self.btnRename = None self.SetEditorValidator(DmgPatternTextValidor) def getEntitiesFromContext(self): diff --git a/gui/statsView.py b/gui/statsView.py index 7281a4ea1..773063ca4 100644 --- a/gui/statsView.py +++ b/gui/statsView.py @@ -19,7 +19,6 @@ class StatsView(object): - name = None views = {} def __init__(self): diff --git a/gui/viewColumn.py b/gui/viewColumn.py index 5cbc5fb61..34c3c89ce 100644 --- a/gui/viewColumn.py +++ b/gui/viewColumn.py @@ -27,7 +27,6 @@ class ViewColumn(object): Once the missing methods are correctly implemented, they can be used as columns in a view. """ - name = None columns = {} def __init__(self, fittingView): diff --git a/pyfa.py b/pyfa.py index 3e01338cc..f89677534 100755 --- a/pyfa.py +++ b/pyfa.py @@ -59,7 +59,6 @@ if not hasattr(sys, 'frozen'): try: import wxversion except ImportError: - wxversion = None print("Cannot find wxPython\nYou can download wxPython (2.8+) from http://www.wxpython.org/") sys.exit(1) @@ -87,8 +86,6 @@ if not hasattr(sys, 'frozen'): "You can download sqlalchemy (0.5.8+) from http://www.sqlalchemy.org/".format(sqlalchemy.__version__)) sys.exit(1) else: - if not sqlalchemy: - sqlalchemy = None print("Unknown sqlalchemy version string format, skipping check") except ImportError: @@ -100,7 +97,6 @@ if not hasattr(sys, 'frozen'): # noinspection PyPackageRequirements import dateutil.parser # noqa - Copied import statement from service/update.py except ImportError: - dateutil = None print("Cannot find python-dateutil.\nYou can download python-dateutil from https://pypi.python.org/pypi/python-dateutil") sys.exit(1) diff --git a/service/fit.py b/service/fit.py index 13ef7d078..dec2ae647 100644 --- a/service/fit.py +++ b/service/fit.py @@ -41,7 +41,6 @@ logger = logging.getLogger(__name__) class Fit(object): instance = None - ID = None @classmethod def getInstance(cls): diff --git a/service/market.py b/service/market.py index 7f728c648..8a2abb107 100644 --- a/service/market.py +++ b/service/market.py @@ -173,7 +173,6 @@ class Market(object): instance = None def __init__(self): - self.getPrice = None self.priceCache = {} # Init recently used module storage From 1a9591d4117e4cfb8591b376a71b9856e6d7d6ee Mon Sep 17 00:00:00 2001 From: Ebag333 Date: Thu, 9 Feb 2017 10:56:26 -0800 Subject: [PATCH 32/52] pyCharm inspection and code style --- _development/Pyfa_CodeStyle.xml | 13 ++++++++ _development/Pyfa_Inspections.xml | 54 +++++++++++++++++++++++++++++++ 2 files changed, 67 insertions(+) create mode 100644 _development/Pyfa_CodeStyle.xml create mode 100644 _development/Pyfa_Inspections.xml diff --git a/_development/Pyfa_CodeStyle.xml b/_development/Pyfa_CodeStyle.xml new file mode 100644 index 000000000..a7980e4df --- /dev/null +++ b/_development/Pyfa_CodeStyle.xml @@ -0,0 +1,13 @@ + + diff --git a/_development/Pyfa_Inspections.xml b/_development/Pyfa_Inspections.xml new file mode 100644 index 000000000..0a0da06d4 --- /dev/null +++ b/_development/Pyfa_Inspections.xml @@ -0,0 +1,54 @@ + + From 9775d1064e36a52baf13611b52554523ed67f92f Mon Sep 17 00:00:00 2001 From: Ebag333 Date: Thu, 9 Feb 2017 13:27:54 -0800 Subject: [PATCH 33/52] Move import code down into class init --- gui/graphFrame.py | 41 ++++++++++++++++++++++++++--------------- 1 file changed, 26 insertions(+), 15 deletions(-) diff --git a/gui/graphFrame.py b/gui/graphFrame.py index 4eceaba89..8321514fe 100644 --- a/gui/graphFrame.py +++ b/gui/graphFrame.py @@ -19,6 +19,7 @@ import os import logging +import imp import wx @@ -30,27 +31,18 @@ from gui.graph import Graph from gui.bitmapLoader import BitmapLoader from config import parsePath +# Don't actually import the thing, since it takes for fucking ever try: - import matplotlib as mpl - if mpl.__version__[0] >= "2": - mpl.use('wxagg') - mplImported = True - from matplotlib.patches import Patch - else: - mplImported = False - from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as Canvas - from matplotlib.figure import Figure + imp.find_module('matplotlib') graphFrame_enabled = True + mplImported = True except ImportError: - mpl = None - Canvas = None - Figure = None - mplImported = False graphFrame_enabled = False + mplImported = False + + logger = logging.getLogger(__name__) -if not graphFrame_enabled: - logger.info("Problems importing matplotlib; continuing without graphs") class GraphFrame(wx.Frame): @@ -59,8 +51,27 @@ class GraphFrame(wx.Frame): global graphFrame_enabled global mplImported + try: + import matplotlib as mpl + if mpl.__version__[0] >= "2": + mpl.use('wxagg') + mplImported = True + from matplotlib.patches import Patch + else: + mplImported = False + from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as Canvas + from matplotlib.figure import Figure + graphFrame_enabled = True + except ImportError: + mpl = None + Canvas = None + Figure = None + mplImported = False + graphFrame_enabled = False + self.legendFix = False if not graphFrame_enabled: + logger.info("Problems importing matplotlib; continuing without graphs") return try: From 228425fdb926971c914a3e4517a51beb6262eb8f Mon Sep 17 00:00:00 2001 From: Ebag333 Date: Thu, 9 Feb 2017 14:07:37 -0800 Subject: [PATCH 34/52] Cast to int so we can compare --- gui/graphFrame.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gui/graphFrame.py b/gui/graphFrame.py index 8321514fe..e143e12c3 100644 --- a/gui/graphFrame.py +++ b/gui/graphFrame.py @@ -53,7 +53,7 @@ class GraphFrame(wx.Frame): try: import matplotlib as mpl - if mpl.__version__[0] >= "2": + if int(mpl.__version__[0]) >= 2: mpl.use('wxagg') mplImported = True from matplotlib.patches import Patch @@ -88,7 +88,7 @@ class GraphFrame(wx.Frame): mpl.use('wxagg') graphFrame_enabled = True - if mpl.__version__[0] < "1": + if int(mpl.__version__[0]) < 1: print("pyfa: Found matplotlib version ", mpl.__version__, " - activating OVER9000 workarounds") print("pyfa: Recommended minimum matplotlib version is 1.0.0") self.legendFix = True From aaece725aa0430c50cdebb44e1f87118ecf6ee38 Mon Sep 17 00:00:00 2001 From: petosorus Date: Thu, 9 Feb 2017 23:26:31 +0100 Subject: [PATCH 35/52] Saving price system preference --- gui/builtinPreferenceViews/pyfaGeneralPreferences.py | 9 ++++----- service/fit.py | 3 ++- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/gui/builtinPreferenceViews/pyfaGeneralPreferences.py b/gui/builtinPreferenceViews/pyfaGeneralPreferences.py index e48277439..d75c3002f 100644 --- a/gui/builtinPreferenceViews/pyfaGeneralPreferences.py +++ b/gui/builtinPreferenceViews/pyfaGeneralPreferences.py @@ -84,7 +84,7 @@ class PFGeneralPref ( PreferenceView): self.cbMarketShortcuts.SetValue(self.sFit.serviceFittingOptions["showMarketShortcuts"] or False) self.cbGaugeAnimation.SetValue(self.sFit.serviceFittingOptions["enableGaugeAnimation"]) self.cbExportCharges.SetValue(self.sFit.serviceFittingOptions["exportCharges"]) - self.chPriceSystem.SetStringSelection("Jita") + self.chPriceSystem.SetStringSelection(self.sFit.serviceFittingOptions["priceSystem"]) self.cbGlobalChar.Bind(wx.EVT_CHECKBOX, self.OnCBGlobalCharStateChange) self.cbGlobalDmgPattern.Bind(wx.EVT_CHECKBOX, self.OnCBGlobalDmgPatternStateChange) @@ -168,11 +168,10 @@ class PFGeneralPref ( PreferenceView): return BitmapLoader.getBitmap("prefs_settings", "gui") def onPriceSelection(self, event): - Price.currentSystemId = Price.systemsList.get( - self.chPriceSystem.GetString(self.chPriceSystem.GetSelection()) - ) + system = self.chPriceSystem.GetString(self.chPriceSystem.GetSelection()) + Price.currentSystemId = Price.systemsList.get(system) + self.sFit.serviceFittingOptions["priceSystem"] = system - mainFrame = gui.mainFrame.MainFrame.getInstance() sFit = service.Fit.getInstance() fitID = self.mainFrame.getActiveFit() fit = sFit.getFit(fitID) diff --git a/service/fit.py b/service/fit.py index 2d3b75be5..0a4867359 100644 --- a/service/fit.py +++ b/service/fit.py @@ -106,7 +106,8 @@ class Fit(object): "showTooltip": True, "showMarketShortcuts": False, "enableGaugeAnimation": True, - "exportCharges": True} + "exportCharges": True, + "priceSystem": "Jita"} self.serviceFittingOptions = SettingsProvider.getInstance().getSettings( "pyfaServiceFittingOptions", serviceFittingDefaultOptions) From 134365c764ae8eb77efc6209de7a18376eeadf46 Mon Sep 17 00:00:00 2001 From: blitzman Date: Fri, 10 Feb 2017 00:29:25 -0500 Subject: [PATCH 36/52] Reverts commit de87c9, and instead uses the `mod` variable to access the method needed. Conflicts: service/fit.py --- eos/effectHandlerHelpers.py | 18 ++++++++++-------- service/fit.py | 8 +++----- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/eos/effectHandlerHelpers.py b/eos/effectHandlerHelpers.py index daa68c5c4..8e73d42b6 100644 --- a/eos/effectHandlerHelpers.py +++ b/eos/effectHandlerHelpers.py @@ -152,21 +152,23 @@ class HandledModuleList(HandledList): for i in xrange(oldPos, len(self)): self[i].position -= 1 + def toDummy(self, index): + mod = self[index] + if not mod.isEmpty: + dummy = mod.buildEmpty(mod.slot) + dummy.position = index + self[index] = dummy + + def toModule(self, index, mod): mod.position = index self[index] = mod - def toDummy(self, index, dummy): - mod = self[index] - if not mod.isEmpty: - dummy.position = index - self[index] = dummy - - def freeSlot(self, slot, dummy): + def freeSlot(self, slot): for i in range(len(self)): mod = self[i] if mod.getModifiedItemAttr("subSystemSlot") == slot: - self.toDummy(i, dummy) + self.toDummy(i) break diff --git a/service/fit.py b/service/fit.py index dec2ae647..2d67a1c82 100644 --- a/service/fit.py +++ b/service/fit.py @@ -433,7 +433,7 @@ class Fit(object): return False if m.item.category.name == "Subsystem": - fit.modules.freeSlot(m.getModifiedItemAttr("subSystemSlot"), es_Module.buildEmpty(m.slot)) + fit.modules.freeSlot(m.getModifiedItemAttr("subSystemSlot")) if m.fits(fit): m.owner = fit @@ -460,8 +460,7 @@ class Fit(object): return None numSlots = len(fit.modules) - dummy_module = es_Module.buildEmpty(fit.modules[position].slot) - fit.modules.toDummy(position, dummy_module) + fit.modules.toDummy(position) self.recalc(fit) self.checkStates(fit, None) fit.fill() @@ -472,8 +471,7 @@ class Fit(object): fit = eos.db.getFit(fitID) # Dummy it out in case the next bit fails - dummy_module = es_Module.buildEmpty(fit.modules[position].slot) - fit.modules.toDummy(position, dummy_module) + fit.modules.toDummy(position) item = eos.db.getItem(newItemID, eager=("attributes", "group.category")) try: From 72ebafe925f4cf9192027bc53c59698334213d9f Mon Sep 17 00:00:00 2001 From: blitzman Date: Fri, 10 Feb 2017 00:37:45 -0500 Subject: [PATCH 37/52] Remove redundant init --- eos/saveddata/fit.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/eos/saveddata/fit.py b/eos/saveddata/fit.py index 9d79930f2..237d31410 100644 --- a/eos/saveddata/fit.py +++ b/eos/saveddata/fit.py @@ -39,9 +39,6 @@ logger = logging.getLogger(__name__) class ImplantLocation(Enum): - def __init__(self): - Enum.__init__(self) - FIT = 0 CHARACTER = 1 From af44d878d1b1514c3fdf17f4b04a64fb4e6f40a6 Mon Sep 17 00:00:00 2001 From: blitzman Date: Fri, 10 Feb 2017 00:57:53 -0500 Subject: [PATCH 38/52] tweak --- gui/mainFrame.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gui/mainFrame.py b/gui/mainFrame.py index feb9df659..cbaa885cf 100644 --- a/gui/mainFrame.py +++ b/gui/mainFrame.py @@ -142,9 +142,9 @@ class MainFrame(wx.Frame): @classmethod def getInstance(cls): - return cls.__instance if cls.__instance is not None else MainFrame("") + return cls.__instance if cls.__instance is not None else MainFrame() - def __init__(self, title): + def __init__(self, title="pyfa"): self.title = title wx.Frame.__init__(self, None, wx.ID_ANY, self.title) From 3c641606da5b3ee7dff733541169f84ebbf80482 Mon Sep 17 00:00:00 2001 From: Ebag333 Date: Fri, 10 Feb 2017 05:41:06 -0800 Subject: [PATCH 39/52] Revert until we actually get a Linux developer. --- gui/itemStats.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gui/itemStats.py b/gui/itemStats.py index 0823ce7ff..1fcf5b466 100644 --- a/gui/itemStats.py +++ b/gui/itemStats.py @@ -859,7 +859,7 @@ class ItemEffects(wx.Panel): elif 'wxMac' in wx.PlatformInfo: os.system("open " + file_) else: - subprocess.call({"xdg-open": file_}) + subprocess.call(["xdg-open", file_]) def RefreshValues(self, event): self.Freeze() From 514f927a5666e2dcda056f7bb4aadc920bc10cc9 Mon Sep 17 00:00:00 2001 From: Ebag333 Date: Fri, 10 Feb 2017 05:50:32 -0800 Subject: [PATCH 40/52] Revert removing call. This class likely needs to be callable. --- service/eveapi.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/service/eveapi.py b/service/eveapi.py index 11a837994..c4ac681a0 100644 --- a/service/eveapi.py +++ b/service/eveapi.py @@ -346,6 +346,19 @@ class _Context(object): # perform arcane attribute majick trick return _Context(self._root, self._path + "/" + this, self.parameters) + def __call__(self, **kw): + if kw: + # specified keywords override contextual ones + for k, v in self.parameters.iteritems(): + if k not in kw: + kw[k] = v + else: + # no keywords provided, just update with contextual ones. + kw.update(self.parameters) + + # now let the root context handle it further + return self._root(self._path, **kw) + class _AuthContext(_Context): def character(self, characterID): From f610f525bac26cbd0e33aed1ed0ee42989db1ec3 Mon Sep 17 00:00:00 2001 From: Ebag333 Date: Fri, 10 Feb 2017 06:44:40 -0800 Subject: [PATCH 41/52] Use getattr directly, insead of doing a check then setting it (yay for defaults) --- gui/builtinViews/fittingView.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/gui/builtinViews/fittingView.py b/gui/builtinViews/fittingView.py index 8e1342768..3584f869f 100644 --- a/gui/builtinViews/fittingView.py +++ b/gui/builtinViews/fittingView.py @@ -406,13 +406,10 @@ class FittingView(d.Display): if mod1.slot != mod2.slot: return - if not getattr(mod2, "modPosition"): - self.mods.modPosition = mod2.modPosition = dstRow - if clone and mod2.isEmpty: - sFit.cloneModule(self.mainFrame.getActiveFit(), srcIdx, mod2.modPosition) + sFit.cloneModule(self.mainFrame.getActiveFit(), srcIdx, getattr(mod2, "modPosition", dstRow)) else: - sFit.swapModules(self.mainFrame.getActiveFit(), srcIdx, mod2.modPosition) + sFit.swapModules(self.mainFrame.getActiveFit(), srcIdx, getattr(mod2, "modPosition", dstRow)) wx.PostEvent(self.mainFrame, GE.FitChanged(fitID=self.mainFrame.getActiveFit())) From cdabd83afe800b5e4b92c0662d09faf2b93d380d Mon Sep 17 00:00:00 2001 From: Ebag333 Date: Fri, 10 Feb 2017 07:19:33 -0800 Subject: [PATCH 42/52] Remove old init --- gui/boosterView.py | 1 - gui/builtinViews/fittingView.py | 1 - gui/cargoView.py | 1 - gui/commandView.py | 1 - gui/droneView.py | 1 - gui/fighterView.py | 1 - gui/projectedView.py | 1 - 7 files changed, 7 deletions(-) diff --git a/gui/boosterView.py b/gui/boosterView.py index 8b9209339..9de3ffd75 100644 --- a/gui/boosterView.py +++ b/gui/boosterView.py @@ -30,7 +30,6 @@ from service.fit import Fit class BoosterViewDrop(wx.PyDropTarget): def __init__(self, dropFn, *args, **kwargs): super(BoosterViewDrop, self).__init__(*args, **kwargs) - wx.PyDropTarget.__init__(self) self.dropFn = dropFn # this is really transferring an EVE itemID self.dropData = wx.PyTextDataObject() diff --git a/gui/builtinViews/fittingView.py b/gui/builtinViews/fittingView.py index 3584f869f..3a9459c97 100644 --- a/gui/builtinViews/fittingView.py +++ b/gui/builtinViews/fittingView.py @@ -101,7 +101,6 @@ FitSpawner.register() class FittingViewDrop(wx.PyDropTarget): def __init__(self, dropFn, *args, **kwargs): super(FittingViewDrop, self).__init__(*args, **kwargs) - wx.PyDropTarget.__init__(self) self.dropFn = dropFn # this is really transferring an EVE itemID self.dropData = wx.PyTextDataObject() diff --git a/gui/cargoView.py b/gui/cargoView.py index e50f68354..d997afa79 100644 --- a/gui/cargoView.py +++ b/gui/cargoView.py @@ -30,7 +30,6 @@ from service.market import Market class CargoViewDrop(wx.PyDropTarget): def __init__(self, dropFn, *args, **kwargs): super(CargoViewDrop, self).__init__(*args, **kwargs) - wx.PyDropTarget.__init__(self) self.dropFn = dropFn # this is really transferring an EVE itemID self.dropData = wx.PyTextDataObject() diff --git a/gui/commandView.py b/gui/commandView.py index fc0f1de47..38dec46c9 100644 --- a/gui/commandView.py +++ b/gui/commandView.py @@ -43,7 +43,6 @@ class DummyEntry(object): class CommandViewDrop(wx.PyDropTarget): def __init__(self, dropFn, *args, **kwargs): super(CommandViewDrop, self).__init__(*args, **kwargs) - wx.PyDropTarget.__init__(self) self.dropFn = dropFn # this is really transferring an EVE itemID self.dropData = wx.PyTextDataObject() diff --git a/gui/droneView.py b/gui/droneView.py index 5c6c44db4..cb08f8d1d 100644 --- a/gui/droneView.py +++ b/gui/droneView.py @@ -32,7 +32,6 @@ from service.market import Market class DroneViewDrop(wx.PyDropTarget): def __init__(self, dropFn, *args, **kwargs): super(DroneViewDrop, self).__init__(*args, **kwargs) - wx.PyDropTarget.__init__(self) self.dropFn = dropFn # this is really transferring an EVE itemID self.dropData = wx.PyTextDataObject() diff --git a/gui/fighterView.py b/gui/fighterView.py index 292b7fb80..2a0a9a682 100644 --- a/gui/fighterView.py +++ b/gui/fighterView.py @@ -34,7 +34,6 @@ from service.market import Market class FighterViewDrop(wx.PyDropTarget): def __init__(self, dropFn, *args, **kwargs): super(FighterViewDrop, self).__init__(*args, **kwargs) - wx.PyDropTarget.__init__(self) self.dropFn = dropFn # this is really transferring an EVE itemID self.dropData = wx.PyTextDataObject() diff --git a/gui/projectedView.py b/gui/projectedView.py index 2447438d9..091c4a94d 100644 --- a/gui/projectedView.py +++ b/gui/projectedView.py @@ -45,7 +45,6 @@ class DummyEntry(object): class ProjectedViewDrop(wx.PyDropTarget): def __init__(self, dropFn, *args, **kwargs): super(ProjectedViewDrop, self).__init__(*args, **kwargs) - wx.PyDropTarget.__init__(self) self.dropFn = dropFn # this is really transferring an EVE itemID self.dropData = wx.PyTextDataObject() From 6b37e2c9737ea9d8585e22710aa56cad9fd08888 Mon Sep 17 00:00:00 2001 From: Ebag333 Date: Fri, 10 Feb 2017 10:09:11 -0800 Subject: [PATCH 43/52] More clean handling of possibly missing attributes. Thanks @blitzmann! --- gui/builtinViews/fittingView.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/gui/builtinViews/fittingView.py b/gui/builtinViews/fittingView.py index 3a9459c97..9235eb7cb 100644 --- a/gui/builtinViews/fittingView.py +++ b/gui/builtinViews/fittingView.py @@ -405,12 +405,15 @@ class FittingView(d.Display): if mod1.slot != mod2.slot: return - if clone and mod2.isEmpty: - sFit.cloneModule(self.mainFrame.getActiveFit(), srcIdx, getattr(mod2, "modPosition", dstRow)) - else: - sFit.swapModules(self.mainFrame.getActiveFit(), srcIdx, getattr(mod2, "modPosition", dstRow)) + if getattr(mod2, "modPosition"): + if clone and mod2.isEmpty: + sFit.cloneModule(self.mainFrame.getActiveFit(), srcIdx, mod2.modPosition) + else: + sFit.swapModules(self.mainFrame.getActiveFit(), srcIdx, mod2.modPosition) - wx.PostEvent(self.mainFrame, GE.FitChanged(fitID=self.mainFrame.getActiveFit())) + wx.PostEvent(self.mainFrame, GE.FitChanged(fitID=self.mainFrame.getActiveFit())) + else: + logger.error("Missing module position for: %s", str(getattr(mod2, "ID", "Unknown"))) def generateMods(self): """ From 0fc45ead6e27955eaef7f4062000ba6cc457d119 Mon Sep 17 00:00:00 2001 From: Ebag333 Date: Fri, 10 Feb 2017 11:16:51 -0800 Subject: [PATCH 44/52] Catch missing import --- gui/builtinViews/fittingView.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/gui/builtinViews/fittingView.py b/gui/builtinViews/fittingView.py index 9235eb7cb..45be46514 100644 --- a/gui/builtinViews/fittingView.py +++ b/gui/builtinViews/fittingView.py @@ -34,6 +34,7 @@ from gui.bitmapLoader import BitmapLoader import gui.builtinViews.emptyView from gui.utils.exportHtml import exportHtml from logging import getLogger +from gui.chromeTabs import EVT_NOTEBOOK_PAGE_CHANGED from service.fit import Fit from service.market import Market @@ -159,7 +160,7 @@ class FittingView(d.Display): self.Bind(wx.EVT_SHOW, self.OnShow) self.Bind(wx.EVT_MOTION, self.OnMouseMove) self.Bind(wx.EVT_LEAVE_WINDOW, self.OnLeaveWindow) - self.parent.Bind(gui.chromeTabs.EVT_NOTEBOOK_PAGE_CHANGED, self.pageChanged) + self.parent.Bind(EVT_NOTEBOOK_PAGE_CHANGED, self.pageChanged) def OnLeaveWindow(self, event): self.SetToolTip(None) @@ -208,7 +209,7 @@ class FittingView(d.Display): wx.PostEvent(self.mainFrame, gui.shipBrowser.FitSelected(fitID=fitID)) def Destroy(self): - self.parent.Unbind(gui.chromeTabs.EVT_NOTEBOOK_PAGE_CHANGED, handler=self.pageChanged) + self.parent.Unbind(EVT_NOTEBOOK_PAGE_CHANGED, handler=self.pageChanged) self.mainFrame.Unbind(GE.FIT_CHANGED, handler=self.fitChanged) self.mainFrame.Unbind(gui.shipBrowser.EVT_FIT_RENAMED, handler=self.fitRenamed) self.mainFrame.Unbind(gui.shipBrowser.EVT_FIT_REMOVED, handler=self.fitRemoved) From 07a20203036b6d0cd6890176d6735c5223345c4e Mon Sep 17 00:00:00 2001 From: Ebag333 Date: Fri, 10 Feb 2017 11:22:06 -0800 Subject: [PATCH 45/52] Don't try and import an old version and then fail back to the 2.7 version. Just do the 2.7 version. :) --- service/pycrest/eve.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/service/pycrest/eve.py b/service/pycrest/eve.py index 56b353ad4..789be7912 100644 --- a/service/pycrest/eve.py +++ b/service/pycrest/eve.py @@ -12,10 +12,7 @@ import config from service.pycrest.compat import bytes_, text_ from service.pycrest.errors import APIException -try: - from urllib.parse import urlparse, urlunparse, parse_qsl -except ImportError: # pragma: no cover - from urlparse import urlparse, urlunparse, parse_qsl +from urlparse import urlparse, urlunparse, parse_qsl try: import pickle From 73cc17ce722520e84d4cd593666fc6729d259363 Mon Sep 17 00:00:00 2001 From: Ebag333 Date: Fri, 10 Feb 2017 11:29:52 -0800 Subject: [PATCH 46/52] Clean up some more import statements --- gui/chromeTabs.py | 3 ++- gui/graphFrame.py | 2 +- pyfa.py | 3 +++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/gui/chromeTabs.py b/gui/chromeTabs.py index d4b50b713..3265b8d8a 100644 --- a/gui/chromeTabs.py +++ b/gui/chromeTabs.py @@ -1127,8 +1127,9 @@ class PFTabsContainer(wx.Panel): color = wx.Colour(0, 0, 0) brush = wx.Brush(color) - # noinspection PyPackageRequirements + # noinspection PyPackageRequirements,PyUnresolvedReferences,PyUnresolvedReferences,PyUnresolvedReferences from Carbon.Appearance import kThemeBrushDialogBackgroundActive + # noinspection PyUnresolvedReferences brush.MacSetTheme(kThemeBrushDialogBackgroundActive) else: color = wx.SystemSettings_GetColour(wx.SYS_COLOUR_3DFACE) diff --git a/gui/graphFrame.py b/gui/graphFrame.py index df43b2cb5..8ab26d2c7 100644 --- a/gui/graphFrame.py +++ b/gui/graphFrame.py @@ -59,7 +59,7 @@ class GraphFrame(wx.Frame): from matplotlib.figure import Figure enabled = True except ImportError: - mpl = Canvas = Figure = None + matplotlib = mpl = FigureCanvasWxAgg = Canvas = Figure = None enabled = False self.legendFix = False diff --git a/pyfa.py b/pyfa.py index f89677534..6453d373e 100755 --- a/pyfa.py +++ b/pyfa.py @@ -59,6 +59,7 @@ if not hasattr(sys, 'frozen'): try: import wxversion except ImportError: + wxversion = None print("Cannot find wxPython\nYou can download wxPython (2.8+) from http://www.wxpython.org/") sys.exit(1) @@ -89,6 +90,7 @@ if not hasattr(sys, 'frozen'): print("Unknown sqlalchemy version string format, skipping check") except ImportError: + sqlalchemy = None print("Cannot find sqlalchemy.\nYou can download sqlalchemy (0.6+) from http://www.sqlalchemy.org/") sys.exit(1) @@ -97,6 +99,7 @@ if not hasattr(sys, 'frozen'): # noinspection PyPackageRequirements import dateutil.parser # noqa - Copied import statement from service/update.py except ImportError: + dateutil = None print("Cannot find python-dateutil.\nYou can download python-dateutil from https://pypi.python.org/pypi/python-dateutil") sys.exit(1) From 2b45a16872ab1b09268a00f37fbadf859e23f947 Mon Sep 17 00:00:00 2001 From: Ebag333 Date: Fri, 10 Feb 2017 11:50:04 -0800 Subject: [PATCH 47/52] Refactor most of the shadowing from outer scopes. This is a super simple change, just changing the variable used inside (mostly) lambdas. --- eos/graph/fitDps.py | 2 +- eos/modifiedAttributeDict.py | 6 +++--- eos/saveddata/booster.py | 10 +++++----- eos/saveddata/cargo.py | 6 +++--- eos/saveddata/character.py | 8 ++++---- eos/saveddata/drone.py | 10 +++++----- eos/saveddata/fighter.py | 8 ++++---- eos/saveddata/fit.py | 10 +++++----- eos/saveddata/implant.py | 6 +++--- eos/saveddata/module.py | 6 +++--- eos/saveddata/user.py | 8 ++++---- gui/builtinViews/fittingView.py | 2 +- gui/itemStats.py | 6 +++--- gui/shipBrowser.py | 4 ++-- gui/utils/exportHtml.py | 10 +++++----- 15 files changed, 51 insertions(+), 51 deletions(-) diff --git a/eos/graph/fitDps.py b/eos/graph/fitDps.py index a13a41cc5..221cbb3a1 100644 --- a/eos/graph/fitDps.py +++ b/eos/graph/fitDps.py @@ -38,7 +38,7 @@ class FitDpsGraph(Graph): fit = self.fit total = 0 distance = data["distance"] * 1000 - abssort = lambda val: -abs(val - 1) + abssort = lambda _val: -abs(_val - 1) for mod in fit.modules: if not mod.isEmpty and mod.state >= State.ACTIVE: diff --git a/eos/modifiedAttributeDict.py b/eos/modifiedAttributeDict.py index c09b8f59a..757d8a3d1 100644 --- a/eos/modifiedAttributeDict.py +++ b/eos/modifiedAttributeDict.py @@ -212,11 +212,11 @@ class ModifiedAttributeDict(collections.MutableMapping): for penalizedMultipliers in penalizedMultiplierGroups.itervalues(): # A quick explanation of how this works: # 1: Bonuses and penalties are calculated seperately, so we'll have to filter each of them - l1 = filter(lambda val: val > 1, penalizedMultipliers) - l2 = filter(lambda val: val < 1, penalizedMultipliers) + l1 = filter(lambda _val: _val > 1, penalizedMultipliers) + l2 = filter(lambda _val: _val < 1, penalizedMultipliers) # 2: The most significant bonuses take the smallest penalty, # This means we'll have to sort - abssort = lambda val: -abs(val - 1) + abssort = lambda _val: -abs(_val - 1) l1.sort(key=abssort) l2.sort(key=abssort) # 3: The first module doesn't get penalized at all diff --git a/eos/saveddata/booster.py b/eos/saveddata/booster.py index 97a90cde0..0798175d7 100644 --- a/eos/saveddata/booster.py +++ b/eos/saveddata/booster.py @@ -133,11 +133,11 @@ class Booster(HandledItem, ItemAttrShortcut): @validates("ID", "itemID", "ammoID", "active") def validator(self, key, val): - map = {"ID": lambda val: isinstance(val, int), - "itemID": lambda val: isinstance(val, int), - "ammoID": lambda val: isinstance(val, int), - "active": lambda val: isinstance(val, bool), - "slot": lambda val: isinstance(val, int) and 1 <= val <= 3} + map = {"ID": lambda _val: isinstance(_val, int), + "itemID": lambda _val: isinstance(_val, int), + "ammoID": lambda _val: isinstance(_val, int), + "active": lambda _val: isinstance(_val, bool), + "slot": lambda _val: isinstance(_val, int) and 1 <= _val <= 3} if not map[key](val): raise ValueError(str(val) + " is not a valid value for " + key) diff --git a/eos/saveddata/cargo.py b/eos/saveddata/cargo.py index 4b82dfc33..70bb150c9 100644 --- a/eos/saveddata/cargo.py +++ b/eos/saveddata/cargo.py @@ -71,9 +71,9 @@ class Cargo(HandledItem, ItemAttrShortcut): @validates("fitID", "itemID", "amount") def validator(self, key, val): - map = {"fitID": lambda val: isinstance(val, int), - "itemID": lambda val: isinstance(val, int), - "amount": lambda val: isinstance(val, int)} + map = {"fitID": lambda _val: isinstance(_val, int), + "itemID": lambda _val: isinstance(_val, int), + "amount": lambda _val: isinstance(_val, int)} if key == "amount" and val > sys.maxint: val = sys.maxint diff --git a/eos/saveddata/character.py b/eos/saveddata/character.py index 142166041..0557dca08 100644 --- a/eos/saveddata/character.py +++ b/eos/saveddata/character.py @@ -256,10 +256,10 @@ class Character(object): @validates("ID", "name", "apiKey", "ownerID") def validator(self, key, val): - map = {"ID": lambda val: isinstance(val, int), - "name": lambda val: True, - "apiKey": lambda val: val is None or (isinstance(val, basestring) and len(val) > 0), - "ownerID": lambda val: isinstance(val, int) or val is None} + map = {"ID": lambda _val: isinstance(_val, int), + "name": lambda _val: True, + "apiKey": lambda _val: _val is None or (isinstance(_val, basestring) and len(_val) > 0), + "ownerID": lambda _val: isinstance(_val, int) or _val is None} if not map[key](val): raise ValueError(str(val) + " is not a valid value for " + key) diff --git a/eos/saveddata/drone.py b/eos/saveddata/drone.py index d0e8511f5..9eaf9fc65 100644 --- a/eos/saveddata/drone.py +++ b/eos/saveddata/drone.py @@ -186,11 +186,11 @@ class Drone(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut): @validates("ID", "itemID", "chargeID", "amount", "amountActive") def validator(self, key, val): - map = {"ID": lambda val: isinstance(val, int), - "itemID": lambda val: isinstance(val, int), - "chargeID": lambda val: isinstance(val, int), - "amount": lambda val: isinstance(val, int) and val >= 0, - "amountActive": lambda val: isinstance(val, int) and self.amount >= val >= 0} + map = {"ID": lambda _val: isinstance(_val, int), + "itemID": lambda _val: isinstance(_val, int), + "chargeID": lambda _val: isinstance(_val, int), + "amount": lambda _val: isinstance(_val, int) and _val >= 0, + "amountActive": lambda _val: isinstance(_val, int) and self.amount >= _val >= 0} if not map[key](val): raise ValueError(str(val) + " is not a valid value for " + key) diff --git a/eos/saveddata/fighter.py b/eos/saveddata/fighter.py index 1e3e5f137..cc363ef0f 100644 --- a/eos/saveddata/fighter.py +++ b/eos/saveddata/fighter.py @@ -219,10 +219,10 @@ class Fighter(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut): @validates("ID", "itemID", "chargeID", "amount", "amountActive") def validator(self, key, val): - map = {"ID": lambda val: isinstance(val, int), - "itemID": lambda val: isinstance(val, int), - "chargeID": lambda val: isinstance(val, int), - "amount": lambda val: isinstance(val, int) and val >= -1, + map = {"ID": lambda _val: isinstance(_val, int), + "itemID": lambda _val: isinstance(_val, int), + "chargeID": lambda _val: isinstance(_val, int), + "amount": lambda _val: isinstance(_val, int) and _val >= -1, } if not map[key](val): diff --git a/eos/saveddata/fit.py b/eos/saveddata/fit.py index 9d79930f2..135423c1f 100644 --- a/eos/saveddata/fit.py +++ b/eos/saveddata/fit.py @@ -367,9 +367,9 @@ class Fit(object): @validates("ID", "ownerID", "shipID") def validator(self, key, val): - map = {"ID": lambda val: isinstance(val, int), - "ownerID": lambda val: isinstance(val, int) or val is None, - "shipID": lambda val: isinstance(val, int) or val is None} + map = {"ID": lambda _val: isinstance(_val, int), + "ownerID": lambda _val: isinstance(_val, int) or _val is None, + "shipID": lambda _val: isinstance(_val, int) or _val is None} if not map[key](val): raise ValueError(str(val) + " is not a valid value for " + key) @@ -1044,8 +1044,8 @@ class Fit(object): repairers.append(mod) # Sort repairers by efficiency. We want to use the most efficient repairers first - repairers.sort(key=lambda mod: mod.getModifiedItemAttr( - groupAttrMap[mod.item.group.name]) / mod.getModifiedItemAttr("capacitorNeed"), reverse=True) + repairers.sort(key=lambda _mod: _mod.getModifiedItemAttr( + groupAttrMap[_mod.item.group.name]) / _mod.getModifiedItemAttr("capacitorNeed"), reverse=True) # Loop through every module until we're above peak recharge # Most efficient first, as we sorted earlier. diff --git a/eos/saveddata/implant.py b/eos/saveddata/implant.py index 837642ca6..b2185542a 100644 --- a/eos/saveddata/implant.py +++ b/eos/saveddata/implant.py @@ -99,9 +99,9 @@ class Implant(HandledItem, ItemAttrShortcut): @validates("fitID", "itemID", "active") def validator(self, key, val): - map = {"fitID": lambda val: isinstance(val, int), - "itemID": lambda val: isinstance(val, int), - "active": lambda val: isinstance(val, bool)} + map = {"fitID": lambda _val: isinstance(_val, int), + "itemID": lambda _val: isinstance(_val, int), + "active": lambda _val: isinstance(_val, bool)} if not map[key](val): raise ValueError(str(val) + " is not a valid value for " + key) diff --git a/eos/saveddata/module.py b/eos/saveddata/module.py index 993d54765..ba41d559d 100644 --- a/eos/saveddata/module.py +++ b/eos/saveddata/module.py @@ -581,9 +581,9 @@ class Module(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut): @validates("ID", "itemID", "ammoID") def validator(self, key, val): - map = {"ID": lambda val: isinstance(val, int), - "itemID": lambda val: val is None or isinstance(val, int), - "ammoID": lambda val: isinstance(val, int)} + map = {"ID": lambda _val: isinstance(_val, int), + "itemID": lambda _val: _val is None or isinstance(_val, int), + "ammoID": lambda _val: isinstance(_val, int)} if not map[key](val): raise ValueError(str(val) + " is not a valid value for " + key) diff --git a/eos/saveddata/user.py b/eos/saveddata/user.py index 8c3905a0d..baf09d9f3 100644 --- a/eos/saveddata/user.py +++ b/eos/saveddata/user.py @@ -49,10 +49,10 @@ class User(object): @validates("ID", "username", "password", "admin") def validator(self, key, val): - map = {"ID": lambda val: isinstance(val, int), - "username": lambda val: isinstance(val, basestring), - "password": lambda val: isinstance(val, basestring) and len(val) == 96, - "admin": lambda val: isinstance(val, bool)} + map = {"ID": lambda _val: isinstance(_val, int), + "username": lambda _val: isinstance(_val, basestring), + "password": lambda _val: isinstance(_val, basestring) and len(_val) == 96, + "admin": lambda _val: isinstance(_val, bool)} if not map[key](val): raise ValueError(str(val) + " is not a valid value for " + key) diff --git a/gui/builtinViews/fittingView.py b/gui/builtinViews/fittingView.py index 45be46514..2c6c926dc 100644 --- a/gui/builtinViews/fittingView.py +++ b/gui/builtinViews/fittingView.py @@ -431,7 +431,7 @@ class FittingView(d.Display): if fit is not None: self.mods = fit.modules[:] - self.mods.sort(key=lambda mod: (slotOrder.index(mod.slot), mod.position)) + self.mods.sort(key=lambda _mod: (slotOrder.index(_mod.slot), _mod.position)) # Blanks is a list of indexes that mark non-module positions (such # as Racks and tactical Modes. This allows us to skip over common diff --git a/gui/itemStats.py b/gui/itemStats.py index 1fcf5b466..e305f1133 100644 --- a/gui/itemStats.py +++ b/gui/itemStats.py @@ -629,17 +629,17 @@ class ItemCompare(wx.Panel): if sort is not None: if sort == 0: # Name sort - func = lambda x: x.name + func = lambda _val: _val.name else: try: # Remember to reduce by 1, because the attrs array # starts at 0 while the list has the item name as column 0. attr = str(self.attrs.keys()[sort - 1]) - func = lambda x: x.attributes[attr].value if attr in x.attributes else None + func = lambda _val: _val.attributes[attr].value if attr in _val.attributes else None except IndexError: # Clicked on a column that's not part of our array (price most likely) self.sortReverse = False - func = lambda x: x.attributes['metaLevel'].value if 'metaLevel' in x.attributes else None + func = lambda _val: _val.attributes['metaLevel'].value if 'metaLevel' in _val.attributes else None self.items = sorted(self.items, key=func, reverse=self.sortReverse) diff --git a/gui/shipBrowser.py b/gui/shipBrowser.py index 6ccc1059b..9822c699d 100644 --- a/gui/shipBrowser.py +++ b/gui/shipBrowser.py @@ -685,7 +685,7 @@ class ShipBrowser(wx.Panel): if len(self.categoryList) == 0: # set cache of category list self.categoryList = list(sMkt.getShipRoot()) - self.categoryList.sort(key=lambda ship: ship.name) + self.categoryList.sort(key=lambda _ship: _ship.name) # set map & cache of fittings per category for cat in self.categoryList: @@ -928,7 +928,7 @@ class ShipBrowser(wx.Panel): fits = event.fits # sort by ship name, then fit name - fits.sort(key=lambda fit: (fit.ship.item.name, fit.name)) + fits.sort(key=lambda _fit: (_fit.ship.item.name, _fit.name)) self.lastdata = fits self.lpane.Freeze() diff --git a/gui/utils/exportHtml.py b/gui/utils/exportHtml.py index 023d18cce..802a8358b 100644 --- a/gui/utils/exportHtml.py +++ b/gui/utils/exportHtml.py @@ -169,7 +169,7 @@ class exportHtmlThread(threading.Thread): """ % (time.time(), dnaUrl, localDate) HTML += '
    \n' categoryList = list(sMkt.getShipRoot()) - categoryList.sort(key=lambda ship: ship.name) + categoryList.sort(key=lambda _ship: _ship.name) count = 0 @@ -178,7 +178,7 @@ class exportHtmlThread(threading.Thread): HTMLgroup = '' ships = list(sMkt.getShipList(group.ID)) - ships.sort(key=lambda ship: ship.name) + ships.sort(key=lambda _ship: _ship.name) # Keep track of how many ships per group groupFits = 0 @@ -248,7 +248,7 @@ class exportHtmlThread(threading.Thread): def generateMinimalHTML(self, sMkt, sFit, dnaUrl): """ Generate a minimal HTML version of the fittings, without any javascript or styling""" categoryList = list(sMkt.getShipRoot()) - categoryList.sort(key=lambda ship: ship.name) + categoryList.sort(key=lambda _ship: _ship.name) count = 0 HTML = '' @@ -256,9 +256,9 @@ class exportHtmlThread(threading.Thread): # init market group string to give ships something to attach to ships = list(sMkt.getShipList(group.ID)) - ships.sort(key=lambda ship: ship.name) + ships.sort(key=lambda _ship: _ship.name) - ships.sort(key=lambda ship: ship.name) + ships.sort(key=lambda _ship: _ship.name) for ship in ships: fits = sFit.getFitsWithShip(ship.ID) From 8c7682c6d46cce0c9668e3823c6607812b81c8f8 Mon Sep 17 00:00:00 2001 From: Ebag333 Date: Fri, 10 Feb 2017 12:02:23 -0800 Subject: [PATCH 48/52] Little more OCD on cleaning up imports. --- gui/boosterView.py | 6 +++--- gui/builtinStatsViews/rechargeViewFull.py | 4 ++-- gui/builtinStatsViews/resistancesViewFull.py | 4 ++-- gui/builtinStatsViews/resourcesViewFull.py | 4 ++-- gui/fighterView.py | 6 +++--- gui/implantView.py | 4 ++-- service/pycrest/eve.py | 1 + 7 files changed, 15 insertions(+), 14 deletions(-) diff --git a/gui/boosterView.py b/gui/boosterView.py index 9de3ffd75..fe0d802d3 100644 --- a/gui/boosterView.py +++ b/gui/boosterView.py @@ -21,7 +21,7 @@ import wx import gui.display as d import gui.globalEvents as GE -import gui.marketBrowser as mb +import gui.marketBrowser as marketBrowser from gui.builtinViewColumns.state import State from gui.contextMenu import ContextMenu from service.fit import Fit @@ -53,7 +53,7 @@ class BoosterView(d.Display): self.lastFitId = None self.mainFrame.Bind(GE.FIT_CHANGED, self.fitChanged) - self.mainFrame.Bind(mb.ITEM_SELECTED, self.addItem) + self.mainFrame.Bind(marketBrowser.ITEM_SELECTED, self.addItem) self.Bind(wx.EVT_LEFT_DCLICK, self.removeItem) self.Bind(wx.EVT_LEFT_DOWN, self.click) @@ -76,7 +76,7 @@ class BoosterView(d.Display): """ if data[0] == "market": - wx.PostEvent(self.mainFrame, mb.ItemSelected(itemID=int(data[1]))) + wx.PostEvent(self.mainFrame, marketBrowser.ItemSelected(itemID=int(data[1]))) def kbEvent(self, event): keycode = event.GetKeyCode() diff --git a/gui/builtinStatsViews/rechargeViewFull.py b/gui/builtinStatsViews/rechargeViewFull.py index 9469084ee..21399602e 100644 --- a/gui/builtinStatsViews/rechargeViewFull.py +++ b/gui/builtinStatsViews/rechargeViewFull.py @@ -23,7 +23,7 @@ from gui.statsView import StatsView from gui.bitmapLoader import BitmapLoader from gui.utils.numberFormatter import formatAmount import gui.mainFrame -import gui.builtinStatsViews.resistancesViewFull as rvf +from gui.builtinStatsViews.resistancesViewFull import EFFECTIVE_HP_TOGGLED from service.fit import Fit @@ -34,7 +34,7 @@ class RechargeViewFull(StatsView): StatsView.__init__(self) self.parent = parent self.mainFrame = gui.mainFrame.MainFrame.getInstance() - self.mainFrame.Bind(rvf.EFFECTIVE_HP_TOGGLED, self.toggleEffective) + self.mainFrame.Bind(EFFECTIVE_HP_TOGGLED, self.toggleEffective) self.effective = True def getHeaderText(self, fit): diff --git a/gui/builtinStatsViews/resistancesViewFull.py b/gui/builtinStatsViews/resistancesViewFull.py index d36f1fc24..9946310ec 100644 --- a/gui/builtinStatsViews/resistancesViewFull.py +++ b/gui/builtinStatsViews/resistancesViewFull.py @@ -21,7 +21,7 @@ import wx from gui.statsView import StatsView from gui.bitmapLoader import BitmapLoader -from gui import pygauge as PG +from gui.pygauge import PyGauge from gui.utils.numberFormatter import formatAmount import gui.mainFrame import gui.globalEvents as GE @@ -133,7 +133,7 @@ class ResistancesViewFull(StatsView): bc = pgColour[1] currGColour += 1 - lbl = PG.PyGauge(contentPanel, wx.ID_ANY, 100) + lbl = PyGauge(contentPanel, wx.ID_ANY, 100) lbl.SetMinSize((48, 16)) lbl.SetBackgroundColour(wx.Colour(bc[0], bc[1], bc[2])) lbl.SetBarColour(wx.Colour(fc[0], fc[1], fc[2])) diff --git a/gui/builtinStatsViews/resourcesViewFull.py b/gui/builtinStatsViews/resourcesViewFull.py index bff5dd0e1..3171aaa4b 100644 --- a/gui/builtinStatsViews/resourcesViewFull.py +++ b/gui/builtinStatsViews/resourcesViewFull.py @@ -21,7 +21,7 @@ import wx from gui.statsView import StatsView from gui.bitmapLoader import BitmapLoader -from gui import pygauge as PG +from gui.pygauge import PyGauge import gui.mainFrame from gui.chromeTabs import EVT_NOTEBOOK_PAGE_CHANGED @@ -176,7 +176,7 @@ class ResourcesViewFull(StatsView): # Gauges modif. - Darriele - gauge = PG.PyGauge(parent, wx.ID_ANY, 1) + gauge = PyGauge(parent, wx.ID_ANY, 1) gauge.SetValueRange(0, 0) gauge.SetMinSize((self.getTextExtentW("1.999M/1.99M MW"), 23)) gauge.SetFractionDigits(2) diff --git a/gui/fighterView.py b/gui/fighterView.py index 2a0a9a682..6332817fe 100644 --- a/gui/fighterView.py +++ b/gui/fighterView.py @@ -21,7 +21,7 @@ import wx import gui.globalEvents as GE -import gui.marketBrowser as mb +import gui.marketBrowser as marketBrowser import gui.mainFrame import gui.display as d from gui.builtinViewColumns.state import State @@ -127,7 +127,7 @@ class FighterDisplay(d.Display): self.hoveredColumn = None self.mainFrame.Bind(GE.FIT_CHANGED, self.fitChanged) - self.mainFrame.Bind(mb.ITEM_SELECTED, self.addItem) + self.mainFrame.Bind(marketBrowser.ITEM_SELECTED, self.addItem) self.Bind(wx.EVT_LEFT_DCLICK, self.removeItem) self.Bind(wx.EVT_LEFT_DOWN, self.click) self.Bind(wx.EVT_KEY_UP, self.kbEvent) @@ -204,7 +204,7 @@ class FighterDisplay(d.Display): if srcRow != -1 and dstRow != -1: self._merge(srcRow, dstRow) elif data[0] == "market": - wx.PostEvent(self.mainFrame, mb.ItemSelected(itemID=int(data[1]))) + wx.PostEvent(self.mainFrame, marketBrowser.ItemSelected(itemID=int(data[1]))) @staticmethod def _merge(src, dst): diff --git a/gui/implantView.py b/gui/implantView.py index 12e27e241..86b9afd96 100644 --- a/gui/implantView.py +++ b/gui/implantView.py @@ -20,7 +20,7 @@ # noinspection PyPackageRequirements import wx import gui.display as d -import gui.marketBrowser as mb +import gui.marketBrowser as marketBrowser import gui.mainFrame from gui.builtinViewColumns.state import State from gui.contextMenu import ContextMenu @@ -90,7 +90,7 @@ class ImplantDisplay(d.Display): self.lastFitId = None self.mainFrame.Bind(GE.FIT_CHANGED, self.fitChanged) - self.mainFrame.Bind(mb.ITEM_SELECTED, self.addItem) + self.mainFrame.Bind(marketBrowser.ITEM_SELECTED, self.addItem) self.Bind(wx.EVT_LEFT_DCLICK, self.removeItem) self.Bind(wx.EVT_LEFT_DOWN, self.click) self.Bind(wx.EVT_KEY_UP, self.kbEvent) diff --git a/service/pycrest/eve.py b/service/pycrest/eve.py index 789be7912..c96a10885 100644 --- a/service/pycrest/eve.py +++ b/service/pycrest/eve.py @@ -17,6 +17,7 @@ from urlparse import urlparse, urlunparse, parse_qsl try: import pickle except ImportError: # pragma: no cover + # noinspection PyPep8Naming import cPickle as pickle logger = logging.getLogger("pycrest.eve") From 3562577521a27cc5bfa4cf18f4732191a48fc9f9 Mon Sep 17 00:00:00 2001 From: Ebag333 Date: Fri, 10 Feb 2017 12:06:23 -0800 Subject: [PATCH 49/52] Tox fix, and catch an extra shadowing --- eos/saveddata/character.py | 4 ++-- gui/graphFrame.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eos/saveddata/character.py b/eos/saveddata/character.py index 0557dca08..4332944c2 100644 --- a/eos/saveddata/character.py +++ b/eos/saveddata/character.py @@ -377,8 +377,8 @@ class Skill(HandledItem): if hasattr(self, "_Skill__ro") and self.__ro is True and key != "characterID": raise ReadOnlyException() - map = {"characterID": lambda val: isinstance(val, int), - "skillID": lambda val: isinstance(val, int)} + map = {"characterID": lambda _val: isinstance(_val, int), + "skillID": lambda _val: isinstance(_val, int)} if not map[key](val): raise ValueError(str(val) + " is not a valid value for " + key) diff --git a/gui/graphFrame.py b/gui/graphFrame.py index 8ab26d2c7..df43b2cb5 100644 --- a/gui/graphFrame.py +++ b/gui/graphFrame.py @@ -59,7 +59,7 @@ class GraphFrame(wx.Frame): from matplotlib.figure import Figure enabled = True except ImportError: - matplotlib = mpl = FigureCanvasWxAgg = Canvas = Figure = None + mpl = Canvas = Figure = None enabled = False self.legendFix = False From a2ca5eb8a45c9134da85697a2da84e336b9a4dc7 Mon Sep 17 00:00:00 2001 From: blitzman Date: Sat, 11 Feb 2017 10:55:09 -0500 Subject: [PATCH 50/52] fix oops --- gui/graphFrame.py | 18 +++++++++++------- gui/mainFrame.py | 2 +- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/gui/graphFrame.py b/gui/graphFrame.py index bcc43b32e..2d66c4f8e 100644 --- a/gui/graphFrame.py +++ b/gui/graphFrame.py @@ -52,20 +52,26 @@ class GraphFrame(wx.Frame): global graphFrame_enabled global mplImported + self.Patch = None + self.mpl_version = -1 + try: import matplotlib as mpl - if int(mpl.__version__[0]) >= 2: + self.mpl_version = int(mpl.__version__[0]) + if self.mpl_version >= 2: mpl.use('wxagg') mplImported = True - from matplotlib.patches import Patch else: mplImported = False + from matplotlib.patches import Patch + self.Patch = Patch from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as Canvas from matplotlib.figure import Figure graphFrame_enabled = True except ImportError: mpl = Canvas = Figure = None - enabled = False + graphFrame_enabled = False + self.legendFix = False if not graphFrame_enabled: @@ -77,7 +83,7 @@ class GraphFrame(wx.Frame): except: cache_dir = os.path.expanduser(os.path.join("~", ".matplotlib")) - cache_file = config.parsePath(cache_dir, 'fontList.cache') + cache_file = parsePath(cache_dir, 'fontList.cache') if os.access(cache_dir, os.W_OK | os.X_OK) and os.path.isfile(cache_file): # remove matplotlib font cache, see #234 @@ -91,8 +97,6 @@ class GraphFrame(wx.Frame): print("pyfa: Recommended minimum matplotlib version is 1.0.0") self.legendFix = True - self.mpl_version = mpl.__version__[0] - mplImported = True wx.Frame.__init__(self, parent, title=u"pyfa: Graph Generator", style=style, size=(520, 390)) @@ -280,7 +284,7 @@ class GraphFrame(wx.Frame): selected_color = legend_colors[i] except: selected_color = None - legend2.append(Patch(color=selected_color,label=i_name),) + legend2.append(self.Patch(color=selected_color,label=i_name),) if len(legend2) > 0: leg = self.subplot.legend(handles=legend2) diff --git a/gui/mainFrame.py b/gui/mainFrame.py index cbaa885cf..de3bffc4f 100644 --- a/gui/mainFrame.py +++ b/gui/mainFrame.py @@ -952,7 +952,7 @@ class MainFrame(wx.Frame): if not self.graphFrame: self.graphFrame = GraphFrame(self) - if graphFrame.enabled: + if graphFrame.graphFrame_enabled: self.graphFrame.Show() else: self.graphFrame.SetFocus() From bfcb73f34494d0a0a741bb6a87caf7d4e4fc9daf Mon Sep 17 00:00:00 2001 From: blitzman Date: Sat, 11 Feb 2017 11:12:10 -0500 Subject: [PATCH 51/52] Fixes for #952 --- gui/mainFrame.py | 2 +- gui/mainMenuBar.py | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/gui/mainFrame.py b/gui/mainFrame.py index de3bffc4f..e2eb3a7c7 100644 --- a/gui/mainFrame.py +++ b/gui/mainFrame.py @@ -954,7 +954,7 @@ class MainFrame(wx.Frame): if graphFrame.graphFrame_enabled: self.graphFrame.Show() - else: + elif graphFrame.graphFrame_enabled: self.graphFrame.SetFocus() def openWXInspectTool(self, event): diff --git a/gui/mainMenuBar.py b/gui/mainMenuBar.py index da1b08772..a9b42cb4b 100644 --- a/gui/mainMenuBar.py +++ b/gui/mainMenuBar.py @@ -22,6 +22,7 @@ import wx import config from service.character import Character +import gui.graphFrame import gui.globalEvents as GE from gui.bitmapLoader import BitmapLoader @@ -116,6 +117,9 @@ class MainMenuBar(wx.MenuBar): graphFrameItem.SetBitmap(BitmapLoader.getBitmap("graphs_small", "gui")) windowMenu.AppendItem(graphFrameItem) + if not gui.graphFrame.graphFrame_enabled: + self.Enable(self.graphFrameId, False) + preferencesShortCut = "CTRL+," if 'wxMac' in wx.PlatformInfo else "CTRL+P" preferencesItem = wx.MenuItem(windowMenu, wx.ID_PREFERENCES, "Preferences\t" + preferencesShortCut) preferencesItem.SetBitmap(BitmapLoader.getBitmap("preferences_small", "gui")) From 81e5b33bc9e28f140d7a4ad52489ffe10002a274 Mon Sep 17 00:00:00 2001 From: blitzman Date: Sat, 11 Feb 2017 11:36:53 -0500 Subject: [PATCH 52/52] Few tweaks for price system selection --- .../pyfaGeneralPreferences.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/gui/builtinPreferenceViews/pyfaGeneralPreferences.py b/gui/builtinPreferenceViews/pyfaGeneralPreferences.py index f4074324e..d084f1b93 100644 --- a/gui/builtinPreferenceViews/pyfaGeneralPreferences.py +++ b/gui/builtinPreferenceViews/pyfaGeneralPreferences.py @@ -81,12 +81,16 @@ class PFGeneralPref(PreferenceView): wx.DefaultPosition, wx.DefaultSize, 0) mainSizer.Add(self.cbOpenFitInNew, 0, wx.ALL | wx.EXPAND, 5) + priceSizer = wx.BoxSizer(wx.HORIZONTAL) + + self.stDefaultSystem = wx.StaticText(panel, wx.ID_ANY, u"Default Market Prices:", wx.DefaultPosition, wx.DefaultSize, 0) + self.stDefaultSystem.Wrap(-1) + priceSizer.Add(self.stDefaultSystem, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5) + self.chPriceSystem = wx.Choice( panel, choices=Price.systemsList.keys()) - mainSizer.Add( self.chPriceSystem, 0, wx.ALL|wx.EXPAND, 5) + priceSizer.Add(self.chPriceSystem, 1, wx.ALL | wx.EXPAND, 5) - defCharSizer = wx.BoxSizer( wx.HORIZONTAL ) - - wx.BoxSizer(wx.HORIZONTAL) + mainSizer.Add(priceSizer, 0, wx.ALL|wx.EXPAND, 0) self.sFit = Fit.getInstance() @@ -196,14 +200,12 @@ class PFGeneralPref(PreferenceView): self.sFit.serviceFittingOptions["priceSystem"] = system fitID = self.mainFrame.getActiveFit() - fit = self.sFit.getFit(fitID) sMkt = Market.getInstance() - typeIDs = Price.fitItemsList(fit) - sMkt.getPrices(typeIDs, Price.invalidPrices) + sMkt.clearPriceCache() self.sFit.refreshFit(fitID) wx.PostEvent(self.mainFrame, GE.FitChanged(fitID=fitID)) - + event.Skip() PFGeneralPref.register()