From 7f7f1669ad82ab3c4f5ac3b11f4ed65675628ef8 Mon Sep 17 00:00:00 2001 From: Shlomi Fish Date: Tue, 18 Apr 2017 20:02:29 +0300 Subject: [PATCH] flake8 --- pysollib/tk/statusbar.py | 35 +++++++++++++++++++---------------- tests/style/py-flake8.t | 2 +- 2 files changed, 20 insertions(+), 17 deletions(-) diff --git a/pysollib/tk/statusbar.py b/pysollib/tk/statusbar.py index 11cd3b4e..9c987880 100644 --- a/pysollib/tk/statusbar.py +++ b/pysollib/tk/statusbar.py @@ -25,8 +25,16 @@ __all__ = ['PysolStatusbar', 'HelpStatusbar'] # imports -import os, sys +import os +import sys 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__': d = os.path.abspath(os.path.join(sys.path[0], os.pardir, os.pardir)) @@ -34,13 +42,6 @@ if __name__ == '__main__': import gettext 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) return label - # # public methods # @@ -137,10 +137,12 @@ class MfxStatusbar: def destroy(self): for w in self._tooltips: - if w: w.destroy() + if w: + w.destroy() self._tooltips = [] for w in self._widgets: - if w: w.destroy() + if w: + w.destroy() self._widgets = [] @@ -154,7 +156,7 @@ class PysolStatusbar(MfxStatusbar): ('moves', _('Moves/Total moves'), 10), ('gamenumber', _('Game number'), 26), ('stats', _('Games played: won/lost'), 12), - ): + ): self._createLabel(n, tooltip=t, width=w) # l = self._createLabel('info', expand=True) @@ -170,7 +172,8 @@ class HelpStatusbar(MfxStatusbar): class HtmlStatusbar(MfxStatusbar): 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.config(justify='left', anchor='w', padx=8) @@ -187,13 +190,13 @@ class TestStatusbar(PysolStatusbar): self.updateText(moves=999, gamenumber='#0123456789ABCDEF0123') self.updateText(info='Some info text.') + def statusbar_main(args): tk = Tkinter.Tk() - statusbar = TestStatusbar(tk, args) + TestStatusbar(tk, args) tk.mainloop() return 0 + if __name__ == '__main__': sys.exit(statusbar_main(sys.argv)) - - diff --git a/tests/style/py-flake8.t b/tests/style/py-flake8.t index 84b55b39..13ecdf85 100644 --- a/tests/style/py-flake8.t +++ b/tests/style/py-flake8.t @@ -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],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 eq_or_diff( scalar(`$cmd`), '', "flake8 is happy with the code." );