1
0
Fork 0
mirror of https://github.com/shlomif/PySolFC.git synced 2025-04-05 00:02:29 -04:00

* little reorganization: move some func. from pysollib/actions.py to pysollib/tk/menubar.py

* bug fixes


git-svn-id: file:///home/shlomif/Backup/svn-dumps/PySolFC/svnsync-repos/pysolfc/PySolFC/trunk@57 efabe8c0-fbe8-4139-b769-b5e6d273206e
This commit is contained in:
skomoroh 2006-08-25 21:27:33 +00:00
parent d65367de02
commit 3ce24a088b
7 changed files with 161 additions and 190 deletions

View file

@ -4,7 +4,7 @@
## ##
include pysol setup.py setup.cfg MANIFEST.in Makefile COPYING README include pysol setup.py setup.cfg MANIFEST.in Makefile COPYING README
#recursive-include pysollib *.py #recursive-include pysollib *.py
include pysollib/*.py pysollib/tk/*.py include pysollib/*.py pysollib/tk/*.py pysollib/pysolgtk/*.py
include pysollib/games/*.py pysollib/games/special/*.py include pysollib/games/*.py pysollib/games/special/*.py
include pysollib/games/ultra/*.py pysollib/games/mahjongg/*.py include pysollib/games/ultra/*.py pysollib/games/mahjongg/*.py
include docs/* include docs/*
@ -28,7 +28,8 @@ graft data/cardset-tuxedo
graft data/cardset-vienna-2k graft data/cardset-vienna-2k
graft data/html graft data/html
graft data/html-src graft data/html-src
graft data/images #graft data/images
recursive-include data/images *.gif *.png
#graft data/music #graft data/music
#graft data/plugins #graft data/plugins
graft data/sound graft data/sound

View file

@ -56,7 +56,6 @@ from pysoltk import GameInfoDialog
from pysoltk import EVENT_HANDLED, EVENT_PROPAGATE from pysoltk import EVENT_HANDLED, EVENT_PROPAGATE
from pysoltk import MfxMessageDialog, MfxSimpleEntry from pysoltk import MfxMessageDialog, MfxSimpleEntry
from pysoltk import MfxExceptionDialog from pysoltk import MfxExceptionDialog
from pysoltk import MfxRadioMenuItem, MfxCheckMenuItem, StringVar
from pysoltk import PlayerOptionsDialog from pysoltk import PlayerOptionsDialog
#from pysoltk import HintOptionsDialog #from pysoltk import HintOptionsDialog
from pysoltk import TimeoutsDialog from pysoltk import TimeoutsDialog
@ -64,7 +63,7 @@ from pysoltk import ColorsDialog
from pysoltk import FontsDialog from pysoltk import FontsDialog
from pysoltk import EditTextDialog from pysoltk import EditTextDialog
from pysoltk import TOOLBAR_BUTTONS from pysoltk import TOOLBAR_BUTTONS
from pysoltk import create_find_card_dialog, connect_game_find_card_dialog, destroy_find_card_dialog from pysoltk import create_find_card_dialog
from help import help_about, help_html from help import help_about, help_html
gettext = _ gettext = _
@ -98,106 +97,9 @@ class PysolMenubarActions:
rules = 0, rules = 0,
pause = 0, pause = 0,
) )
# structure to convert menu-options to Toolkit variables
self.tkopt = Struct(
gameid = MfxRadioMenuItem(self),
gameid_popular = MfxRadioMenuItem(self),
comment = MfxCheckMenuItem(self),
autofaceup = MfxCheckMenuItem(self),
autodrop = MfxCheckMenuItem(self),
autodeal = MfxCheckMenuItem(self),
quickplay = MfxCheckMenuItem(self),
undo = MfxCheckMenuItem(self),
bookmarks = MfxCheckMenuItem(self),
hint = MfxCheckMenuItem(self),
highlight_piles = MfxCheckMenuItem(self),
highlight_cards = MfxCheckMenuItem(self),
highlight_samerank = MfxCheckMenuItem(self),
highlight_not_matching = MfxCheckMenuItem(self),
mahjongg_show_removed = MfxCheckMenuItem(self),
shisen_show_hint = MfxCheckMenuItem(self),
sound = MfxCheckMenuItem(self),
cardback = MfxRadioMenuItem(self),
tabletile = MfxRadioMenuItem(self),
animations = MfxRadioMenuItem(self),
shadow = MfxCheckMenuItem(self),
shade = MfxCheckMenuItem(self),
shade_filled_stacks = MfxCheckMenuItem(self),
shrink_face_down = MfxCheckMenuItem(self),
toolbar = MfxRadioMenuItem(self),
toolbar_style = StringVar(),
toolbar_relief = StringVar(),
toolbar_compound = StringVar(),
toolbar_size = MfxRadioMenuItem(self),
statusbar = MfxCheckMenuItem(self),
num_cards = MfxCheckMenuItem(self),
helpbar = MfxCheckMenuItem(self),
save_games_geometry = MfxCheckMenuItem(self),
splashscreen = MfxCheckMenuItem(self),
demo_logo = MfxCheckMenuItem(self),
sticky_mouse = MfxCheckMenuItem(self),
mouse_undo = MfxCheckMenuItem(self),
negative_bottom = MfxCheckMenuItem(self),
pause = MfxCheckMenuItem(self),
toolbar_vars = {},
)
for w in TOOLBAR_BUTTONS:
self.tkopt.toolbar_vars[w] = MfxCheckMenuItem(self)
def connectGame(self, game): def connectGame(self, game):
self.game = game self.game = game
if game is None:
return
assert self.app is game.app
tkopt, opt = self.tkopt, self.app.opt
# set state of the menu items
tkopt.gameid.set(game.id)
tkopt.gameid_popular.set(game.id)
tkopt.comment.set(bool(game.gsaveinfo.comment))
tkopt.autofaceup.set(opt.autofaceup)
tkopt.autodrop.set(opt.autodrop)
tkopt.autodeal.set(opt.autodeal)
tkopt.quickplay.set(opt.quickplay)
tkopt.undo.set(opt.undo)
tkopt.hint.set(opt.hint)
tkopt.bookmarks.set(opt.bookmarks)
tkopt.highlight_piles.set(opt.highlight_piles)
tkopt.highlight_cards.set(opt.highlight_cards)
tkopt.highlight_samerank.set(opt.highlight_samerank)
tkopt.highlight_not_matching.set(opt.highlight_not_matching)
tkopt.shrink_face_down.set(opt.shrink_face_down)
tkopt.shade_filled_stacks.set(opt.shade_filled_stacks)
tkopt.mahjongg_show_removed.set(opt.mahjongg_show_removed)
tkopt.shisen_show_hint.set(opt.shisen_show_hint)
tkopt.sound.set(opt.sound)
tkopt.cardback.set(self.app.cardset.backindex)
tkopt.tabletile.set(self.app.tabletile_index)
tkopt.animations.set(opt.animations)
tkopt.shadow.set(opt.shadow)
tkopt.shade.set(opt.shade)
tkopt.toolbar.set(opt.toolbar)
tkopt.toolbar_style.set(opt.toolbar_style)
tkopt.toolbar_relief.set(opt.toolbar_relief)
tkopt.toolbar_compound.set(opt.toolbar_compound)
tkopt.toolbar_size.set(opt.toolbar_size)
tkopt.toolbar_relief.set(opt.toolbar_relief)
tkopt.statusbar.set(opt.statusbar)
tkopt.num_cards.set(opt.num_cards)
tkopt.helpbar.set(opt.helpbar)
tkopt.save_games_geometry.set(opt.save_games_geometry)
tkopt.demo_logo.set(opt.demo_logo)
tkopt.splashscreen.set(opt.splashscreen)
tkopt.sticky_mouse.set(opt.sticky_mouse)
tkopt.mouse_undo.set(opt.mouse_undo)
tkopt.negative_bottom.set(opt.negative_bottom)
for w in TOOLBAR_BUTTONS:
tkopt.toolbar_vars[w].set(opt.toolbar_vars[w])
if game.canFindCard():
connect_game_find_card_dialog(game)
else:
destroy_find_card_dialog()
# will get called after connectGame() # will get called after connectGame()
def updateRecentGamesMenu(self, gameids): def updateRecentGamesMenu(self, gameids):
@ -328,9 +230,6 @@ class PysolMenubarActions:
self.setToolbarState(ms.autodrop, "autodrop") self.setToolbarState(ms.autodrop, "autodrop")
self.setToolbarState(ms.pause, "pause") self.setToolbarState(ms.pause, "pause")
self.setToolbarState(ms.rules, "rules") self.setToolbarState(ms.rules, "rules")
#
self.tkopt.comment.set(bool(self.game.gsaveinfo.comment))
self.tkopt.pause.set(self.game.pause)
# update menu items and toolbar # update menu items and toolbar
def updateMenus(self): def updateMenus(self):
@ -368,9 +267,6 @@ class PysolMenubarActions:
return return
if self.changed(): if self.changed():
if not self.game.areYouSure(_("Select game")): if not self.game.areYouSure(_("Select game")):
# restore radiobutton settings
self.tkopt.gameid.set(self.game.id)
self.tkopt.gameid_popular.set(self.game.id)
return return
self.game.endGame() self.game.endGame()
self.game.quitGame(id, random=random) self.game.quitGame(id, random=random)
@ -626,15 +522,9 @@ class PysolMenubarActions:
if fd: fd.close() if fd: fd.close()
d = MfxMessageDialog(self.top, title=PACKAGE+_(" Info"), bitmap="info", d = MfxMessageDialog(self.top, title=PACKAGE+_(" Info"), bitmap="info",
text=_("Comments were appended to\n\n") + fn) text=_("Comments were appended to\n\n") + fn)
self.tkopt.comment.set(bool(game.gsaveinfo.comment)) self._setCommentMenu(bool(game.gsaveinfo.comment))
def mPause(self, *args):
if not self.game.pause:
if self._cancelDrag(): return
self.game.doPause()
self.tkopt.pause.set(self.game.pause)
# #
# Game menu - statistics # Game menu - statistics
# #
@ -804,20 +694,6 @@ class PysolMenubarActions:
self.game.updateStatus(player=self.app.opt.player) self.game.updateStatus(player=self.app.opt.player)
self.game.updateStatus(stats=self.app.stats.getStats(self.app.opt.player, self.game.id)) self.game.updateStatus(stats=self.app.stats.getStats(self.app.opt.player, self.game.id))
## def mOptIrregularPiles(self, *args):
## if self._cancelDrag(): return
## self.app.opt.irregular_piles = self.tkopt.irregular_piles.get()
def _mOptTableTile(self, i):
if self.app.setTile(i):
self.tkopt.tabletile.set(i)
def _mOptTableColor(self, color):
tile = self.app.tabletile_manager.get(0)
tile.color = color
if self.app.setTile(0):
self.tkopt.tabletile.set(0)
def mOptColors(self, *args): def mOptColors(self, *args):
if self._cancelDrag(break_pause=False): return if self._cancelDrag(break_pause=False): return
d = ColorsDialog(self.top, _("Set colors"), self.app) d = ColorsDialog(self.top, _("Set colors"), self.app)
@ -836,7 +712,7 @@ class PysolMenubarActions:
# #
if (text_color != self.app.opt.colors['text'] or if (text_color != self.app.opt.colors['text'] or
use_default_text_color != self.app.opt.use_default_text_color): use_default_text_color != self.app.opt.use_default_text_color):
self.app.setTile(self.tkopt.tabletile.get(), 1) self.app.setTile(self.app.opt.tabletile_index)
def mOptFonts(self, *args): def mOptFonts(self, *args):
if self._cancelDrag(break_pause=False): return if self._cancelDrag(break_pause=False): return

View file

@ -47,8 +47,8 @@ from tkutil import color_tk2gtk, color_gtk2tk
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 selectgame import SelectGameDialogWithPreview from selectgame import SelectGameDialogWithPreview
from findcarddialog import connect_game_find_card_dialog, destroy_find_card_dialog
gettext = _ gettext = _
@ -76,6 +76,19 @@ class PysolMenubar(PysolMenubarActions):
0, 0); 0, 0);
menubar.show() menubar.show()
def connectGame(self, game):
self.game = game
if game is None:
return
assert self.app is game.app
## tkopt, opt = self.tkopt, self.app.opt
## tkopt.gameid.set(game.id)
## tkopt.gameid_popular.set(game.id)
## tkopt.comment.set(bool(game.gsaveinfo.comment))
if game.canFindCard():
connect_game_find_card_dialog(game)
else:
destroy_find_card_dialog()
# #
# create menubar # create menubar
@ -759,6 +772,10 @@ class PysolMenubar(PysolMenubarActions):
self.game.endGame() self.game.endGame()
self.game.quitGame(d.gameid, random=d.random) self.game.quitGame(d.gameid, random=d.random)
def mPause(self, *args):
if not self.game.pause:
if self._cancelDrag(): return
self.game.doPause()
def mOptSoundDialog(self, *args): def mOptSoundDialog(self, *args):
if self._cancelDrag(break_pause=False): return if self._cancelDrag(break_pause=False): return
@ -776,15 +793,11 @@ class PysolMenubar(PysolMenubarActions):
key=key) key=key)
if d.status == 0 and d.button in (0, 1): if d.status == 0 and d.button in (0, 1):
if type(d.key) is str: if type(d.key) is str:
self._mOptTableColor(d.key) tile = self.app.tabletile_manager.get(0)
tile.color = d.key
self.app.setTile(0)
elif d.key > 0 and d.key != self.app.tabletile_index: elif d.key > 0 and d.key != self.app.tabletile_index:
self._mOptTableTile(d.key) self.app.setTile(d.key)
## if type(d.key) is str:
## tile = self.app.tabletile_manager.get(0)
## tile.color = d.color
## self.app.setTile(0)
## elif d.key > 0 and d.key != self.app.tabletile_index:
## self.app.setTile(i)
def mSelectCardsetDialog(self, *event): def mSelectCardsetDialog(self, *event):
@ -845,3 +858,8 @@ class PysolMenubar(PysolMenubarActions):
def updateAll(self, *event): def updateAll(self, *event):
self.app.canvas.updateAll() self.app.canvas.updateAll()
def _setCommentMenu(self, v):
# FIXME
pass

View file

@ -54,54 +54,6 @@ def make_help_toplevel(parent, title=None, class_=None):
return makeToplevel(parent, title=title, class_=class_, gtkclass=_MfxToplevel) return makeToplevel(parent, title=title, class_=class_, gtkclass=_MfxToplevel)
class MfxCheckMenuItem:
def __init__(self, menubar, path=None):
self.menubar = menubar
self.path = path
self.value = None
def get(self):
##print 'MfxCheckMenuItem.get:', self.path
if self.path is None: return 0
w = self.menubar.menus.get_widget(self.path)
return w.active
def set(self, value):
##print 'MfxCheckMenuItem.set:', value, self.path
if self.path is None: return
if not value or value == 'false': value = 0
assert type(value) is types.IntType and 0 <= value <= 1
self.value = value
w = self.menubar.menus.get_widget(self.path)
w.set_active(value)
#print self.path, value, w, w.active
class MfxRadioMenuItem(MfxCheckMenuItem):
def get(self):
##print 'MfxRadioMenuItem.get:', self.path, self.value
if self.path is None: return 0
w = self.menubar.menus.get_widget(self.path)
#from pprint import pprint
#pprint(dir(w))
#print 'widget:', w
#print w.active
#print w.__dict__
return self.value
def set(self, value):
##print 'MfxRadioMenuItem.set:', value, self.path
if self.path is None: return
if not value or value == 'false': value = 0
assert type(value) is types.IntType and 0 <= value
self.value = value
#w = self.menubar.menus.get_widget(self.path)
#w.set_active(value)
#print self.path, value #, w, w.active
class StringVar:
def set(self, v):
pass
# /*********************************************************************** # /***********************************************************************
# // A toplevel window. # // A toplevel window.
# ************************************************************************/ # ************************************************************************/

