Skip to content

Commit

Permalink
Large pep8 compliance to make work for Tox
Browse files Browse the repository at this point in the history
  • Loading branch information
Ebag333 committed Dec 14, 2016
1 parent b2a5a20 commit be53ded
Show file tree
Hide file tree
Showing 50 changed files with 2,214 additions and 2,064 deletions.
3 changes: 2 additions & 1 deletion gui/PFListPane.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@

class PFListPane(wx.ScrolledWindow):
def __init__(self, parent):
wx.ScrolledWindow.__init__(self, parent, id=wx.ID_ANY, pos=wx.DefaultPosition, size=wx.Size(1, 1), style=wx.TAB_TRAVERSAL)
wx.ScrolledWindow.__init__(self, parent, id=wx.ID_ANY, pos=wx.DefaultPosition, size=wx.Size(1, 1),
style=wx.TAB_TRAVERSAL)

self._wList = []
self._wCount = 0
Expand Down
5 changes: 3 additions & 2 deletions gui/PFSearchBox.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import gui.utils.colorUtils as colorUtils
import gui.utils.drawUtils as drawUtils


SearchButton, EVT_SEARCH_BTN = wx.lib.newevent.NewEvent()
CancelButton, EVT_CANCEL_BTN = wx.lib.newevent.NewEvent()
TextEnter, EVT_TEXT_ENTER = wx.lib.newevent.NewEvent()
Expand Down Expand Up @@ -40,7 +39,9 @@ def __init__(self, parent, id=wx.ID_ANY, value="", pos=wx.DefaultPosition, size=
self._hl = False

w, h = size
self.EditBox = wx.TextCtrl(self, wx.ID_ANY, "", wx.DefaultPosition, (-1, h - 2 if 'wxGTK' in wx.PlatformInfo else -1), wx.TE_PROCESS_ENTER | (wx.BORDER_NONE if 'wxGTK' in wx.PlatformInfo else 0))
self.EditBox = wx.TextCtrl(self, wx.ID_ANY, "", wx.DefaultPosition,
(-1, h - 2 if 'wxGTK' in wx.PlatformInfo else -1),
wx.TE_PROCESS_ENTER | (wx.BORDER_NONE if 'wxGTK' in wx.PlatformInfo else 0))

self.Bind(wx.EVT_PAINT, self.OnPaint)
self.Bind(wx.EVT_ERASE_BACKGROUND, self.OnEraseBk)
Expand Down
1 change: 0 additions & 1 deletion gui/aboutData.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

import config


versionString = "{0} {1} - {2} {3}".format(config.version, config.tag, config.expansionName, config.expansionVersion)
licenses = (
"pyfa is released under GNU GPLv3 - see included LICENSE file",
Expand Down
1 change: 0 additions & 1 deletion gui/additionsPane.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@


class AdditionsPane(TogglePanel):

def __init__(self, parent):

TogglePanel.__init__(self, parent, forceLayout=1)
Expand Down
1 change: 0 additions & 1 deletion gui/bitmapLoader.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@


class BitmapLoader(object):

try:
archive = zipfile.ZipFile(os.path.join(config.pyfaPath, 'imgs.zip'), 'r')
except IOError:
Expand Down
24 changes: 12 additions & 12 deletions gui/cargoView.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,21 +27,21 @@


class CargoViewDrop(wx.PyDropTarget):
def __init__(self, dropFn):
wx.PyDropTarget.__init__(self)
self.dropFn = dropFn
# this is really transferring an EVE itemID
self.dropData = wx.PyTextDataObject()
self.SetDataObject(self.dropData)
def __init__(self, dropFn):
wx.PyDropTarget.__init__(self)
self.dropFn = dropFn
# this is really transferring an EVE itemID
self.dropData = wx.PyTextDataObject()
self.SetDataObject(self.dropData)

def OnData(self, x, y, t):
if self.GetData():
data = self.dropData.GetText().split(':')
self.dropFn(x, y, data)
return t
def OnData(self, x, y, t):
if self.GetData():
data = self.dropData.GetText().split(':')
self.dropFn(x, y, data)
return t


# @todo: Was copied form another class and modified. Look through entire file, refine
# @todo: Was copied form another class and modified. Look through entire file, refine
class CargoView(d.Display):
DEFAULT_COLS = ["Base Icon",
"Base Name",
Expand Down
80 changes: 43 additions & 37 deletions gui/characterEditor.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,14 +99,14 @@ def DoDelete(self, entity):

class CharacterEditor(wx.Frame):
def __init__(self, parent):
wx.Frame.__init__ (self, parent, id=wx.ID_ANY, title=u"pyfa: Character Editor", pos=wx.DefaultPosition,
size=wx.Size(640, 600), style=wx.DEFAULT_FRAME_STYLE ^ wx.RESIZE_BORDER)
wx.Frame.__init__(self, parent, id=wx.ID_ANY, title=u"pyfa: Character Editor", pos=wx.DefaultPosition,
size=wx.Size(640, 600), style=wx.DEFAULT_FRAME_STYLE ^ wx.RESIZE_BORDER)

i = wx.IconFromBitmap(BitmapLoader.getBitmap("character_small", "gui"))
self.SetIcon(i)

self.mainFrame = parent
#self.disableWin = wx.WindowDisabler(self)
# self.disableWin = wx.WindowDisabler(self)
sFit = Fit.getInstance()

self.SetBackgroundColour(wx.SystemSettings.GetColour(wx.SYS_COLOUR_BTNFACE))
Expand Down Expand Up @@ -179,7 +179,7 @@ def refreshCharacterList(self, event=None):
event.Skip()

def editingFinished(self, event):
#del self.disableWin
# del self.disableWin
wx.PostEvent(self.mainFrame, GE.CharListUpdated())
self.Destroy()

Expand All @@ -201,7 +201,7 @@ def revertChar(self, event):
wx.PostEvent(self, GE.CharListUpdated())

def closeEvent(self, event):
#del self.disableWin
# del self.disableWin
wx.PostEvent(self.mainFrame, GE.CharListUpdated())
self.Destroy()

Expand Down Expand Up @@ -234,18 +234,20 @@ def Destroy(self):

wx.Frame.Destroy(self)

class SkillTreeView (wx.Panel):

class SkillTreeView(wx.Panel):
def __init__(self, parent):
wx.Panel.__init__ (self, parent, id=wx.ID_ANY, pos=wx.DefaultPosition, size=wx.DefaultSize, style=wx.TAB_TRAVERSAL)
wx.Panel.__init__(self, parent, id=wx.ID_ANY, pos=wx.DefaultPosition, size=wx.DefaultSize,
style=wx.TAB_TRAVERSAL)
self.charEditor = self.Parent.Parent # first parent is Notebook, second is Character Editor
self.SetBackgroundColour(wx.SystemSettings_GetColour(wx.SYS_COLOUR_WINDOW))

pmainSizer = wx.BoxSizer(wx.VERTICAL)

tree = self.skillTreeListCtrl = wx.gizmos.TreeListCtrl(self, wx.ID_ANY, style=wx.TR_DEFAULT_STYLE | wx.TR_HIDE_ROOT)
tree = self.skillTreeListCtrl = wx.gizmos.TreeListCtrl(self, wx.ID_ANY,
style=wx.TR_DEFAULT_STYLE | wx.TR_HIDE_ROOT)
pmainSizer.Add(tree, 1, wx.EXPAND | wx.ALL, 5)


self.imageList = wx.ImageList(16, 16)
tree.SetImageList(self.imageList)
self.skillBookImageId = self.imageList.Add(BitmapLoader.getBitmap("skill_small", "gui"))
Expand Down Expand Up @@ -289,7 +291,6 @@ def __init__(self, parent):
self.revertID = wx.NewId()
self.levelChangeMenu.Append(self.revertID, "Revert")


self.saveID = wx.NewId()
self.levelChangeMenu.Append(self.saveID, "Save")

Expand Down Expand Up @@ -328,7 +329,7 @@ def expandLookup(self, event):
if tree.GetItemText(child) == "dummy":
tree.Delete(child)

#Get the real intrestin' stuff
# Get the real intrestin' stuff
sChar = Character.getInstance()
char = self.charEditor.entityEditor.getActiveEntity()
for id, name in sChar.getSkills(tree.GetPyData(root)):
Expand Down Expand Up @@ -391,7 +392,7 @@ def changeLevel(self, event):

class ImplantEditorView(BaseImplantEditorView):
def __init__(self, parent):
BaseImplantEditorView.__init__ (self, parent)
BaseImplantEditorView.__init__(self, parent)

self.determineEnabled()

Expand Down Expand Up @@ -445,9 +446,10 @@ def determineEnabled(self):
self.Enable()


class APIView (wx.Panel):
class APIView(wx.Panel):
def __init__(self, parent):
wx.Panel.__init__ (self, parent, id=wx.ID_ANY, pos=wx.DefaultPosition, size=wx.Size(500, 300), style=wx.TAB_TRAVERSAL)
wx.Panel.__init__(self, parent, id=wx.ID_ANY, pos=wx.DefaultPosition, size=wx.Size(500, 300),
style=wx.TAB_TRAVERSAL)
self.charEditor = self.Parent.Parent # first parent is Notebook, second is Character Editor
self.SetBackgroundColour(wx.SystemSettings_GetColour(wx.SYS_COLOUR_WINDOW))

Expand All @@ -456,17 +458,17 @@ def __init__(self, parent):

pmainSizer = wx.BoxSizer(wx.VERTICAL)

hintSizer = wx.BoxSizer( wx.HORIZONTAL )
hintSizer = wx.BoxSizer(wx.HORIZONTAL)
hintSizer.AddStretchSpacer()
self.stDisabledTip = wx.StaticText( self, wx.ID_ANY, u"You cannot add API Details for All 0 and All 5 characters.\n"
u"Please select another character or make a new one.", style=wx.ALIGN_CENTER )
self.stDisabledTip.Wrap( -1 )
hintSizer.Add( self.stDisabledTip, 0, wx.TOP | wx.BOTTOM, 10 )
self.stDisabledTip = wx.StaticText(self, wx.ID_ANY,
u"You cannot add API Details for All 0 and All 5 characters.\n"
u"Please select another character or make a new one.", style=wx.ALIGN_CENTER)
self.stDisabledTip.Wrap(-1)
hintSizer.Add(self.stDisabledTip, 0, wx.TOP | wx.BOTTOM, 10)
self.stDisabledTip.Hide()
hintSizer.AddStretchSpacer()
pmainSizer.Add(hintSizer, 0, wx.EXPAND, 5)


fgSizerInput = wx.FlexGridSizer(3, 2, 0, 0)
fgSizerInput.AddGrowableCol(1)
fgSizerInput.SetFlexibleDirection(wx.BOTH)
Expand Down Expand Up @@ -498,39 +500,44 @@ def __init__(self, parent):

pmainSizer.Add(fgSizerInput, 0, wx.EXPAND, 5)

btnSizer = wx.BoxSizer( wx.HORIZONTAL )
btnSizer = wx.BoxSizer(wx.HORIZONTAL)
btnSizer.AddStretchSpacer()

self.btnFetchCharList = wx.Button(self, wx.ID_ANY, u"Get Characters")
btnSizer.Add(self.btnFetchCharList, 0, wx.ALL, 2)
self.btnFetchCharList.Bind(wx.EVT_BUTTON, self.fetchCharList)

self.btnFetchSkills = wx.Button(self, wx.ID_ANY, u"Fetch Skills")
btnSizer.Add(self.btnFetchSkills, 0, wx.ALL, 2)
self.btnFetchSkills = wx.Button(self, wx.ID_ANY, u"Fetch Skills")
btnSizer.Add(self.btnFetchSkills, 0, wx.ALL, 2)
self.btnFetchSkills.Bind(wx.EVT_BUTTON, self.fetchSkills)
self.btnFetchSkills.Enable(False)

btnSizer.AddStretchSpacer()
pmainSizer.Add(btnSizer, 0, wx.EXPAND, 5)

self.stStatus = wx.StaticText(self, wx.ID_ANY, wx.EmptyString)
self.stStatus = wx.StaticText(self, wx.ID_ANY, wx.EmptyString)
pmainSizer.Add(self.stStatus, 0, wx.ALL, 5)

pmainSizer.AddStretchSpacer()
self.stAPITip = wx.StaticText( self, wx.ID_ANY, u"You can create a pre-defined key here (only CharacterSheet is required):", wx.DefaultPosition, wx.DefaultSize, 0 )
self.stAPITip.Wrap( -1 )
self.stAPITip = wx.StaticText(self, wx.ID_ANY,
u"You can create a pre-defined key here (only CharacterSheet is required):",
wx.DefaultPosition, wx.DefaultSize, 0)
self.stAPITip.Wrap(-1)

pmainSizer.Add( self.stAPITip, 0, wx.ALL, 2 )
pmainSizer.Add(self.stAPITip, 0, wx.ALL, 2)

self.hlEveAPI = wx.HyperlinkCtrl( self, wx.ID_ANY, self.apiUrlCreatePredefined, self.apiUrlCreatePredefined, wx.DefaultPosition, wx.DefaultSize, wx.HL_DEFAULT_STYLE )
pmainSizer.Add( self.hlEveAPI, 0, wx.ALL, 2 )
self.hlEveAPI = wx.HyperlinkCtrl(self, wx.ID_ANY, self.apiUrlCreatePredefined, self.apiUrlCreatePredefined,
wx.DefaultPosition, wx.DefaultSize, wx.HL_DEFAULT_STYLE)
pmainSizer.Add(self.hlEveAPI, 0, wx.ALL, 2)

self.stAPITip2 = wx.StaticText( self, wx.ID_ANY, u"Or, you can choose an existing key from:", wx.DefaultPosition, wx.DefaultSize, 0 )
self.stAPITip2.Wrap( -1 )
pmainSizer.Add( self.stAPITip2, 0, wx.ALL, 2 )
self.stAPITip2 = wx.StaticText(self, wx.ID_ANY, u"Or, you can choose an existing key from:", wx.DefaultPosition,
wx.DefaultSize, 0)
self.stAPITip2.Wrap(-1)
pmainSizer.Add(self.stAPITip2, 0, wx.ALL, 2)

self.hlEveAPI2 = wx.HyperlinkCtrl( self, wx.ID_ANY, self.apiUrlKeyList, self.apiUrlKeyList, wx.DefaultPosition, wx.DefaultSize, wx.HL_DEFAULT_STYLE )
pmainSizer.Add( self.hlEveAPI2, 0, wx.ALL, 2 )
self.hlEveAPI2 = wx.HyperlinkCtrl(self, wx.ID_ANY, self.apiUrlKeyList, self.apiUrlKeyList, wx.DefaultPosition,
wx.DefaultSize, wx.HL_DEFAULT_STYLE)
pmainSizer.Add(self.hlEveAPI2, 0, wx.ALL, 2)

self.charEditor.entityEditor.Bind(wx.EVT_CHOICE, self.charChanged)

Expand Down Expand Up @@ -587,7 +594,7 @@ def fetchCharList(self, event):
except TimeoutError, e:
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)
self.stStatus.SetLabel("Error:\n%s" % e.message)
else:
self.charChoice.Clear()
for charName in list:
Expand All @@ -611,8 +618,8 @@ def fetchSkills(self, event):
except Exception, e:
self.stStatus.SetLabel("Unable to retrieve %s\'s skills. Error message:\n%s" % (charName, e))

class SaveCharacterAs(wx.Dialog):

class SaveCharacterAs(wx.Dialog):
def __init__(self, parent, charID):
wx.Dialog.__init__(self, parent, title="Save Character As...", size=wx.Size(300, 60))
self.charID = charID
Expand Down Expand Up @@ -640,4 +647,3 @@ def change(self, event):

event.Skip()
self.Close()

30 changes: 25 additions & 5 deletions gui/chromeTabs.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@

from service.fit import Fit


_PageChanging, EVT_NOTEBOOK_PAGE_CHANGING = wx.lib.newevent.NewEvent()
_PageChanged, EVT_NOTEBOOK_PAGE_CHANGED = wx.lib.newevent.NewEvent()
_PageAdding, EVT_NOTEBOOK_PAGE_ADDING = wx.lib.newevent.NewEvent()
Expand Down Expand Up @@ -527,7 +526,10 @@ def InitTabRegions(self):
"""
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.closeBtnRegion.Offset(
self.contentWidth + self.leftWidth - self.ctabCloseBmp.GetWidth() / 2,
(self.tabHeight - self.ctabCloseBmp.GetHeight()) / 2
)

def InitColors(self):
"""Determines colors used for tab, based on system settings"""
Expand Down Expand Up @@ -1277,7 +1279,12 @@ def UpdateTabsPosition(self, skipTab=None):
selpos = pos
if selected is not skipTab:
selected.SetPosition((selpos, self.containerHeight - self.height))
self.addButton.SetPosition((round(tabsWidth) + self.inclination * 2, self.containerHeight - self.height / 2 - self.addButton.GetHeight() / 3))
self.addButton.SetPosition(
(
round(tabsWidth) + self.inclination * 2,
self.containerHeight - self.height / 2 - self.addButton.GetHeight() / 3
)
)

def OnLeaveWindow(self, event):

Expand All @@ -1302,15 +1309,28 @@ def OnTimer(self, event):
if not self.previewTab.GetSelected():
page = self.Parent.GetPage(self.GetTabIndex(self.previewTab))
if page.Snapshot():
self.previewWnd = PFNotebookPagePreview(self, (mposx + 3, mposy + 3), page.Snapshot(), self.previewTab.text)
self.previewWnd = PFNotebookPagePreview(
self,
(mposx + 3, mposy + 3),
page.Snapshot(),
self.previewTab.text
)
self.previewWnd.Show()

event.Skip()


class PFNotebookPagePreview(wx.Frame):
def __init__(self, parent, pos, bitmap, title):
wx.Frame.__init__(self, parent, id=wx.ID_ANY, title=wx.EmptyString, pos=pos, size=wx.DefaultSize, style=wx.NO_BORDER | wx.FRAME_NO_TASKBAR | wx.STAY_ON_TOP)
wx.Frame.__init__(
self,
parent,
id=wx.ID_ANY,
title=wx.EmptyString,
pos=pos,
size=wx.DefaultSize,
style=wx.NO_BORDER | wx.FRAME_NO_TASKBAR | wx.STAY_ON_TOP
)

self.title = title
self.bitmap = bitmap
Expand Down
Loading

0 comments on commit be53ded

Please sign in to comment.