mirror of
https://github.com/shlomif/PySolFC.git
synced 2025-04-05 00:02:29 -04:00
flake8
This commit is contained in:
parent
491caddaee
commit
37c9535792
2 changed files with 19 additions and 10 deletions
|
@ -23,10 +23,12 @@
|
|||
|
||||
|
||||
# imports
|
||||
import Tkinter, tkColorChooser
|
||||
import sys
|
||||
import Tkinter
|
||||
import tkColorChooser
|
||||
|
||||
# PySol imports
|
||||
from pysollib.mygettext import _, n_
|
||||
from pysollib.mygettext import _
|
||||
from pysollib.mfxutil import KwStruct
|
||||
|
||||
# Toolkit imports
|
||||
|
@ -35,6 +37,10 @@ from selecttree import SelectDialogTreeLeaf, SelectDialogTreeNode
|
|||
from selecttree import SelectDialogTreeData, SelectDialogTreeCanvas
|
||||
|
||||
|
||||
if sys.version_info > (3,):
|
||||
basestring = str
|
||||
|
||||
|
||||
# ************************************************************************
|
||||
# * Nodes
|
||||
# ************************************************************************
|
||||
|
@ -48,7 +54,8 @@ class SelectTileNode(SelectDialogTreeNode):
|
|||
contents = []
|
||||
for obj in self.tree.data.all_objects:
|
||||
if self.select_func(obj):
|
||||
node = SelectTileLeaf(self.tree, self, text=obj.name, key=obj.index)
|
||||
node = SelectTileLeaf(
|
||||
self.tree, self, text=obj.name, key=obj.index)
|
||||
contents.append(node)
|
||||
return contents or self.tree.data.no_contents
|
||||
|
||||
|
@ -62,9 +69,11 @@ class SelectTileData(SelectDialogTreeData):
|
|||
SelectDialogTreeData.__init__(self)
|
||||
self.all_objects = manager.getAllSortedByName()
|
||||
self.all_objects = [obj for obj in self.all_objects if not obj.error]
|
||||
self.all_objects = [tile for tile in self.all_objects if tile.index > 0 and tile.filename]
|
||||
self.no_contents = [ SelectTileLeaf(None, None, _("(no tiles)"), key=None), ]
|
||||
e1 = isinstance(key, str) or len(self.all_objects) <=17
|
||||
self.all_objects = [tile for tile in self.all_objects
|
||||
if tile.index > 0 and tile.filename]
|
||||
self.no_contents = [SelectTileLeaf(
|
||||
None, None, _("(no tiles)"), key=None), ]
|
||||
e1 = isinstance(key, str) or len(self.all_objects) <= 17
|
||||
e2 = 1
|
||||
self.rootnodes = (
|
||||
SelectTileNode(None, _("Solid Colors"), (
|
||||
|
@ -75,7 +84,8 @@ class SelectTileData(SelectDialogTreeData):
|
|||
SelectTileLeaf(None, None, _("Orange"), key="#f79600"),
|
||||
SelectTileLeaf(None, None, _("Teal"), key="#008286"),
|
||||
), expanded=e1),
|
||||
SelectTileNode(None, _("All Backgrounds"), lambda tile: 1, expanded=e2),
|
||||
SelectTileNode(
|
||||
None, _("All Backgrounds"), lambda tile: 1, expanded=e2),
|
||||
)
|
||||
|
||||
|
||||
|
@ -180,7 +190,7 @@ class SelectTileDialogWithPreview(MfxDialog):
|
|||
MfxDialog.mDone(self, button)
|
||||
|
||||
def updatePreview(self, key):
|
||||
##print key
|
||||
# print key
|
||||
if key == self.preview_key:
|
||||
return
|
||||
canvas = self.preview.canvas
|
||||
|
@ -199,4 +209,3 @@ class SelectTileDialogWithPreview(MfxDialog):
|
|||
if self.preview.setTile(self.app, key):
|
||||
return
|
||||
self.preview_key = -1
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ my %skip =
|
|||
|
||||
# my $cmd = shell_quote( 'flake8', '.' );
|
||||
my $cmd = shell_quote( 'flake8',
|
||||
grep { not exists $skip{$_} } glob('./*.py ./scripts/*.py ./tests/board_gen/*.py ./pysollib/*.py ./pysollib/[cmgpuw]*/{*/*.py,*.py} ./pysollib/tile/*.py ./pysollib/tk/{[a-p],selectcardset,selectgame}*.py ./pysollib/ui/tktile/*.py') );
|
||||
grep { not exists $skip{$_} } glob('./*.py ./scripts/*.py ./tests/board_gen/*.py ./pysollib/*.py ./pysollib/[cmgpuw]*/{*/*.py,*.py} ./pysollib/tile/*.py ./pysollib/tk/{[a-p],selectcardset,selectgame,selecttile}*.py ./pysollib/ui/tktile/*.py') );
|
||||
|
||||
# TEST
|
||||
eq_or_diff( scalar(`$cmd`), '', "flake8 is happy with the code." );
|
||||
|
|
Loading…
Add table
Reference in a new issue