mirror of
https://github.com/shlomif/PySolFC.git
synced 2025-04-05 00:02:29 -04:00
flake8
This commit is contained in:
parent
307ce03e23
commit
7f7f1669ad
2 changed files with 20 additions and 17 deletions
|
@ -25,8 +25,16 @@ __all__ = ['PysolStatusbar',
|
||||||
'HelpStatusbar']
|
'HelpStatusbar']
|
||||||
|
|
||||||
# imports
|
# imports
|
||||||
import os, sys
|
import os
|
||||||
|
import sys
|
||||||
import Tkinter
|
import Tkinter
|
||||||
|
from pysollib.mygettext import _
|
||||||
|
from tkwidget import MfxTooltip
|
||||||
|
from pysollib.settings import WIN_SYSTEM
|
||||||
|
|
||||||
|
if sys.version_info > (3,):
|
||||||
|
unicode = str
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
d = os.path.abspath(os.path.join(sys.path[0], os.pardir, os.pardir))
|
d = os.path.abspath(os.path.join(sys.path[0], os.pardir, os.pardir))
|
||||||
|
@ -34,13 +42,6 @@ if __name__ == '__main__':
|
||||||
import gettext
|
import gettext
|
||||||
gettext.install('pysol', d, unicode=True)
|
gettext.install('pysol', d, unicode=True)
|
||||||
|
|
||||||
# PySol imports
|
|
||||||
from pysollib.mygettext import _, n_
|
|
||||||
|
|
||||||
# Toolkit imports
|
|
||||||
from tkwidget import MfxTooltip
|
|
||||||
from pysollib.settings import WIN_SYSTEM
|
|
||||||
|
|
||||||
|
|
||||||
# ************************************************************************
|
# ************************************************************************
|
||||||
# *
|
# *
|
||||||
|
@ -92,7 +93,6 @@ class MfxStatusbar:
|
||||||
b.setText(tooltip)
|
b.setText(tooltip)
|
||||||
return label
|
return label
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# public methods
|
# public methods
|
||||||
#
|
#
|
||||||
|
@ -137,10 +137,12 @@ class MfxStatusbar:
|
||||||
|
|
||||||
def destroy(self):
|
def destroy(self):
|
||||||
for w in self._tooltips:
|
for w in self._tooltips:
|
||||||
if w: w.destroy()
|
if w:
|
||||||
|
w.destroy()
|
||||||
self._tooltips = []
|
self._tooltips = []
|
||||||
for w in self._widgets:
|
for w in self._widgets:
|
||||||
if w: w.destroy()
|
if w:
|
||||||
|
w.destroy()
|
||||||
self._widgets = []
|
self._widgets = []
|
||||||
|
|
||||||
|
|
||||||
|
@ -154,7 +156,7 @@ class PysolStatusbar(MfxStatusbar):
|
||||||
('moves', _('Moves/Total moves'), 10),
|
('moves', _('Moves/Total moves'), 10),
|
||||||
('gamenumber', _('Game number'), 26),
|
('gamenumber', _('Game number'), 26),
|
||||||
('stats', _('Games played: won/lost'), 12),
|
('stats', _('Games played: won/lost'), 12),
|
||||||
):
|
):
|
||||||
self._createLabel(n, tooltip=t, width=w)
|
self._createLabel(n, tooltip=t, width=w)
|
||||||
#
|
#
|
||||||
l = self._createLabel('info', expand=True)
|
l = self._createLabel('info', expand=True)
|
||||||
|
@ -170,7 +172,8 @@ class HelpStatusbar(MfxStatusbar):
|
||||||
|
|
||||||
class HtmlStatusbar(MfxStatusbar):
|
class HtmlStatusbar(MfxStatusbar):
|
||||||
def __init__(self, top, row, column, columnspan):
|
def __init__(self, top, row, column, columnspan):
|
||||||
MfxStatusbar.__init__(self, top, row=row, column=column, columnspan=columnspan)
|
MfxStatusbar.__init__(
|
||||||
|
self, top, row=row, column=column, columnspan=columnspan)
|
||||||
l = self._createLabel('url', expand=True)
|
l = self._createLabel('url', expand=True)
|
||||||
l.config(justify='left', anchor='w', padx=8)
|
l.config(justify='left', anchor='w', padx=8)
|
||||||
|
|
||||||
|
@ -187,13 +190,13 @@ class TestStatusbar(PysolStatusbar):
|
||||||
self.updateText(moves=999, gamenumber='#0123456789ABCDEF0123')
|
self.updateText(moves=999, gamenumber='#0123456789ABCDEF0123')
|
||||||
self.updateText(info='Some info text.')
|
self.updateText(info='Some info text.')
|
||||||
|
|
||||||
|
|
||||||
def statusbar_main(args):
|
def statusbar_main(args):
|
||||||
tk = Tkinter.Tk()
|
tk = Tkinter.Tk()
|
||||||
statusbar = TestStatusbar(tk, args)
|
TestStatusbar(tk, args)
|
||||||
tk.mainloop()
|
tk.mainloop()
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
sys.exit(statusbar_main(sys.argv))
|
sys.exit(statusbar_main(sys.argv))
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ my %skip =
|
||||||
|
|
||||||
# my $cmd = shell_quote( 'flake8', '.' );
|
# my $cmd = shell_quote( 'flake8', '.' );
|
||||||
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],select,solv,sound}*.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-s]}*.py ./pysollib/ui/tktile/*.py') );
|
||||||
|
|
||||||
# TEST
|
# TEST
|
||||||
eq_or_diff( scalar(`$cmd`), '', "flake8 is happy with the code." );
|
eq_or_diff( scalar(`$cmd`), '', "flake8 is happy with the code." );
|
||||||
|
|
Loading…
Add table
Reference in a new issue