From 4c3e99d9a6741c05fd39a8c545d0641d565faab1 Mon Sep 17 00:00:00 2001 From: Shlomi Fish Date: Tue, 18 Apr 2017 18:54:21 +0300 Subject: [PATCH] flake8 --- pysollib/tk/menubar.py | 29 +++++++++++++---------------- tests/style/py-flake8.t | 2 +- 2 files changed, 14 insertions(+), 17 deletions(-) diff --git a/pysollib/tk/menubar.py b/pysollib/tk/menubar.py index 6d4963ab..daadf9be 100644 --- a/pysollib/tk/menubar.py +++ b/pysollib/tk/menubar.py @@ -24,22 +24,20 @@ __all__ = ['PysolMenubarTk'] # imports -import Tkinter # PySol imports -from pysollib.mygettext import _, n_ +from pysollib.mygettext import _ from pysollib.mfxutil import USE_PIL from pysollib.util import CARDSET # toolkit imports -from pysollib.ui.tktile.tkconst import EVENT_HANDLED, EVENT_PROPAGATE, CURSOR_WATCH, COMPOUNDS -from pysollib.ui.tktile.tkutil import bind, after_idle from tkwidget import MfxMessageDialog from selectgame import SelectGameDialog, SelectGameDialogWithPreview from soundoptionsdialog import SoundOptionsDialog from selectcardset import SelectCardsetDialogWithPreview from selecttile import SelectTileDialogWithPreview -from pysollib.ui.tktile.findcarddialog import connect_game_find_card_dialog, destroy_find_card_dialog +from pysollib.ui.tktile.findcarddialog import connect_game_find_card_dialog, \ + destroy_find_card_dialog from solverdialog import connect_game_solver_dialog from pysollib.ui.tktile.menubar import PysolMenubarTkCommon @@ -49,6 +47,7 @@ from pysollib.ui.tktile.menubar import PysolMenubarTkCommon # * - menu actions # ************************************************************************ + class PysolMenubarTk(PysolMenubarTkCommon): def __init__(self, app, top, progress=None): PysolMenubarTkCommon.__init__(self, app, top, progress) @@ -88,17 +87,18 @@ class PysolMenubarTk(PysolMenubarTkCommon): def createThemesMenu(self, menu): return - def mSelectCardsetDialog(self, *event): - if self._cancelDrag(break_pause=False): return - ##strings, default = ("&OK", "&Load", "&Cancel"), 0 + if self._cancelDrag(break_pause=False): + return + # strings, default = ("&OK", "&Load", "&Cancel"), 0 strings, default = (None, _("&Load"), _("&Cancel"),), 1 strings, default = (None, _("&Load"), _("&Cancel"), _("&Info..."),), 1 t = CARDSET key = self.app.nextgame.cardset.index - d = SelectCardsetDialogWithPreview(self.top, title=_("Select ")+t, - app=self.app, manager=self.app.cardset_manager, key=key, - strings=strings, default=default) + d = SelectCardsetDialogWithPreview( + self.top, title=_("Select ")+t, + app=self.app, manager=self.app.cardset_manager, key=key, + strings=strings, default=default) cs = self.app.cardset_manager.get(d.key) if d.status != 0 or d.button != 1 or cs is None: return @@ -125,13 +125,10 @@ class PysolMenubarTk(PysolMenubarTkCommon): self.game.endGame(bookmark=1) self.game.quitGame(bookmark=1) - - def setToolbarRelief(self, relief): - if self._cancelDrag(break_pause=False): return + if self._cancelDrag(break_pause=False): + return self.app.opt.toolbar_relief = relief self.tkopt.toolbar_relief.set(relief) # update radiobutton self.app.toolbar.setRelief(relief) self.top.update_idletasks() - - diff --git a/tests/style/py-flake8.t b/tests/style/py-flake8.t index 35c52825..e3789e6f 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-g]*.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-m]*.py ./pysollib/ui/tktile/*.py') ); # TEST eq_or_diff( scalar(`$cmd`), '', "flake8 is happy with the code." );