diff --git a/.gitignore b/.gitignore index c3530eab7d..6cf50c952c 100644 --- a/.gitignore +++ b/.gitignore @@ -118,3 +118,4 @@ ENV/ .idea eos.iml gitversion +.version diff --git a/.version b/.version index 71eef1c4bc..524d0fb500 100644 --- a/.version +++ b/.version @@ -1 +1 @@ -v1.33.2-100-gc000b19 \ No newline at end of file +v1.33.2-104-g2365112 \ No newline at end of file diff --git a/config.py b/config.py index d0fd190845..716f5ef24a 100644 --- a/config.py +++ b/config.py @@ -48,6 +48,8 @@ def isFrozen(): return True else: return False + + def __createDirs(path): if not os.path.exists(path): os.makedirs(path) @@ -104,7 +106,7 @@ def defPaths(customSavePath=None): __createDirs(savePath) - #if isFrozen(): + # if isFrozen(): # os.environ["REQUESTS_CA_BUNDLE"] = os.path.join(pyfaPath, "cacert.pem") # os.environ["SSL_CERT_FILE"] = os.path.join(pyfaPath, "cacert.pem") @@ -141,6 +143,7 @@ def defPaths(customSavePath=None): from service.settings import EOSSettings eos.config.settings = EOSSettings.getInstance().EOSSettings # this is kind of confusing, but whatever + def defLogging(): global debug global logPath @@ -230,6 +233,3 @@ def flush(self): # sys.stderr is the correct way to do it, but it seemed # to work properly for me. self.level(sys.stderr) - - - diff --git a/eos/saveddata/fit.py b/eos/saveddata/fit.py index 979b007dc1..c4b8559737 100644 --- a/eos/saveddata/fit.py +++ b/eos/saveddata/fit.py @@ -756,7 +756,7 @@ def calculateModifiedAttributes(self, targetFit=None, type=CalcType.LOCAL): # Loop through our run times here. These determine which effects are run in which order. for runTime in ("early", "normal", "late"): - #pyfalog.debug("Run time: {0}", runTime) + # pyfalog.debug("Run time: {0}", runTime) # Items that are unrestricted. These items are run on the local fit # first and then projected onto the target fit it one is designated u = [ @@ -795,7 +795,7 @@ def calculateModifiedAttributes(self, targetFit=None, type=CalcType.LOCAL): # targetFit.register(item, origin=self) item.calculateModifiedAttributes(targetFit, runTime, False, True) - #pyfalog.debug("Command Bonuses: {}".format(self.commandBonuses)) + # pyfalog.debug("Command Bonuses: {}".format(self.commandBonuses)) # If we are calculating our local or projected fit and have command bonuses, apply them if type != CalcType.COMMAND and self.commandBonuses: diff --git a/gui/builtinItemStatsViews/itemAttributes.py b/gui/builtinItemStatsViews/itemAttributes.py index f5073796c5..c9850a6e5c 100644 --- a/gui/builtinItemStatsViews/itemAttributes.py +++ b/gui/builtinItemStatsViews/itemAttributes.py @@ -12,6 +12,7 @@ from service.attribute import Attribute from gui.utils.numberFormatter import formatAmount + class ItemParams(wx.Panel): def __init__(self, parent, stuff, item, context=None): wx.Panel.__init__(self, parent) @@ -226,7 +227,7 @@ def PopulateList(self): self.paramList.SetItem(index, 2, valueUnitDefault) # @todo: pheonix, this lamda used cmp() which no longer exists in py3. Probably a better way to do this in the # long run, take a look - self.paramList.SortItems(lambda id1, id2: (idNameMap[id1]>idNameMap[id2])-(idNameMap[id1] idNameMap[id2]) - (idNameMap[id1] < idNameMap[id2])) self.paramList.RefreshRows() self.totalAttrsLabel.SetLabel("%d attributes. " % idCount) self.Layout() @@ -271,5 +272,3 @@ def attributeIDCallback(): return "%s %s" % (fvalue, override[1]) else: return "%s %s" % (formatAmount(value, 3, 0), unitName) - - diff --git a/gui/builtinItemStatsViews/itemCompare.py b/gui/builtinItemStatsViews/itemCompare.py index 8e38954bd3..f91a81e2ae 100644 --- a/gui/builtinItemStatsViews/itemCompare.py +++ b/gui/builtinItemStatsViews/itemCompare.py @@ -9,6 +9,7 @@ from service.attribute import Attribute from gui.utils.numberFormatter import formatAmount + class ItemCompare(wx.Panel): def __init__(self, parent, stuff, item, items, context=None): # Start dealing with Price stuff to get that thread going @@ -205,5 +206,3 @@ def attributeIDCallback(): return "%s %s" % (fvalue, override[1]) else: return "%s %s" % (formatAmount(value, 3, 0), unitName) - - diff --git a/gui/builtinItemStatsViews/itemDependants.py b/gui/builtinItemStatsViews/itemDependants.py index ae9984b7bc..9f7e459c91 100644 --- a/gui/builtinItemStatsViews/itemDependants.py +++ b/gui/builtinItemStatsViews/itemDependants.py @@ -51,5 +51,3 @@ def getFullSkillTree(self, parentSkill, parent, sbIconId): itemIcon = -1 self.reqTree.AppendItem(child, "{}".format(item.name), itemIcon) - - diff --git a/gui/builtinItemStatsViews/itemDescription.py b/gui/builtinItemStatsViews/itemDescription.py index 8dce7138f5..ddf30dfb43 100644 --- a/gui/builtinItemStatsViews/itemDescription.py +++ b/gui/builtinItemStatsViews/itemDescription.py @@ -5,7 +5,6 @@ import re - class ItemDescription(wx.Panel): def __init__(self, parent, stuff, item): wx.Panel.__init__(self, parent) @@ -32,5 +31,3 @@ def __init__(self, parent, stuff, item): mainSizer.Add(self.description, 1, wx.ALL | wx.EXPAND, 0) self.Layout() - - diff --git a/gui/builtinItemStatsViews/itemEffects.py b/gui/builtinItemStatsViews/itemEffects.py index 0675ac3c46..8c3537ad03 100644 --- a/gui/builtinItemStatsViews/itemEffects.py +++ b/gui/builtinItemStatsViews/itemEffects.py @@ -8,6 +8,7 @@ from .helpers import AutoListCtrl + class ItemEffects(wx.Panel): def __init__(self, parent, stuff, item): wx.Panel.__init__(self, parent) @@ -127,5 +128,3 @@ def RefreshValues(self, event): self.Layout() self.Thaw() event.Skip() - - diff --git a/gui/builtinItemStatsViews/itemProperties.py b/gui/builtinItemStatsViews/itemProperties.py index 0eb13f4c8d..8a7fdacbd9 100644 --- a/gui/builtinItemStatsViews/itemProperties.py +++ b/gui/builtinItemStatsViews/itemProperties.py @@ -93,7 +93,7 @@ def PopulateList(self): # We couldn't get a property for some reason. Skip it for now. continue - self.paramList.SortItems(lambda id1, id2: (idNameMap[id1]>idNameMap[id2])-(idNameMap[id1] idNameMap[id2]) - (idNameMap[id1] < idNameMap[id2])) self.paramList.RefreshRows() self.totalAttrsLabel.SetLabel("%d attributes. " % idCount) self.Layout() diff --git a/gui/builtinItemStatsViews/itemRequirements.py b/gui/builtinItemStatsViews/itemRequirements.py index 453679a10f..dc3c947cdd 100644 --- a/gui/builtinItemStatsViews/itemRequirements.py +++ b/gui/builtinItemStatsViews/itemRequirements.py @@ -37,5 +37,3 @@ def getFullSkillTree(self, parentSkill, parent, sbIconId): if skill.ID not in self.skillIdHistory: self.getFullSkillTree(skill, child, sbIconId) self.skillIdHistory.append(skill.ID) - - diff --git a/gui/builtinItemStatsViews/itemTraits.py b/gui/builtinItemStatsViews/itemTraits.py index 0b01a4dd59..12abd078df 100644 --- a/gui/builtinItemStatsViews/itemTraits.py +++ b/gui/builtinItemStatsViews/itemTraits.py @@ -15,4 +15,3 @@ def __init__(self, parent, stuff, item): mainSizer.Add(self.traits, 1, wx.ALL | wx.EXPAND, 0) self.Layout() - diff --git a/gui/builtinMarketBrowser/itemView.py b/gui/builtinMarketBrowser/itemView.py index 52abea8779..f2b5a7627a 100644 --- a/gui/builtinMarketBrowser/itemView.py +++ b/gui/builtinMarketBrowser/itemView.py @@ -9,7 +9,7 @@ from logbook import Logger -from gui.builtinMarketBrowser.events import * +from gui.builtinMarketBrowser.events import RECENTLY_USED_MODULES, MAX_RECENTLY_USED_MODULES, ItemSelected pyfalog = Logger(__name__) diff --git a/gui/builtinMarketBrowser/marketTree.py b/gui/builtinMarketBrowser/marketTree.py index a64f59953b..8b1286e50b 100644 --- a/gui/builtinMarketBrowser/marketTree.py +++ b/gui/builtinMarketBrowser/marketTree.py @@ -1,7 +1,7 @@ import wx from gui.cachingImageList import CachingImageList -from gui.builtinMarketBrowser.events import * +from gui.builtinMarketBrowser.events import RECENTLY_USED_MODULES from logbook import Logger diff --git a/gui/builtinPreferenceViews/pyfaGaugePreferences.py b/gui/builtinPreferenceViews/pyfaGaugePreferences.py index 6e8d4ced2a..c0ca68a985 100644 --- a/gui/builtinPreferenceViews/pyfaGaugePreferences.py +++ b/gui/builtinPreferenceViews/pyfaGaugePreferences.py @@ -1,14 +1,13 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- - # noinspection PyPackageRequirements import wx import copy from gui.preferenceView import PreferenceView from gui.bitmap_loader import BitmapLoader -from gui.utils import color +from gui.utils.color import CalculateTransition import gui.utils.draw as drawUtils @@ -110,44 +109,45 @@ def SetPercentages(self, start, end): self.Refresh() def OnPaint(self, event): - rect = self.GetClientRect() - dc = wx.AutoBufferedPaintDC(self) - dc.SetBackground(wx.Brush(self.bkColor)) - dc.Clear() - - value = float(self.value) - if self.percS >= 100: - w = rect.width - else: - w = rect.width * (float(value) / 100) - r = copy.copy(rect) - r.width = w - - color = color.CalculateTransitionColor(self.colorS, self.colorE, float(value) / 100) - if self.gradientStart > 0: - gcolor = color.BrightenColor(color, float(self.gradientStart) / 100) - gMid = color.BrightenColor(color, float(self.gradientStart / 2) / 100) - else: - gcolor = color.DarkenColor(color, float(-self.gradientStart) / 100) - gMid = color.DarkenColor(color, float(-self.gradientStart / 2) / 100) - - gBmp = drawUtils.DrawGradientBar(r.width, r.height, gMid, color, gcolor) - dc.DrawBitmap(gBmp, 0, 0) - dc.SetFont(self.font) - - r = copy.copy(rect) - r.left += 1 - r.top += 1 - - formatStr = "{0:." + str(self._fractionDigits) + "f}%" - value = (self.percE - self.percS) * value / (self.percE - self.percS) - value = self.percS + (self.percE - self.percS) * value / 100 - - dc.SetTextForeground(wx.Colour(80, 80, 80)) - dc.DrawLabel(formatStr.format(value), r, wx.ALIGN_CENTER) - - dc.SetTextForeground(wx.Colour(255, 255, 255)) - dc.DrawLabel(formatStr.format(value), rect, wx.ALIGN_CENTER) + pass + # rect = self.GetClientRect() + # dc = wx.AutoBufferedPaintDC(self) + # dc.SetBackground(wx.Brush(self.bkColor)) + # dc.Clear() + # + # value = float(self.value) + # if self.percS >= 100: + # w = rect.width + # else: + # w = rect.width * (float(value) / 100) + # r = copy.copy(rect) + # r.width = w + # + # color = CalculateTransitionColor(self.colorS, self.colorE, float(value) / 100) + # if self.gradientStart > 0: + # gcolor = color.BrightenColor(color, float(self.gradientStart) / 100) + # gMid = color.BrightenColor(color, float(self.gradientStart / 2) / 100) + # else: + # gcolor = color.DarkenColor(color, float(-self.gradientStart) / 100) + # gMid = color.DarkenColor(color, float(-self.gradientStart / 2) / 100) + # + # gBmp = drawUtils.DrawGradientBar(r.width, r.height, gMid, color, gcolor) + # dc.DrawBitmap(gBmp, 0, 0) + # dc.SetFont(self.font) + # + # r = copy.copy(rect) + # r.left += 1 + # r.top += 1 + # + # formatStr = "{0:." + str(self._fractionDigits) + "f}%" + # value = (self.percE - self.percS) * value / (self.percE - self.percS) + # value = self.percS + (self.percE - self.percS) * value / 100 + # + # dc.SetTextForeground(wx.Colour(80, 80, 80)) + # dc.DrawLabel(formatStr.format(value), r, wx.ALIGN_CENTER) + # + # dc.SetTextForeground(wx.Colour(255, 255, 255)) + # dc.DrawLabel(formatStr.format(value), rect, wx.ALIGN_CENTER) class PFGaugePref(PreferenceView): diff --git a/gui/builtinPreferenceViews/pyfaHTMLExportPreferences.py b/gui/builtinPreferenceViews/pyfaHTMLExportPreferences.py index 4df2ca7cad..d73cc8e580 100644 --- a/gui/builtinPreferenceViews/pyfaHTMLExportPreferences.py +++ b/gui/builtinPreferenceViews/pyfaHTMLExportPreferences.py @@ -10,6 +10,7 @@ from service.settings import HTMLExportSettings import wx.lib.agw.hyperlink + class PFHTMLExportPref(PreferenceView): title = "HTML Export" desc = ("HTML Export (File > Export HTML) allows you to export your entire fitting " diff --git a/gui/builtinShipBrowser/categoryItem.py b/gui/builtinShipBrowser/categoryItem.py index 28ffec3bd8..b88557d22b 100644 --- a/gui/builtinShipBrowser/categoryItem.py +++ b/gui/builtinShipBrowser/categoryItem.py @@ -8,7 +8,7 @@ import gui.utils.draw as drawUtils import gui.utils.fonts as fonts from gui.bitmap_loader import BitmapLoader -from .events import * +from .events import Stage2Selected pyfalog = Logger(__name__) diff --git a/gui/builtinShipBrowser/fitItem.py b/gui/builtinShipBrowser/fitItem.py index 760916d4bc..f76e3d6f9e 100644 --- a/gui/builtinShipBrowser/fitItem.py +++ b/gui/builtinShipBrowser/fitItem.py @@ -13,7 +13,7 @@ import gui.utils.color as colorUtils import gui.utils.draw as drawUtils import gui.utils.fonts as fonts -from .events import * +from .events import ImportSelected, SearchSelected, FitSelected, BoosterListUpdated, Stage3Selected, FitRenamed, FitRemoved from gui.bitmap_loader import BitmapLoader from gui.builtinShipBrowser.pfBitmapFrame import PFBitmapFrame from service.fit import Fit diff --git a/gui/builtinShipBrowser/navigationPanel.py b/gui/builtinShipBrowser/navigationPanel.py index 414fe0b219..204802c454 100644 --- a/gui/builtinShipBrowser/navigationPanel.py +++ b/gui/builtinShipBrowser/navigationPanel.py @@ -8,7 +8,7 @@ import gui.utils.color as colorUtils import gui.utils.draw as drawUtils import gui.utils.fonts as fonts -from .events import * +from .events import FitSelected, SearchSelected, ImportSelected, Stage1Selected, Stage2Selected, Stage3Selected from gui.bitmap_loader import BitmapLoader from service.fit import Fit @@ -271,4 +271,3 @@ def gotoStage(self, stage, data=None): wx.PostEvent(self.Parent, ImportSelected(fits=data)) else: wx.PostEvent(self.Parent, Stage1Selected()) - diff --git a/gui/builtinShipBrowser/raceSelector.py b/gui/builtinShipBrowser/raceSelector.py index 5931e3aad4..809474249f 100644 --- a/gui/builtinShipBrowser/raceSelector.py +++ b/gui/builtinShipBrowser/raceSelector.py @@ -6,7 +6,7 @@ import gui.utils.anim_effects as animEffects import gui.utils.color as colorUtils import gui.utils.draw as drawUtils -from .events import * +from .events import Stage2Selected from gui.bitmap_loader import BitmapLoader pyfalog = Logger(__name__) @@ -270,4 +270,3 @@ def OnWindowLeave(self, event): self.checkMaximize = False event.Skip() - diff --git a/gui/builtinShipBrowser/shipItem.py b/gui/builtinShipBrowser/shipItem.py index 3c48cbddfe..4c679fb8a9 100644 --- a/gui/builtinShipBrowser/shipItem.py +++ b/gui/builtinShipBrowser/shipItem.py @@ -8,7 +8,7 @@ import gui.utils.color as colorUtils import gui.utils.draw as drawUtils import gui.utils.fonts as fonts -from .events import * +from .events import Stage3Selected, Stage2Selected, Stage1Selected, FitSelected from gui.bitmap_loader import BitmapLoader from gui.contextMenu import ContextMenu from service.fit import Fit diff --git a/gui/builtinStatsViews/targetingMiscViewMinimal.py b/gui/builtinStatsViews/targetingMiscViewMinimal.py index e37c4b3a49..5e17f89696 100644 --- a/gui/builtinStatsViews/targetingMiscViewMinimal.py +++ b/gui/builtinStatsViews/targetingMiscViewMinimal.py @@ -24,7 +24,6 @@ from collections import OrderedDict - class TargetingMiscViewMinimal(StatsView): name = "targetingMiscViewMinimal" diff --git a/gui/builtinViews/fittingView.py b/gui/builtinViews/fittingView.py index 2712782833..f1bb3f89df 100644 --- a/gui/builtinViews/fittingView.py +++ b/gui/builtinViews/fittingView.py @@ -25,7 +25,7 @@ from gui.builtinMarketBrowser.events import ItemSelected, ITEM_SELECTED import gui.display as d from gui.contextMenu import ContextMenu -from gui.builtinShipBrowser.events import * +from gui.builtinShipBrowser.events import EVT_FIT_RENAMED, EVT_FIT_REMOVED, FitSelected, EVT_FIT_SELECTED import gui.multiSwitch from eos.saveddata.mode import Mode from eos.saveddata.module import Module, Slot, Rack @@ -77,10 +77,10 @@ def fitSelected(self, event): self.multiSwitch.AddPage() view = self.multiSwitch.GetSelectedPage() - + if not isinstance(view, FittingView): view = FittingView(self.multiSwitch) - print("###################### Created new view:"+repr(view)) + print("###################### Created new view:" + repr(view)) self.multiSwitch.ReplaceActivePage(view) view.fitSelected(event) @@ -221,7 +221,7 @@ def handleDrag(self, type, fitID): wx.PostEvent(self.mainFrame, FitSelected(fitID=fitID)) def Destroy(self): - print("+++++ Destroy "+repr(self)) + print("+++++ Destroy " + repr(self)) print(self.parent.Unbind(EVT_NOTEBOOK_PAGE_CHANGED)) print(self.mainFrame.Unbind(GE.FIT_CHANGED)) print(self.mainFrame.Unbind(EVT_FIT_RENAMED)) @@ -312,7 +312,7 @@ def fitRenamed(self, event): event.Skip() def fitSelected(self, event): - print('====== Fit Selected: '+repr(self)+str(bool(self))) + print('====== Fit Selected: ' + repr(self) + str(bool(self))) if self.parent.IsActive(self): fitID = event.fitID diff --git a/gui/characterEditor.py b/gui/characterEditor.py index 95fda70b80..080940c7d7 100644 --- a/gui/characterEditor.py +++ b/gui/characterEditor.py @@ -324,14 +324,14 @@ def __init__(self, parent): tree.AppendColumn("Skill") tree.AppendColumn("Level") - #tree.SetMainColumn(0) + # tree.SetMainColumn(0) self.root = tree.GetRootItem() # self.root = tree.AppendItem(root, "Skills") # # tree.SetItemText(self.root, 1, "Levels") - #tree.SetColumnWidth(0, 300) + # tree.SetColumnWidth(0, 300) self.btnSecStatus = wx.Button(self, wx.ID_ANY, "Sec Status: {0:.2f}".format(char.secStatus or 0.0)) self.btnSecStatus.Bind(wx.EVT_BUTTON, self.onSecStatus) @@ -622,7 +622,6 @@ def _setTreeSkillLevel(treeItem, skillID): if parent[1] in dirtyGroups: self.skillTreeListCtrl.SetItemImage(parentID, self.skillBookImageId) - event.Skip() diff --git a/gui/characterSelection.py b/gui/characterSelection.py index d6685e0fef..aba1c68fb2 100644 --- a/gui/characterSelection.py +++ b/gui/characterSelection.py @@ -27,6 +27,7 @@ import gui.mainFrame from service.character import Character from service.fit import Fit +from gui.utils.clipboard import toClipboard pyfalog = Logger(__name__) diff --git a/gui/chrome_tabs.py b/gui/chrome_tabs.py index e2212499ec..8aa85929b5 100644 --- a/gui/chrome_tabs.py +++ b/gui/chrome_tabs.py @@ -11,7 +11,7 @@ # tab index?). This will also help with finding close buttons. # ToDo: Fix page preview code (PFNotebookPagePreview) # -#=============================================================================== +#= ============================================================================== import wx import wx.lib.newevent @@ -28,6 +28,7 @@ PageAdded, EVT_NOTEBOOK_PAGE_ADDED = wx.lib.newevent.NewEvent() PageClosed, EVT_NOTEBOOK_PAGE_CLOSED = wx.lib.newevent.NewEvent() + class VetoAble(): def __init__(self): self.__vetoed = False @@ -412,7 +413,7 @@ def GetMinSize(self): mdc.SelectObject(ebmp) mdc.SetFont(self.font) textSizeX, textSizeY = mdc.GetTextExtent(self.text) - totalSize = self.left_width + self.right_width + textSizeX + self.close_btn_width/2 + 16 + self.padding*2 + totalSize = self.left_width + self.right_width + textSizeX + self.close_btn_width / 2 + 16 + self.padding* 2 mdc.SelectObject(wx.NullBitmap) return totalSize, self.tab_height @@ -512,7 +513,7 @@ def InitTabRegions(self): x_offset = self.content_width \ + self.left_width \ - self.ctab_close_bmp.GetWidth() / 2 - y_offset = (self.tab_height - self.ctab_close_bmp.GetHeight())/2 + y_offset = (self.tab_height - self.ctab_close_bmp.GetHeight()) / 2 self.close_region.Offset(x_offset, y_offset) def InitColors(self): @@ -580,8 +581,8 @@ def _Render(self): mdc.DrawBitmap( cbmp, - self.content_width + self.left_width - cbmp.GetWidth()/2, - (height - cbmp.GetHeight())/2) + self.content_width + self.left_width - cbmp.GetWidth() / 2, + (height - cbmp.GetHeight()) / 2) mdc.SelectObject(wx.NullBitmap) @@ -594,7 +595,6 @@ def _Render(self): bmp = wx.Bitmap(img) self.tab_bitmap = bmp - def __repr__(self): return "_TabRenderer(text={}, disabled={}) at {}".format( self.text, self.disabled, hex(id(self)) @@ -620,7 +620,7 @@ def __init__(self): def GetPosition(self): return self.position - def SetPosition(self,pos): + def SetPosition(self, pos): self.position = pos def GetSize(self): @@ -869,7 +869,7 @@ def OnLeftUp(self, event): for tab in self.tabs: if self.CheckTabClose(tab, mposx, mposy): return - + def DisableTab(self, tab, disabled=True): tb_renderer = self.tabs[tab] tb_renderer.disabled = disabled @@ -1249,7 +1249,7 @@ def UpdateTabsPosition(self, skip_tab=None): selected = None for i in range(len(self.tabs) - 1, -1, -1): tab = self.tabs[i] - width = tab.tab_width - self.inclination*2 + width = tab.tab_width - self.inclination * 2 pos -= width if not tab.IsSelected(): tab.SetPosition((pos, self.container_height - self.height)) @@ -1260,12 +1260,8 @@ def UpdateTabsPosition(self, skip_tab=None): if selected is not skip_tab: selected.SetPosition((selpos, self.container_height - self.height)) - self.add_button.SetPosition(( - round(tabsWidth) - + self.inclination*2, - self.container_height - - self.height / 2 - - self.add_button.GetHeight()/3)) + self.add_button.SetPosition((round(tabsWidth) + self.inclination * 2, + self.container_height - self.height / 2 - self.add_button.GetHeight() / 3)) def OnLeaveWindow(self, event): if self.start_drag and not self.dragging: @@ -1292,7 +1288,7 @@ def OnTimer(self, event): if page.Snapshot(): self.preview_wnd = PFNotebookPagePreview( self, - (mposx+3, mposy+3), + (mposx + 3, mposy + 3), page.Snapshot(), self.preview_tab.text) self.preview_wnd.Show() @@ -1332,13 +1328,13 @@ def __init__(self, parent, pos, bitmap, title): else: width = bitmap.GetWidth() - self.SetSize((width, bitmap.GetHeight()+16)) + self.SetSize((width, bitmap.GetHeight() + 16)) self.SetTransparent(0) self.Refresh() def OnTimer(self, event): - self.transp += 20*self.direction + self.transp += 20 * self.direction if self.transp > 220: self.transp = 220 @@ -1347,7 +1343,7 @@ def OnTimer(self, event): if self.transp < 0: self.transp = 0 self.timer.Stop() - wx.Frame.Show(self,False) + wx.Frame.Show(self, False) self.Destroy() return self.SetTransparent(self.transp) @@ -1371,8 +1367,7 @@ def Show(self, showWnd=True): self.direction = -1 self.timer.Start(10) - - def OnWindowEraseBk(self,event): + def OnWindowEraseBk(self, event): pass def OnWindowPaint(self, event): @@ -1384,18 +1379,16 @@ def OnWindowPaint(self, event): mdc.SetBackground(wx.Brush(color)) mdc.Clear() - font = wx.Font(10, wx.SWISS, wx.NORMAL,wx.NORMAL, False) + font = wx.Font(10, wx.SWISS, wx.NORMAL, wx.NORMAL, False) mdc.SetFont(font) - x,y = mdc.GetTextExtent(self.title) + x, y = mdc.GetTextExtent(self.title) mdc.SetBrush(wx.Brush(wx.SystemSettings.GetColour(wx.SYS_COLOUR_WINDOWTEXT))) mdc.DrawRectangle(0, 0, rect.width, 16) mdc.SetTextForeground(wx.SystemSettings.GetColour(wx.SYS_COLOUR_WINDOW)) - mdc.DrawText(self.title, (rect.width - x)/2, (16 - y)/2) - mdc.DrawBitmap(self.bitmap, 0, 16) mdc.SetPen(wx.Pen("#000000", width=1)) diff --git a/gui/crestFittings.py b/gui/crestFittings.py index ed1b62ce46..718b6654bb 100644 --- a/gui/crestFittings.py +++ b/gui/crestFittings.py @@ -16,10 +16,10 @@ from logbook import Logger import calendar -pyfalog = Logger(__name__) - from service.crest import Crest, CrestModes +pyfalog = Logger(__name__) + class CrestFittings(wx.Frame): def __init__(self, parent): diff --git a/gui/devTools.py b/gui/devTools.py index 89d9a6f97d..98a14662c9 100644 --- a/gui/devTools.py +++ b/gui/devTools.py @@ -21,6 +21,11 @@ import wx from logbook import Logger import gc +import eos +import time +import threading +from gui.builtinShipBrowser.events import FitSelected + pyfalog = Logger(__name__) @@ -48,14 +53,17 @@ def __init__(self, parent): self.gcCollect.Bind(wx.EVT_BUTTON, self.gc_collect) + self.fitTest = wx.Button(self, wx.ID_ANY, "Test fits", wx.DefaultPosition, wx.DefaultSize, 0) + mainSizer.Add(self.fitTest, 0, wx.EXPAND | wx.TOP | wx.BOTTOM, 5) + + self.fitTest .Bind(wx.EVT_BUTTON, self.fit_test) + self.SetSizer(mainSizer) self.Layout() self.CenterOnParent() self.Show() - - def objects_by_id(self, evt): input = self.id_get.GetValue() if input.startswith("0x"): @@ -77,3 +85,30 @@ def gc_collect(self, evt): print(gc.collect()) print(gc.get_debug()) print(gc.get_stats()) + + def fit_test(self, evt): + fits = eos.db.getFitList() + self.thread = FitTestThread([x.ID for x in fits], self.Parent) + self.thread.start() + + +class FitTestThread(threading.Thread): + def __init__(self, fitIDs, mainFrame): + threading.Thread.__init__(self) + self.name = "FitTestThread" + self.mainFrame = mainFrame + self.stopRunning = False + self.fits = fitIDs + + def stop(self): + self.stopRunning = True + + def run(self): + # wait 1 second just in case a lot of modifications get made + if self.stopRunning: + return + + for fit in self.fits: + time.sleep(1) + e = FitSelected(fitID=fit) + wx.PostEvent(self.mainFrame, e) diff --git a/gui/errorDialog.py b/gui/errorDialog.py index 7188efb598..27bf842fbc 100644 --- a/gui/errorDialog.py +++ b/gui/errorDialog.py @@ -39,7 +39,7 @@ def HandleException(cls, exc_type, exc_value, exc_traceback): with config.logging_setup.threadbound(): # Print the base level traceback t = traceback.format_exception(exc_type, exc_value, exc_traceback) - pyfalog.critical("\n\n"+"".join(t)) + pyfalog.critical("\n\n" + "".join(t)) if cls.__parent is None: app = wx.App(False) @@ -59,8 +59,6 @@ def SetParent(cls, parent): class ErrorFrame(wx.Frame): def __init__(self, parent=None, error_title='Error!'): - v = sys.version_info - wx.Frame.__init__(self, parent, id=wx.ID_ANY, title="pyfa error", pos=wx.DefaultPosition, size=wx.Size(500, 600), style=wx.DEFAULT_FRAME_STYLE ^ wx.RESIZE_BORDER | wx.STAY_ON_TOP) @@ -98,7 +96,8 @@ def __init__(self, parent=None, error_title='Error!'): # mainSizer.AddSpacer((0, 5), 0, wx.EXPAND, 5) - self.errorTextCtrl = wx.TextCtrl(self, wx.ID_ANY, version_block.strip(), wx.DefaultPosition, (-1, 400), wx.TE_MULTILINE | wx.TE_READONLY | wx.TE_RICH2 | wx.TE_DONTWRAP) + self.errorTextCtrl = wx.TextCtrl(self, wx.ID_ANY, version_block.strip(), wx.DefaultPosition, + (-1, 400), wx.TE_MULTILINE | wx.TE_READONLY | wx.TE_RICH2 | wx.TE_DONTWRAP) self.errorTextCtrl.SetFont(wx.Font(8, wx.FONTFAMILY_TELETYPE, wx.NORMAL, wx.NORMAL)) mainSizer.Add(self.errorTextCtrl, 0, wx.EXPAND | wx.ALL | wx.ALIGN_CENTER, 5) self.errorTextCtrl.AppendText("\n") @@ -113,9 +112,8 @@ def __init__(self, parent=None, error_title='Error!'): self.Show() - def OnClose(self, evt): self.Hide() def addException(self, text): - self.errorTextCtrl.AppendText("\n{}\n\n{}".format("#" * 20, text)) \ No newline at end of file + self.errorTextCtrl.AppendText("\n{}\n\n{}".format("#" * 20, text)) diff --git a/gui/mainFrame.py b/gui/mainFrame.py index 849c295fe7..2aa6bb7508 100644 --- a/gui/mainFrame.py +++ b/gui/mainFrame.py @@ -137,6 +137,7 @@ def run(self): wx.PostEvent(self.mainFrame, FitSelected(fitID=self.fits[-1], startup=2)) wx.CallAfter(self.callback) + # todo: include IPortUser again class MainFrame(wx.Frame): __instance = None @@ -356,10 +357,9 @@ def ExitApp(self, event): event.Skip() def ShowAboutBox(self, evt): - v = sys.version_info info = wx.adv.AboutDialogInfo() info.Name = "pyfa" - info.Version = config.getGitVersion() # gui.aboutData.versionString + info.Version = config.getGitVersion() # gui.aboutData.versionString # # try: # import matplotlib diff --git a/gui/mainMenuBar.py b/gui/mainMenuBar.py index 7fba900e23..be9322010a 100644 --- a/gui/mainMenuBar.py +++ b/gui/mainMenuBar.py @@ -28,11 +28,11 @@ from gui.bitmap_loader import BitmapLoader from logbook import Logger -pyfalog = Logger(__name__) - from service.crest import Crest from service.crest import CrestModes +pyfalog = Logger(__name__) + class MainMenuBar(wx.MenuBar): def __init__(self, mainFrame): diff --git a/gui/pyfa_gauge.py b/gui/pyfa_gauge.py index 6e464066b5..de0ce1ba81 100644 --- a/gui/pyfa_gauge.py +++ b/gui/pyfa_gauge.py @@ -1,4 +1,4 @@ -#=============================================================================== +# =============================================================================== # PyfaGauge is a generic Gauge implementation tailored for pyfa (the Python # Fitting Assistant). It uses the easeOutQuad equation from # caurina.transitions.Tweener to do animations @@ -11,7 +11,7 @@ # ToDo: possibly devise a way to determine transition percents on init # (currently hardcoded) # -#=============================================================================== +# =============================================================================== import copy import wx @@ -52,10 +52,10 @@ def __init__(self, parent, font, max_range=100, size=(-1, 30), *args, # transition colors used based on how full (or overfilled) the gauge is. self.transition_colors = [ - (wx.Colour(191, 191, 191), wx.Colour(96, 191, 0)), # < 0-100% - (wx.Colour(191, 167, 96), wx.Colour(255, 191, 0)), # < 100-101% - (wx.Colour(255, 191, 0), wx.Colour(255, 128, 0)), # < 101-103% - (wx.Colour(255, 128, 0), wx.Colour(255, 0, 0)) # < 103-105% + (wx.Colour(191, 191, 191), wx.Colour(96, 191, 0)), # < 0-100% + (wx.Colour(191, 167, 96), wx.Colour(255, 191, 0)), # < 100-101% + (wx.Colour(255, 191, 0), wx.Colour(255, 128, 0)), # < 101-103% + (wx.Colour(255, 128, 0), wx.Colour(255, 0, 0)) # < 103-105% ] self.gradient_effect = -35 @@ -91,19 +91,18 @@ def OnWindowLeave(self, event): def GetBorderColour(self): return self._border_colour - def SetBorderColour(self, colour: wx.Colour): + def SetBorderColour(self, colour): self._border_colour = colour def GetBarColour(self): return self._bar_colour - def SetBarColour(self, colour: wx.Colour=None): + def SetBarColour(self, colour): self._bar_colour = colour def SetFractionDigits(self, digits): self._fraction_digits = digits - def GetBarGradient(self): if self._bar_gradient is None: return None @@ -119,7 +118,7 @@ def SetBarGradient(self, gradient=None): else: self._bar_gradient = list(gradient) - def GetBorderPadding(self) -> int: + def GetBorderPadding(self): return self._border_padding def SetBorderPadding(self, padding): @@ -153,7 +152,7 @@ def SetRange(self, range, reinit=False, animate=True): if reinit is False: self._old_percentage = self._percentage - self._percentage = (self._value/self._max_range) * 100 + self._percentage = (self._value / self._max_range) * 100 else: self._old_percentage = self._percentage self._percentage = 0 @@ -162,7 +161,7 @@ def SetRange(self, range, reinit=False, animate=True): if animate: self.Animate() - self._tooltip.SetTip("%.2f/%.2f" % (self._value, self._max_range if self._max_range >0.01 else 0)) + self._tooltip.SetTip("%.2f/%.2f" % (self._value, self._max_range if self._max_range > 0.01 else 0)) def GetValue(self): return self._value @@ -178,7 +177,7 @@ def SetValue(self, value, animate=True): if value < 0: self._value = 0 - self._percentage = (self._value/self._max_range) * 100 + self._percentage = (self._value / self._max_range) * 100 if animate: self.Animate() @@ -270,16 +269,16 @@ def OnPaint(self, event): # progress between the two transition ranges) pv = value if pv <= 100: - xv = pv/100 + xv = pv / 100 transition = 0 elif pv <= 101: xv = pv - 100 transition = 1 elif pv <= 103: - xv = (pv - 101)/2 + xv = (pv - 101) / 2 transition = 2 elif pv <= 105: - xv = (pv - 103)/2 + xv = (pv - 103) / 2 transition = 3 else: pv = 106 @@ -301,7 +300,7 @@ def OnPaint(self, event): gradient_mid = color_utils.Brighten(color, mid_factor) else: gradient_color = color_utils.Darken(color, color_factor * -1) - gradient_mid = color_utils.Darken(color, mid_factor * -1) + gradient_mid = color_utils.Darken(color, mid_factor * -1) # draw bar gradient_bitmap = draw.DrawGradientBar( @@ -389,6 +388,7 @@ def OnTimer(self, event): self.Refresh() + if __name__ == "__main__": def frange(x, y, jump): while x < y: @@ -437,9 +437,7 @@ def __init__(self, title, size=(500, 800)): main_sizer.Add(panel) self.SetSizer(main_sizer) - app = wx.App(redirect=False) # Error messages go to popup window top = Frame("Test Chrome Tabs") top.Show() app.MainLoop() - diff --git a/gui/shipBrowser.py b/gui/shipBrowser.py index 7163a38306..2b12edd8c3 100644 --- a/gui/shipBrowser.py +++ b/gui/shipBrowser.py @@ -11,7 +11,7 @@ from service.fit import Fit from service.market import Market -from gui.builtinShipBrowser.events import * +from gui.builtinShipBrowser.events import EVT_SB_IMPORT_SEL, EVT_SB_STAGE1_SEL, EVT_SB_STAGE2_SEL, EVT_SB_STAGE3_SEL, EVT_SB_SEARCH_SEL from gui.builtinShipBrowser.pfWidgetContainer import PFWidgetsContainer from gui.builtinShipBrowser.navigationPanel import NavigationPanel from gui.builtinShipBrowser.raceSelector import RaceSelector diff --git a/gui/toggle_panel.py b/gui/toggle_panel.py index 0813ae26d2..2f7421d385 100644 --- a/gui/toggle_panel.py +++ b/gui/toggle_panel.py @@ -1,4 +1,4 @@ -#=============================================================================== +# =============================================================================== # TogglePanel is based on PyCollapsiblePane - includes a few improvements # such as adding items to header, lack of button implementation ("GTK # expander" style is implemented with plain text with unicode arrows rather @@ -10,7 +10,7 @@ # # ToDo: Create animations for collapsing / expanding # -#=============================================================================== +# =============================================================================== import wx @@ -38,7 +38,7 @@ def __init__(self, parent, force_layout=False, *args, **kargs): # Add arrow self.header_arrow = wx.StaticText(self.header_panel, wx.ID_ANY, "\u25bc", size=wx.Size((10, -1))) - header_sizer.Add(self.header_arrow, 0, wx.RIGHT, 5) + header_sizer.Add(self.header_arrow, 0, wx.RIGHT, 5) # Add header text self.header_label = wx.StaticText(self.header_panel, wx.ID_ANY, "") @@ -120,7 +120,7 @@ def OnStateChange(self, sz): self.parent.Fit() def ToggleContent(self, event): - #self.Freeze() + # self.Freeze() if self._toggled: # If we are expanded, save previous size and collapse by setting @@ -135,13 +135,14 @@ def ToggleContent(self, event): self._toggled = not self._toggled - #self.Thaw() + # self.Thaw() if self.force_layout: self.parent.Layout() else: self.OnStateChange(self.GetBestSize()) + if __name__ == "__main__": from wx.lib.inspection import InspectionTool @@ -166,7 +167,7 @@ def __init__(self, parent): content_sizer = wx.BoxSizer(wx.HORIZONTAL) header = wx.StaticText(content_panel, -1, "TogglePanel Test") - header.SetFont(wx.Font(10+(x*3), wx.SWISS, wx.NORMAL, wx.BOLD)) + header.SetFont(wx.Font(10 + (x * 3), wx.SWISS, wx.NORMAL, wx.BOLD)) content_sizer.Add(header, 0, wx.ALL, 10) content_panel.SetSizer(content_sizer) diff --git a/gui/updateDialog.py b/gui/updateDialog.py index 9adaa35942..83b8426b36 100644 --- a/gui/updateDialog.py +++ b/gui/updateDialog.py @@ -71,7 +71,6 @@ def __init__(self, parent, release): versionSizer.Add(self.versionText, 1, wx.ALL, 5) - mainSizer.Add(versionSizer, 0, wx.EXPAND, 0) releaseDate = dateutil.parser.parse(self.releaseInfo['published_at']) diff --git a/gui/utils/color.py b/gui/utils/color.py index 4b44e77a45..f89b56d7aa 100644 --- a/gui/utils/color.py +++ b/gui/utils/color.py @@ -2,7 +2,7 @@ import wx -def Brighten(color: wx.Colour, factor: [0, 1]): +def Brighten(color, factor): """ Brightens a Color using a factor between 0 and 1""" r, g, b, a = color @@ -15,7 +15,7 @@ def Brighten(color: wx.Colour, factor: [0, 1]): return wx.Colour(r, g, b, a) -def Darken(color: wx.Colour, factor: [0, 1]): +def Darken(color, factor): """ Darkens a Color using a factor between 0 and 1""" r, g, b, a = color @@ -33,16 +33,16 @@ def Darken(color: wx.Colour, factor: [0, 1]): return wx.Colour(r, g, b, a) -def _getBrightness(color: wx.Colour): +def _getBrightness(color): """ Calculates brightness of color http://stackoverflow.com/a/596243/788054 """ r, g, b, a = color - return 0.299*r + 0.587*g + 0.114*b + return 0.299 * r + 0.587 * g + 0.114 * b -def GetSuitable(color: wx.Colour, factor: [0, 1]): +def GetSuitable(color, factor: [0, 1]): """ Calculates a suitable color based on original color (wx.Colour), its brightness, and a factor (darken/brighten by factor depending on @@ -57,7 +57,7 @@ def GetSuitable(color: wx.Colour, factor: [0, 1]): return Brighten(color, factor) -def CalculateTransition(s_color: wx.Colour, e_color: wx.Colour, delta: [0, 1]): +def CalculateTransition(s_color, e_color, delta): """ Calculates the color between a given start and end color using a delta value between 0 and 1 @@ -70,4 +70,4 @@ def CalculateTransition(s_color: wx.Colour, e_color: wx.Colour, delta: [0, 1]): tG = sG + (eG - sG) * delta tB = sB + (eB - sB) * delta - return wx.Colour(tR, tG, tB, (sA + eA)/2) + return wx.Colour(tR, tG, tB, (sA + eA) / 2) diff --git a/gui/utils/draw.py b/gui/utils/draw.py index 7079e40581..992dbb9fb4 100644 --- a/gui/utils/draw.py +++ b/gui/utils/draw.py @@ -6,14 +6,14 @@ def RenderGradientBar(windowColor, width, height, sFactor, eFactor, mFactor=None , fillRatio=2): if sFactor == 0 and eFactor == 0 and mFactor is None: - return DrawFilledBitmap(width,height, windowColor) + return DrawFilledBitmap(width, height, windowColor) gStart = color.GetSuitable(windowColor, sFactor) if mFactor: gMid = color.GetSuitable(windowColor, mFactor) else: - gMid = color.GetSuitable(windowColor, sFactor + (eFactor - sFactor) / 2) + gMid = color.GetSuitable(windowColor, sFactor + (eFactor - sFactor) / 2) gEnd = color.GetSuitable(windowColor, eFactor) @@ -21,7 +21,7 @@ def RenderGradientBar(windowColor, width, height, sFactor, eFactor, mFactor=None def DrawFilledBitmap(width, height, color): - canvas = wx.Bitmap(width,height) + canvas = wx.Bitmap(width, height) mdc = wx.MemoryDC() mdc.SelectObject(canvas) @@ -33,8 +33,9 @@ def DrawFilledBitmap(width, height, color): return canvas + def DrawGradientBar(width, height, gStart, gEnd, gMid=None, fillRatio=4): - canvas = wx.Bitmap(width,height) + canvas = wx.Bitmap(width, height) mdc = wx.MemoryDC() mdc.SelectObject(canvas) @@ -47,7 +48,7 @@ def DrawGradientBar(width, height, gStart, gEnd, gMid=None, fillRatio=4): mdc.GradientFillLinear(r, gStart, gMid, wx.SOUTH) r.SetTop(r.GetHeight()) - r.SetHeight(height * (fillRatio - 1)/fillRatio + (1 if height % fillRatio != 0 else 0)) + r.SetHeight(height * (fillRatio - 1) / fillRatio + (1 if height % fillRatio != 0 else 0)) mdc.GradientFillLinear(r, gMid, gEnd, wx.SOUTH) diff --git a/pyfa.py b/pyfa.py index 4c35096834..889178b6e5 100755 --- a/pyfa.py +++ b/pyfa.py @@ -28,22 +28,23 @@ ascii_text = ''' ++++++++++++++++++++++++++++++++++++++++++++++++++ - __ - / _| - _ __ _ _ | |_ __ _ + + / _| + _ __ _ _ | | | '_ \ | | | || _|/ _` | | |_) || |_| || | | (_| | | .__/ \__, ||_| \__,_| - | | __/ | - |_| |___/ + | | __/ | + |_| |___/ -You are running a alpha/beta version of pyfa. +You are running a alpha/beta version of pyfa. ++++++++++++++++++++++++++++++++++++++++++++++++++ ''' print(ascii_text) + class PassThroughOptionParser(OptionParser): """ An unknown option pass-through implementation of OptionParser. @@ -59,6 +60,7 @@ def _process_args(self, largs, rargs, values): # pyfalog.error("Bad startup option passed.") largs.append(e.opt_str) + # Parse command line options usage = "usage: %prog [--root]" parser = PassThroughOptionParser(usage=usage) diff --git a/service/eveapi.py b/service/eveapi.py index 260b8afc1b..a06cf2efe9 100644 --- a/service/eveapi.py +++ b/service/eveapi.py @@ -723,7 +723,8 @@ def __str__(self): def _cmp(self, a, b): - return (a>b)-(a b) - (a < b) + class Row(object): # A Row is a single database record associated with a Rowset. @@ -746,7 +747,6 @@ def __ne__(self, other): def __eq__(self, other): return self.__cmp__(other) == 0 - def __cmp__(self, other): if type(other) != type(self): raise TypeError("Incompatible comparison type") diff --git a/service/network.py b/service/network.py index 924e2940b3..9befd3fffe 100644 --- a/service/network.py +++ b/service/network.py @@ -18,8 +18,9 @@ # ============================================================================= -import urllib.request, urllib.error, urllib.parse -import urllib.request, urllib.parse, urllib.error +import urllib.request +import urllib.error +import urllib.parse import socket from logbook import Logger diff --git a/service/port.py b/service/port.py index 066ff12e27..c61237b5c7 100644 --- a/service/port.py +++ b/service/port.py @@ -50,9 +50,9 @@ from abc import ABCMeta, abstractmethod from service.crest import Crest +from collections import OrderedDict pyfalog = Logger(__name__) -from collections import OrderedDict EFT_SLOT_ORDER = [Slot.LOW, Slot.MED, Slot.HIGH, Slot.RIG, Slot.SUBSYSTEM] INV_FLAGS = { diff --git a/service/prereqsCheck.py b/service/prereqsCheck.py index ce8b950836..f0e0647962 100644 --- a/service/prereqsCheck.py +++ b/service/prereqsCheck.py @@ -5,9 +5,11 @@ version_block = '' + class PreCheckException(Exception): pass + class PreCheckMessage(): def __init__(self, msg): # wx may not be installed, in which case print to console. For all other prechecks, should pop up a MessageDialog @@ -21,6 +23,7 @@ def __init__(self, msg): finally: print(msg) + def version_precheck(): global version_block @@ -80,4 +83,4 @@ def version_precheck(): version_block += "\nDateutil version: {}".format(dateutil.__version__) except: msg = "pyfa requires the python-dateutil module. You can download python-dateutil form https://pypi.python.org/pypi/python-dateutil" - raise PreCheckException(msg) \ No newline at end of file + raise PreCheckException(msg) diff --git a/service/settings.py b/service/settings.py index 8550bc267d..7517255c50 100644 --- a/service/settings.py +++ b/service/settings.py @@ -19,7 +19,9 @@ import pickle import os.path -import urllib.request, urllib.error, urllib.parse +import urllib.request +import urllib.error +import urllib.parse import config import eos.config