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,4 +1,4 @@
#===============================================================================
# =============================================================================
# Copyright (C) 2010 Diego Duclos
#
# This file is part of pyfa.
@@ -15,19 +15,19 @@
#
# You should have received a copy of the GNU General Public License
# along with pyfa. If not, see <http://www.gnu.org/licenses/>.
#===============================================================================
# =============================================================================
import sys
import wx
import gui.mainFrame
from gui.viewColumn import ViewColumn
from gui.cachingImageList import CachingImageList
class Display(wx.ListCtrl):
def __init__(self, parent, size = wx.DefaultSize, style = 0):
wx.ListCtrl.__init__(self, parent,size = size, style=wx.LC_REPORT | style )
class Display(wx.ListCtrl):
def __init__(self, parent, size=wx.DefaultSize, style=0):
wx.ListCtrl.__init__(self, parent, size=size, style=wx.LC_REPORT | style)
self.imageList = CachingImageList(16, 16)
self.SetImageList(self.imageList, wx.IMAGE_LIST_SMALL)
self.activeColumns = []
@@ -110,15 +110,14 @@ class Display(wx.ListCtrl):
return (rowIndex, 0, -1)
def OnEraseBk(self,event):
if self.GetItemCount() >0:
def OnEraseBk(self, event):
if self.GetItemCount() > 0:
width, height = self.GetClientSize()
dc = event.GetDC()
dc.DestroyClippingRegion()
dc.SetClippingRegion(0, 0, width, height)
x,y,w,h = dc.GetClippingBox()
x, y, w, h = dc.GetClippingBox()
topItem = self.GetTopItem()
bottomItem = topItem + self.GetCountPerPage()
@@ -129,10 +128,9 @@ class Display(wx.ListCtrl):
topRect = self.GetItemRect(topItem, wx.LIST_RECT_LABEL)
bottomRect = self.GetItemRect(bottomItem, wx.LIST_RECT_BOUNDS)
items_rect = wx.Rect(topRect.left, 0, bottomRect.right - topRect.left, bottomRect.bottom)
items_rect = wx.Rect(topRect.left, 0, bottomRect.right - topRect.left, bottomRect.bottom )
updateRegion = wx.Region(x,y,w,h)
updateRegion = wx.Region(x, y, w, h)
updateRegion.SubtractRect(items_rect)
dc.DestroyClippingRegion()
@@ -171,41 +169,37 @@ class Display(wx.ListCtrl):
# we veto header cell resize by default till we find a way
# to assure a minimal size for the resized header cell
column = event.GetColumn()
wx.CallAfter(self.checkColumnSize,column)
wx.CallAfter(self.checkColumnSize, column)
event.Skip()
def resizeSkip(self, event):
column = event.GetColumn()
if column > len (self.activeColumns)-1:
if column > len(self.activeColumns) - 1:
self.SetColumnWidth(column, 0)
event.Veto()
return
colItem = self.activeColumns[column]
# colItem = self.activeColumns[column]
if self.activeColumns[column].maxsize != -1:
event.Veto()
else:
event.Skip()
def checkColumnSize(self,column):
def checkColumnSize(self, column):
colItem = self.activeColumns[column]
if self.GetColumnWidth(column) < self.columnsMinWidth[column]:
self.SetColumnWidth(column,self.columnsMinWidth[column])
self.SetColumnWidth(column, self.columnsMinWidth[column])
colItem.resized = True
def getLastItem( self, state = wx.LIST_STATE_DONTCARE):
lastFound = -1
while True:
index = self.GetNextItem(
lastFound,
wx.LIST_NEXT_ALL,
state,
)
if index == -1:
break
else:
lastFound = index
def getLastItem(self, state=wx.LIST_STATE_DONTCARE):
lastFound = -1
while True:
index = self.GetNextItem(lastFound, wx.LIST_NEXT_ALL, state)
if index == -1:
break
else:
lastFound = index
return lastFound
return lastFound
def deselectItems(self):
sel = self.GetFirstSelected()
@@ -220,26 +214,25 @@ class Display(wx.ListCtrl):
stuffItemCount = len(stuff)
if listItemCount < stuffItemCount:
for i in xrange(stuffItemCount - listItemCount):
index = self.InsertStringItem(sys.maxint, "")
for i in range(stuffItemCount - listItemCount):
self.InsertStringItem(sys.maxint, "")
if listItemCount > stuffItemCount:
if listItemCount - stuffItemCount > 20 and stuffItemCount < 20:
self.DeleteAllItems()
for i in xrange(stuffItemCount):
index = self.InsertStringItem(sys.maxint, "")
for i in range(stuffItemCount):
self.InsertStringItem(sys.maxint, "")
else:
for i in xrange(listItemCount - stuffItemCount):
for i in range(listItemCount - stuffItemCount):
self.DeleteItem(self.getLastItem())
self.Refresh()
def refresh(self, stuff):
if stuff == None:
if stuff is None:
return
item = -1
for id, st in enumerate(stuff):
for id_, st in enumerate(stuff):
item = self.GetNextItem(item)
@@ -270,11 +263,11 @@ class Display(wx.ListCtrl):
colItem.SetMask(mask)
self.SetItem(colItem)
self.SetItemData(item, id)
self.SetItemData(item, id_)
# self.Freeze()
# self.Freeze()
if 'wxMSW' in wx.PlatformInfo:
for i,col in enumerate(self.activeColumns):
for i, col in enumerate(self.activeColumns):
if not col.resized:
self.SetColumnWidth(i, col.size)
else:
@@ -289,9 +282,7 @@ class Display(wx.ListCtrl):
self.SetColumnWidth(i, headerWidth)
else:
self.SetColumnWidth(i, col.size)
# self.Thaw()
# self.Thaw()
def update(self, stuff):
self.populate(stuff)