so many pep8 fixes

(cherry picked from commit bee125d)
This commit is contained in:
a-tal
2016-12-03 17:04:12 -08:00
committed by Ebag333
parent 510492e5e9
commit d3b6bc1c93
133 changed files with 3371 additions and 3319 deletions

View File

@@ -1,65 +1,54 @@
# -*- coding: utf-8 -*-
###########################################################################
## pyfatogllepanel.py
##
## Author: Darriele - HomeWorld
##
## Project home: https://github.com/pyfa-org/Pyfa - pyfa project
## Some portions of code are based on
## AGW:pycollapsiblepane generic implementation of wx.CollapsiblePane
## AGW:pycollapsiblepane credits ( from the original source file used ):
## Andrea Gavana, @ 09 Aug 2007
## Latest Revision: 12 Apr 2010, 12.00 GMT
##
## Module description:
## TogglePanel class is a wx.collipsablepane like implementation that uses
## some optimization from awg::pycollipsablepane to provide certain
## features tailored for PYFA needs.
##
## This module is part of PYFA (PYthon Fitting Assitant) and it shares the same
## licence ( read PYFA licence notice: gpl.txt )
##
## Notes: leave the commented code as it is, those line will be removed someday
# pyfatogllepanel.py
#
# Author: Darriele - HomeWorld
#
# Project home: https://github.com/pyfa-org/Pyfa - pyfa project
# Some portions of code are based on
# AGW:pycollapsiblepane generic implementation of wx.CollapsiblePane
# AGW:pycollapsiblepane credits ( from the original source file used ):
# Andrea Gavana, @ 09 Aug 2007
# Latest Revision: 12 Apr 2010, 12.00 GMT
#
# Module description:
# TogglePanel class is a wx.collipsablepane like implementation that uses
# some optimization from awg::pycollipsablepane to provide certain
# features tailored for PYFA needs.
#
# This module is part of PYFA (PYthon Fitting Assitant) and it shares the same
# licence ( read PYFA licence notice: gpl.txt )
#
# Notes: leave the commented code as it is, those line will be removed someday
###########################################################################
import wx
from gui.bitmapLoader import BitmapLoader
###########################################################################
## Class TogglePanel
###########################################################################
class TogglePanel ( wx.Panel ):
def __init__( self, parent , forceLayout = -1):
wx.Panel.__init__ ( self, parent, id = wx.ID_ANY, pos = wx.DefaultPosition, size = wx.Size( -1,-1 ), style = wx.TAB_TRAVERSAL )
class TogglePanel(wx.Panel):
def __init__(self, parent, forceLayout=-1):
wx.Panel.__init__(self, parent, id=wx.ID_ANY, pos=wx.DefaultPosition, size=wx.Size(-1, -1), style=wx.TAB_TRAVERSAL)
self._toggle = 1
self.parent = parent
self.forceLayout = forceLayout
self.bkColour = self.GetBackgroundColour()
# Create the main sizer of this panel
self.mainSizer = wx.BoxSizer( wx.VERTICAL )
self.SetSizer( self.mainSizer )
parentSize = parent.GetMinSize()
# Create the header panel
# Create the main sizer of this panel
self.mainSizer = wx.BoxSizer(wx.VERTICAL)
self.SetSizer(self.mainSizer)
# parentSize = parent.GetMinSize()
# Create the header panel
self.headerPanel = wx.Panel(self)
self.mainSizer.Add(self.headerPanel, 0, wx.EXPAND | wx.TOP | wx.BOTTOM | wx.RIGHT, 1)
self.mainSizer.Add(self.headerPanel,0,wx.EXPAND | wx.TOP|wx.BOTTOM|wx.RIGHT, 1)
# Load expanded/collapsed bitmaps from the icons folder
self.bmpExpanded = BitmapLoader.getBitmap("down-arrow2", "gui")
self.bmpCollapsed = BitmapLoader.getBitmap("up-arrow2", "gui")
# Load expanded/collapsed bitmaps from the icons folder
self.bmpExpanded = BitmapLoader.getBitmap("down-arrow2","gui")
self.bmpCollapsed = BitmapLoader.getBitmap("up-arrow2","gui")
# Make the bitmaps have the same color as window text
sysTextColour = wx.SystemSettings.GetColour( wx.SYS_COLOUR_WINDOWTEXT )
# Make the bitmaps have the same color as window text
sysTextColour = wx.SystemSettings.GetColour(wx.SYS_COLOUR_WINDOWTEXT)
img = self.bmpExpanded.ConvertToImage()
img.Replace(0, 0, 0, sysTextColour[0], sysTextColour[1], sysTextColour[2])
@@ -69,55 +58,53 @@ class TogglePanel ( wx.Panel ):
img.Replace(0, 0, 0, sysTextColour[0], sysTextColour[1], sysTextColour[2])
self.bmpCollapsed = wx.BitmapFromImage(img)
self.headerBmp = wx.StaticBitmap(self.headerPanel )
self.headerBmp.SetBitmap( self.bmpExpanded)
self.headerBmp = wx.StaticBitmap(self.headerPanel)
self.headerBmp.SetBitmap(self.bmpExpanded)
# Create the header sizer and add static bitmap and static text controls to it
# Create the header sizer and add static bitmap and static text controls to it
headerSizer = wx.BoxSizer( wx.HORIZONTAL )
self.headerPanel.SetSizer( headerSizer)
headerSizer = wx.BoxSizer(wx.HORIZONTAL)
self.headerPanel.SetSizer(headerSizer)
hbmpSizer = wx.BoxSizer( wx.HORIZONTAL )
hlblSizer = wx.BoxSizer( wx.HORIZONTAL )
self.hcntSizer = wx.BoxSizer( wx.HORIZONTAL)
hbmpSizer = wx.BoxSizer(wx.HORIZONTAL)
hlblSizer = wx.BoxSizer(wx.HORIZONTAL)
self.hcntSizer = wx.BoxSizer(wx.HORIZONTAL)
hbmpSizer.Add( self.headerBmp, 0,0, 5 )
hbmpSizer.Add(self.headerBmp, 0, 0, 5)
self.headerLabel = wx.StaticText( self.headerPanel, wx.ID_ANY, u"PYFA", wx.DefaultPosition, wx.DefaultSize, 0 )
hlblSizer.Add( self.headerLabel, 0, wx.EXPAND , 5 )
self.headerLabel = wx.StaticText(self.headerPanel, wx.ID_ANY, u"PYFA", wx.DefaultPosition, wx.DefaultSize, 0)
hlblSizer.Add(self.headerLabel, 0, wx.EXPAND, 5)
headerSizer.Add( hbmpSizer, 0, wx.RIGHT, 5 )
headerSizer.Add( hlblSizer, 0, wx.RIGHT, 5 )
headerSizer.Add( self.hcntSizer, 0, wx.RIGHT, 5)
headerSizer.Add(hbmpSizer, 0, wx.RIGHT, 5)
headerSizer.Add(hlblSizer, 0, wx.RIGHT, 5)
headerSizer.Add(self.hcntSizer, 0, wx.RIGHT, 5)
# Set the static text font weight to BOLD
# Set the static text font weight to BOLD
headerFont=parent.GetFont()
headerFont = parent.GetFont()
headerFont.SetWeight(wx.BOLD)
self.headerLabel.SetFont(headerFont)
# Create the content panel and its main sizer
# Create the content panel and its main sizer
self.contentSizer = wx.BoxSizer( wx.VERTICAL )
self.contentSizer = wx.BoxSizer(wx.VERTICAL)
self.contentPanel = wx.Panel(self)
self.contentPanel.SetSizer(self.contentSizer)
self.mainSizer.Add( self.contentPanel, 0, wx.EXPAND | wx.RIGHT | wx.LEFT , 5)
self.mainSizer.Add(self.contentPanel, 0, wx.EXPAND | wx.RIGHT | wx.LEFT, 5)
self.Layout()
# Connect Events
# Connect Events
self.headerLabel.Bind(wx.EVT_LEFT_UP, self.toggleContent)
self.headerBmp.Bind(wx.EVT_LEFT_UP, self.toggleContent)
self.headerPanel.Bind(wx.EVT_LEFT_UP, self.toggleContent)
self.headerLabel.Bind( wx.EVT_LEFT_UP, self.toggleContent )
self.headerBmp.Bind( wx.EVT_LEFT_UP, self.toggleContent )
self.headerPanel.Bind( wx.EVT_LEFT_UP, self.toggleContent )
def __del__( self ):
def __del__(self):
pass
def AddToggleItem(self, hitem):
hitem.Bind( wx.EVT_LEFT_UP, self.toggleContent )
hitem.Bind(wx.EVT_LEFT_UP, self.toggleContent)
def GetHeaderContentSizer(self):
return self.hcntSizer
@@ -126,7 +113,7 @@ class TogglePanel ( wx.Panel ):
return self.headerPanel
def InsertItemInHeader(self, item):
self.hcntSizer.Add(item,0,0,0)
self.hcntSizer.Add(item, 0, 0, 0)
self.Layout()
def AddSizer(self, sizer):