View file

@ -56,6 +56,8 @@ 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 findcarddialog import connect_game_find_card_dialog, destroy_find_card_dialog
from tkwrap import MfxRadioMenuItem, MfxCheckMenuItem, StringVar
#from toolbar import TOOLBAR_BUTTONS #from toolbar import TOOLBAR_BUTTONS
from tkconst import TOOLBAR_BUTTONS from tkconst import TOOLBAR_BUTTONS
@ -197,6 +199,8 @@ class MfxMenu(MfxMenubar):
class PysolMenubar(PysolMenubarActions): class PysolMenubar(PysolMenubarActions):
def __init__(self, app, top, progress=None): def __init__(self, app, top, progress=None):
PysolMenubarActions.__init__(self, app, top) PysolMenubarActions.__init__(self, app, top)
self._createTkOpt()
self._setOptions()
# init columnbreak # init columnbreak
self.__cb_max = int(self.top.winfo_screenheight()/23) self.__cb_max = int(self.top.winfo_screenheight()/23)
## sh = self.top.winfo_screenheight() ## sh = self.top.winfo_screenheight()
@ -217,6 +221,110 @@ class PysolMenubar(PysolMenubarActions):
self.updateBackgroundImagesMenu() self.updateBackgroundImagesMenu()
self.top.config(menu=self.__menubar) self.top.config(menu=self.__menubar)
def _createTkOpt(self):
# structure to convert menu-options to Toolkit variables
self.tkopt = Struct(
gameid = MfxRadioMenuItem(self),
gameid_popular = MfxRadioMenuItem(self),
comment = MfxCheckMenuItem(self),
autofaceup = MfxCheckMenuItem(self),
autodrop = MfxCheckMenuItem(self),
autodeal = MfxCheckMenuItem(self),
quickplay = MfxCheckMenuItem(self),
undo = MfxCheckMenuItem(self),
bookmarks = MfxCheckMenuItem(self),
hint = MfxCheckMenuItem(self),
highlight_piles = MfxCheckMenuItem(self),
highlight_cards = MfxCheckMenuItem(self),
highlight_samerank = MfxCheckMenuItem(self),
highlight_not_matching = MfxCheckMenuItem(self),
mahjongg_show_removed = MfxCheckMenuItem(self),
shisen_show_hint = MfxCheckMenuItem(self),
sound = MfxCheckMenuItem(self),
cardback = MfxRadioMenuItem(self),
tabletile = MfxRadioMenuItem(self),
animations = MfxRadioMenuItem(self),
shadow = MfxCheckMenuItem(self),
shade = MfxCheckMenuItem(self),
shade_filled_stacks = MfxCheckMenuItem(self),
shrink_face_down = MfxCheckMenuItem(self),
toolbar = MfxRadioMenuItem(self),
toolbar_style = StringVar(),
toolbar_relief = StringVar(),
toolbar_compound = StringVar(),
toolbar_size = MfxRadioMenuItem(self),
statusbar = MfxCheckMenuItem(self),
num_cards = MfxCheckMenuItem(self),
helpbar = MfxCheckMenuItem(self),
save_games_geometry = MfxCheckMenuItem(self),
splashscreen = MfxCheckMenuItem(self),
demo_logo = MfxCheckMenuItem(self),
sticky_mouse = MfxCheckMenuItem(self),
mouse_undo = MfxCheckMenuItem(self),
negative_bottom = MfxCheckMenuItem(self),
pause = MfxCheckMenuItem(self),
toolbar_vars = {},
)
for w in TOOLBAR_BUTTONS:
self.tkopt.toolbar_vars[w] = MfxCheckMenuItem(self)
def _setOptions(self):
tkopt, opt = self.tkopt, self.app.opt
# set state of the menu items
tkopt.autofaceup.set(opt.autofaceup)
tkopt.autodrop.set(opt.autodrop)
tkopt.autodeal.set(opt.autodeal)
tkopt.quickplay.set(opt.quickplay)
tkopt.undo.set(opt.undo)
tkopt.hint.set(opt.hint)
tkopt.bookmarks.set(opt.bookmarks)
tkopt.highlight_piles.set(opt.highlight_piles)
tkopt.highlight_cards.set(opt.highlight_cards)
tkopt.highlight_samerank.set(opt.highlight_samerank)
tkopt.highlight_not_matching.set(opt.highlight_not_matching)
tkopt.shrink_face_down.set(opt.shrink_face_down)
tkopt.shade_filled_stacks.set(opt.shade_filled_stacks)
tkopt.mahjongg_show_removed.set(opt.mahjongg_show_removed)
tkopt.shisen_show_hint.set(opt.shisen_show_hint)
tkopt.sound.set(opt.sound)
tkopt.cardback.set(self.app.cardset.backindex)
tkopt.tabletile.set(self.app.tabletile_index)
tkopt.animations.set(opt.animations)
tkopt.shadow.set(opt.shadow)
tkopt.shade.set(opt.shade)
tkopt.toolbar.set(opt.toolbar)
tkopt.toolbar_style.set(opt.toolbar_style)
tkopt.toolbar_relief.set(opt.toolbar_relief)
tkopt.toolbar_compound.set(opt.toolbar_compound)
tkopt.toolbar_size.set(opt.toolbar_size)
tkopt.toolbar_relief.set(opt.toolbar_relief)
tkopt.statusbar.set(opt.statusbar)
tkopt.num_cards.set(opt.num_cards)
tkopt.helpbar.set(opt.helpbar)
tkopt.save_games_geometry.set(opt.save_games_geometry)
tkopt.demo_logo.set(opt.demo_logo)
tkopt.splashscreen.set(opt.splashscreen)
tkopt.sticky_mouse.set(opt.sticky_mouse)
tkopt.mouse_undo.set(opt.mouse_undo)
tkopt.negative_bottom.set(opt.negative_bottom)
for w in TOOLBAR_BUTTONS:
tkopt.toolbar_vars[w].set(opt.toolbar_vars[w])
def connectGame(self, game):
self.game = game
if game is None:
return
assert self.app is game.app
tkopt, opt = self.tkopt, self.app.opt
tkopt.gameid.set(game.id)
tkopt.gameid_popular.set(game.id)
tkopt.comment.set(bool(game.gsaveinfo.comment))
tkopt.pause.set(self.game.pause)
if game.canFindCard():
connect_game_find_card_dialog(game)
else:
destroy_find_card_dialog()
# create a GTK-like path # create a GTK-like path
def _addPath(self, path, menu, index, submenu): def _addPath(self, path, menu, index, submenu):
if not self.__menupath.has_key(path): if not self.__menupath.has_key(path):
@ -828,6 +936,9 @@ class PysolMenubar(PysolMenubarActions):
w = getattr(self.app.toolbar, path + "_button") w = getattr(self.app.toolbar, path + "_button")
w["state"] = s w["state"] = s
def _setCommentMenu(self, v):
self.tkopt.comment.set(v)
# #
# menu actions # menu actions
@ -895,6 +1006,12 @@ class PysolMenubar(PysolMenubarActions):
self.game.saveGame(filename) self.game.saveGame(filename)
self.updateMenus() self.updateMenus()
def mPause(self, *args):
if not self.game.pause:
if self._cancelDrag(): return
self.game.doPause()
self.tkopt.pause.set(self.game.pause)
def mOptSoundDialog(self, *args): def mOptSoundDialog(self, *args):
if self._cancelDrag(break_pause=False): return if self._cancelDrag(break_pause=False): return
d = SoundOptionsDialog(self.top, _("Sound settings"), self.app) d = SoundOptionsDialog(self.top, _("Sound settings"), self.app)
@ -1050,7 +1167,8 @@ class PysolMenubar(PysolMenubarActions):
n = self.app.tabletile_manager.len() n = self.app.tabletile_manager.len()
if n >= 2: if n >= 2:
i = (self.tkopt.tabletile.get() + 1) % n i = (self.tkopt.tabletile.get() + 1) % n
self._mOptTableTile(i) if self.app.setTile(i):
self.tkopt.tabletile.set(i)
def mSelectTileDialog(self, *event): def mSelectTileDialog(self, *event):
if self._cancelDrag(break_pause=False): return if self._cancelDrag(break_pause=False): return
@ -1063,9 +1181,13 @@ class PysolMenubar(PysolMenubarActions):
key=key) key=key)
if d.status == 0 and d.button in (0, 1): if d.status == 0 and d.button in (0, 1):
if type(d.key) is str: if type(d.key) is str:
self._mOptTableColor(d.key) tile = self.app.tabletile_manager.get(0)
tile.color = d.key
if self.app.setTile(0):
self.tkopt.tabletile.set(0)
elif d.key > 0 and d.key != self.app.tabletile_index: elif d.key > 0 and d.key != self.app.tabletile_index:
self._mOptTableTile(d.key) if self.app.setTile(d.key):
self.tkopt.tabletile.set(d.key)
def mOptToolbar(self, *event): def mOptToolbar(self, *event):
##if self._cancelDrag(break_pause=False): return ##if self._cancelDrag(break_pause=False): return

View file

@ -190,7 +190,7 @@ class SelectTileDialogWithPreview(MfxDialog):
return return
canvas = self.preview.canvas canvas = self.preview.canvas
canvas.deleteAllItems() canvas.deleteAllItems()
if type(key) in str: if type(key) is str:
# solid color # solid color
canvas.config(bg=key) canvas.config(bg=key)
canvas.setTile(None) canvas.setTile(None)

View file

@ -56,6 +56,7 @@ kw = {
'scripts' : ['pysol'], 'scripts' : ['pysol'],
'packages' : ['pysollib', 'packages' : ['pysollib',
'pysollib.tk', 'pysollib.tk',
'pysollib.pysolgtk',
'pysollib.games', 'pysollib.games',
'pysollib.games.special', 'pysollib.games.special',
'pysollib.games.ultra', 'pysollib.games.ultra',
@ -66,5 +67,6 @@ kw = {
if os.name == 'nt': if os.name == 'nt':
kw['windows'] = [{'script': 'pysol', kw['windows'] = [{'script': 'pysol',
'icon_resources': [(1, "data/pysol.ico")], }] 'icon_resources': [(1, "data/pysol.ico")], }]
kw['packages'].remove('pysollib.pysolgtk')
setup(**kw) setup(**kw)