Skip to content

Commit

Permalink
code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
blitzmann committed Nov 28, 2017
1 parent 2365112 commit 2936b88
Show file tree
Hide file tree
Showing 43 changed files with 193 additions and 172 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -118,3 +118,4 @@ ENV/
.idea
eos.iml
gitversion
.version
2 changes: 1 addition & 1 deletion .version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v1.33.2-100-gc000b19
v1.33.2-104-g2365112
8 changes: 4 additions & 4 deletions config.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ def isFrozen():
return True
else:
return False


def __createDirs(path):
if not os.path.exists(path):
os.makedirs(path)
Expand Down Expand Up @@ -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")

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)



4 changes: 2 additions & 2 deletions eos/saveddata/fit.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down Expand Up @@ -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:
Expand Down
5 changes: 2 additions & 3 deletions gui/builtinItemStatsViews/itemAttributes.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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]))
self.paramList.SortItems(lambda id1, id2: (idNameMap[id1] > idNameMap[id2]) - (idNameMap[id1] < idNameMap[id2]))
self.paramList.RefreshRows()
self.totalAttrsLabel.SetLabel("%d attributes. " % idCount)
self.Layout()
Expand Down Expand Up @@ -271,5 +272,3 @@ def attributeIDCallback():
return "%s %s" % (fvalue, override[1])
else:
return "%s %s" % (formatAmount(value, 3, 0), unitName)


3 changes: 1 addition & 2 deletions gui/builtinItemStatsViews/itemCompare.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -205,5 +206,3 @@ def attributeIDCallback():
return "%s %s" % (fvalue, override[1])
else:
return "%s %s" % (formatAmount(value, 3, 0), unitName)


2 changes: 0 additions & 2 deletions gui/builtinItemStatsViews/itemDependants.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,3 @@ def getFullSkillTree(self, parentSkill, parent, sbIconId):
itemIcon = -1

self.reqTree.AppendItem(child, "{}".format(item.name), itemIcon)


3 changes: 0 additions & 3 deletions gui/builtinItemStatsViews/itemDescription.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import re



class ItemDescription(wx.Panel):
def __init__(self, parent, stuff, item):
wx.Panel.__init__(self, parent)
Expand All @@ -32,5 +31,3 @@ def __init__(self, parent, stuff, item):

mainSizer.Add(self.description, 1, wx.ALL | wx.EXPAND, 0)
self.Layout()


3 changes: 1 addition & 2 deletions gui/builtinItemStatsViews/itemEffects.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

from .helpers import AutoListCtrl


class ItemEffects(wx.Panel):
def __init__(self, parent, stuff, item):
wx.Panel.__init__(self, parent)
Expand Down Expand Up @@ -127,5 +128,3 @@ def RefreshValues(self, event):
self.Layout()
self.Thaw()
event.Skip()


2 changes: 1 addition & 1 deletion gui/builtinItemStatsViews/itemProperties.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]))
self.paramList.SortItems(lambda id1, id2: (idNameMap[id1] > idNameMap[id2]) - (idNameMap[id1] < idNameMap[id2]))
self.paramList.RefreshRows()
self.totalAttrsLabel.SetLabel("%d attributes. " % idCount)
self.Layout()
2 changes: 0 additions & 2 deletions gui/builtinItemStatsViews/itemRequirements.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)


1 change: 0 additions & 1 deletion gui/builtinItemStatsViews/itemTraits.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,3 @@ def __init__(self, parent, stuff, item):

mainSizer.Add(self.traits, 1, wx.ALL | wx.EXPAND, 0)
self.Layout()

2 changes: 1 addition & 1 deletion gui/builtinMarketBrowser/itemView.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__)

Expand Down
2 changes: 1 addition & 1 deletion gui/builtinMarketBrowser/marketTree.py
Original file line number Diff line number Diff line change
@@ -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

Expand Down
80 changes: 40 additions & 40 deletions gui/builtinPreferenceViews/pyfaGaugePreferences.py
Original file line number Diff line number Diff line change
@@ -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


Expand Down Expand Up @@ -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):
Expand Down
1 change: 1 addition & 0 deletions gui/builtinPreferenceViews/pyfaHTMLExportPreferences.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 "
Expand Down
2 changes: 1 addition & 1 deletion gui/builtinShipBrowser/categoryItem.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__)

Expand Down
2 changes: 1 addition & 1 deletion gui/builtinShipBrowser/fitItem.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions gui/builtinShipBrowser/navigationPanel.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -271,4 +271,3 @@ def gotoStage(self, stage, data=None):
wx.PostEvent(self.Parent, ImportSelected(fits=data))
else:
wx.PostEvent(self.Parent, Stage1Selected())

3 changes: 1 addition & 2 deletions gui/builtinShipBrowser/raceSelector.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__)
Expand Down Expand Up @@ -270,4 +270,3 @@ def OnWindowLeave(self, event):
self.checkMaximize = False

event.Skip()

2 changes: 1 addition & 1 deletion gui/builtinShipBrowser/shipItem.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion gui/builtinStatsViews/targetingMiscViewMinimal.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
from collections import OrderedDict



class TargetingMiscViewMinimal(StatsView):
name = "targetingMiscViewMinimal"

Expand Down
10 changes: 5 additions & 5 deletions gui/builtinViews/fittingView.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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))
Expand Down Expand Up @@ -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
Expand Down
Loading

0 comments on commit 2936b88

Please sign in to comment.