1
0
Fork 0
mirror of https://github.com/shlomif/PySolFC.git synced 2025-04-05 00:02:29 -04:00
This commit is contained in:
Shlomi Fish 2017-04-18 18:54:21 +03:00
parent 6245da52dd
commit 4c3e99d9a6
2 changed files with 14 additions and 17 deletions

View file

@ -24,22 +24,20 @@
__all__ = ['PysolMenubarTk'] __all__ = ['PysolMenubarTk']
# imports # imports
import Tkinter
# PySol imports # PySol imports
from pysollib.mygettext import _, n_ from pysollib.mygettext import _
from pysollib.mfxutil import USE_PIL from pysollib.mfxutil import USE_PIL
from pysollib.util import CARDSET from pysollib.util import CARDSET
# toolkit imports # 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 tkwidget import MfxMessageDialog
from selectgame import SelectGameDialog, SelectGameDialogWithPreview from selectgame import SelectGameDialog, SelectGameDialogWithPreview
from soundoptionsdialog import SoundOptionsDialog from soundoptionsdialog import SoundOptionsDialog
from selectcardset import SelectCardsetDialogWithPreview from selectcardset import SelectCardsetDialogWithPreview
from selecttile import SelectTileDialogWithPreview 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 solverdialog import connect_game_solver_dialog
from pysollib.ui.tktile.menubar import PysolMenubarTkCommon from pysollib.ui.tktile.menubar import PysolMenubarTkCommon
@ -49,6 +47,7 @@ from pysollib.ui.tktile.menubar import PysolMenubarTkCommon
# * - menu actions # * - menu actions
# ************************************************************************ # ************************************************************************
class PysolMenubarTk(PysolMenubarTkCommon): class PysolMenubarTk(PysolMenubarTkCommon):
def __init__(self, app, top, progress=None): def __init__(self, app, top, progress=None):
PysolMenubarTkCommon.__init__(self, app, top, progress) PysolMenubarTkCommon.__init__(self, app, top, progress)
@ -88,17 +87,18 @@ class PysolMenubarTk(PysolMenubarTkCommon):
def createThemesMenu(self, menu): def createThemesMenu(self, menu):
return return
def mSelectCardsetDialog(self, *event): def mSelectCardsetDialog(self, *event):
if self._cancelDrag(break_pause=False): return if self._cancelDrag(break_pause=False):
##strings, default = ("&OK", "&Load", "&Cancel"), 0 return
# strings, default = ("&OK", "&Load", "&Cancel"), 0
strings, default = (None, _("&Load"), _("&Cancel"),), 1 strings, default = (None, _("&Load"), _("&Cancel"),), 1
strings, default = (None, _("&Load"), _("&Cancel"), _("&Info..."),), 1 strings, default = (None, _("&Load"), _("&Cancel"), _("&Info..."),), 1
t = CARDSET t = CARDSET
key = self.app.nextgame.cardset.index key = self.app.nextgame.cardset.index
d = SelectCardsetDialogWithPreview(self.top, title=_("Select ")+t, d = SelectCardsetDialogWithPreview(
app=self.app, manager=self.app.cardset_manager, key=key, self.top, title=_("Select ")+t,
strings=strings, default=default) app=self.app, manager=self.app.cardset_manager, key=key,
strings=strings, default=default)
cs = self.app.cardset_manager.get(d.key) cs = self.app.cardset_manager.get(d.key)
if d.status != 0 or d.button != 1 or cs is None: if d.status != 0 or d.button != 1 or cs is None:
return return
@ -125,13 +125,10 @@ class PysolMenubarTk(PysolMenubarTkCommon):
self.game.endGame(bookmark=1) self.game.endGame(bookmark=1)
self.game.quitGame(bookmark=1) self.game.quitGame(bookmark=1)
def setToolbarRelief(self, relief): 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.app.opt.toolbar_relief = relief
self.tkopt.toolbar_relief.set(relief) # update radiobutton self.tkopt.toolbar_relief.set(relief) # update radiobutton
self.app.toolbar.setRelief(relief) self.app.toolbar.setRelief(relief)
self.top.update_idletasks() self.top.update_idletasks()

View file

@ -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-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 # TEST
eq_or_diff( scalar(`$cmd`), '', "flake8 is happy with the code." ); eq_or_diff( scalar(`$cmd`), '', "flake8 is happy with the code." );