diff --git a/docs/README.SOURCE b/docs/README.SOURCE index b9ed18c8..3e75d42f 100644 --- a/docs/README.SOURCE +++ b/docs/README.SOURCE @@ -144,7 +144,7 @@ The toolkit layer tk/tkcanvas.py: Wrapper for canvas widgets. - tk/tkwrap.py: + pysollib/ui/tktile/tkwrap.py: Wrapper for other widgets. tk/card.py: diff --git a/pysollib/pysoltk.py b/pysollib/pysoltk.py index 99b42c0c..0943a742 100644 --- a/pysollib/pysoltk.py +++ b/pysollib/pysoltk.py @@ -28,8 +28,8 @@ if TOOLKIT == 'tk': from pysollib.ui.tktile.tkutil import * from pysollib.ui.tktile.card import * from pysollib.ui.tktile.tkcanvas import * + from pysollib.ui.tktile.tkwrap import * if USE_TILE: - from pysollib.tile.tkwrap import * from pysollib.tile.tkwidget import * from pysollib.tile.tkhtml import * from pysollib.tile.edittextdialog import * @@ -49,7 +49,6 @@ if TOOLKIT == 'tk': from pysollib.tile.selectcardset import * from pysollib.tile.selecttree import * else: - from pysollib.tk.tkwrap import * from pysollib.tk.tkwidget import * from pysollib.tk.tkhtml import * from pysollib.tk.edittextdialog import * diff --git a/pysollib/tk/tkwrap.py b/pysollib/tk/tkwrap.py deleted file mode 100644 index a63f632a..00000000 --- a/pysollib/tk/tkwrap.py +++ /dev/null @@ -1,147 +0,0 @@ -#!/usr/bin/env python -# -*- mode: python; coding: utf-8; -*- -##---------------------------------------------------------------------------## -## -## Copyright (C) 1998-2003 Markus Franz Xaver Johannes Oberhumer -## Copyright (C) 2003 Mt. Hood Playing Card Co. -## Copyright (C) 2005-2009 Skomoroh -## -## This program is free software: you can redistribute it and/or modify -## it under the terms of the GNU General Public License as published by -## the Free Software Foundation, either version 3 of the License, or -## (at your option) any later version. -## -## This program is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -## GNU General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with this program. If not, see . -## -##---------------------------------------------------------------------------## - -__all__ = ['TclError', - 'MfxRoot'] - -# imports -import Tkinter -TclError = Tkinter.TclError - -# PySol imports -from pysollib.ui.tktile.tkconst import EVENT_PROPAGATE - - -# ************************************************************************ -# * Wrapper class for Tk. -# * Required so that a Game will get properly destroyed. -# ************************************************************************ - -class MfxRoot(Tkinter.Tk): - def __init__(self, **kw): - Tkinter.Tk.__init__(self, **kw) - self.app = None - self.wm_protocol('WM_DELETE_WINDOW', self.wmDeleteWindow) - # for interruptible sleep - #self.sleep_var = Tkinter.IntVar(self) - #self.sleep_var.set(0) - self.sleep_var = 0 - self.after_id = None - ##self.bind('', self._sleepEvent, add=True) - - def connectApp(self, app): - self.app = app - - # sometimes an update() is needed under Windows, whereas - # under Unix an update_idletasks() would be enough... - def busyUpdate(self): - game = None - if self.app: game = self.app.game - if not game: - self.update() - else: - old_busy = game.busy - game.busy = 1 - if game.canvas: - game.canvas.update() - self.update() - game.busy = old_busy - - def mainquit(self): - self.after_idle(self.quit) - - def screenshot(self, filename): - ##print 'MfxRoot.screenshot not yet implemented' - pass - - def setCursor(self, cursor): - if 0: - ## FIXME: this causes ugly resizes ! - Tkinter.Tk.config(self, cursor=cursor) - elif 0: - ## and this is even worse - ##print self.children - for v in self.children.values(): - v.config(cursor=cursor) - else: - pass - - # - # sleep - # - - def sleep(self, seconds): - #time.sleep(seconds) - self.after(int(seconds*1000)) - return - print 'sleep', seconds - timeout = int(seconds*1000) - self.sleep_var = 0 - while timeout > 0: - self.update() - self.update_idletasks() - if self.sleep_var: - break - self.after(100) - timeout -= 100 - print 'finish sleep' - return - if self.after_id: - self.after_cancel(self.after_id) - self.after_id = self.after(int(seconds*1000), self._sleepEvent) - self.sleep_var.set(1) - self.update() - self.wait_variable(self.sleep_var) - if self.after_id: - self.after_cancel(self.after_id) - self.after_id = None - print 'finish sleep' - - def _sleepEvent(self, *args): - return - print '_sleepEvent', args - self.interruptSleep() - return EVENT_PROPAGATE - - def interruptSleep(self): - return - print 'interruptSleep' - self.update() - self.update_idletasks() - self.sleep_var = 1 - #self.sleep_var.set(0) - #self.after_idle(self.sleep_var.set, 0) - - # - # - # - - def update(self): - Tkinter.Tk.update(self) - - def wmDeleteWindow(self): - if self.app and self.app.menubar: - self.app.menubar.mQuit() - else: - ##self.after_idle(self.quit) - pass diff --git a/pysollib/tile/tkwrap.py b/pysollib/ui/tktile/tkwrap.py similarity index 100% rename from pysollib/tile/tkwrap.py rename to pysollib/ui/tktile/tkwrap.py diff --git a/scripts/gen_individual_importing_tests.py b/scripts/gen_individual_importing_tests.py index 67bf53c7..eb7b7310 100644 --- a/scripts/gen_individual_importing_tests.py +++ b/scripts/gen_individual_importing_tests.py @@ -153,7 +153,6 @@ for module_name in [ 'pysollib.tile.tkstats', 'pysollib.tile.tktree', 'pysollib.tile.tkwidget', -'pysollib.tile.tkwrap', 'pysollib.tile.toolbar', 'pysollib.tile.ttk', 'pysollib.tile.wizarddialog', @@ -178,7 +177,6 @@ for module_name in [ 'pysollib.tk.tkstats', 'pysollib.tk.tktree', 'pysollib.tk.tkwidget', -'pysollib.tk.tkwrap', 'pysollib.tk.toolbar', 'pysollib.tk.wizarddialog', 'pysollib.ui.tktile.card', @@ -186,6 +184,7 @@ for module_name in [ 'pysollib.ui.tktile.tkcanvas', 'pysollib.ui.tktile.tkconst', 'pysollib.ui.tktile.tkutil', +'pysollib.ui.tktile.tkwrap', 'pysollib.util', 'pysollib.winsystems.aqua', 'pysollib.winsystems.common',