mirror of
https://github.com/shlomif/PySolFC.git
synced 2025-04-05 00:02:29 -04:00
Merge {tile,tk}/tkwrap.
This commit is contained in:
parent
5d8b82cabe
commit
9f7cc65a5f
5 changed files with 3 additions and 152 deletions
|
@ -144,7 +144,7 @@ The toolkit layer
|
||||||
tk/tkcanvas.py:
|
tk/tkcanvas.py:
|
||||||
Wrapper for canvas widgets.
|
Wrapper for canvas widgets.
|
||||||
|
|
||||||
tk/tkwrap.py:
|
pysollib/ui/tktile/tkwrap.py:
|
||||||
Wrapper for other widgets.
|
Wrapper for other widgets.
|
||||||
|
|
||||||
tk/card.py:
|
tk/card.py:
|
||||||
|
|
|
@ -28,8 +28,8 @@ if TOOLKIT == 'tk':
|
||||||
from pysollib.ui.tktile.tkutil import *
|
from pysollib.ui.tktile.tkutil import *
|
||||||
from pysollib.ui.tktile.card import *
|
from pysollib.ui.tktile.card import *
|
||||||
from pysollib.ui.tktile.tkcanvas import *
|
from pysollib.ui.tktile.tkcanvas import *
|
||||||
|
from pysollib.ui.tktile.tkwrap import *
|
||||||
if USE_TILE:
|
if USE_TILE:
|
||||||
from pysollib.tile.tkwrap import *
|
|
||||||
from pysollib.tile.tkwidget import *
|
from pysollib.tile.tkwidget import *
|
||||||
from pysollib.tile.tkhtml import *
|
from pysollib.tile.tkhtml import *
|
||||||
from pysollib.tile.edittextdialog import *
|
from pysollib.tile.edittextdialog import *
|
||||||
|
@ -49,7 +49,6 @@ if TOOLKIT == 'tk':
|
||||||
from pysollib.tile.selectcardset import *
|
from pysollib.tile.selectcardset import *
|
||||||
from pysollib.tile.selecttree import *
|
from pysollib.tile.selecttree import *
|
||||||
else:
|
else:
|
||||||
from pysollib.tk.tkwrap import *
|
|
||||||
from pysollib.tk.tkwidget import *
|
from pysollib.tk.tkwidget import *
|
||||||
from pysollib.tk.tkhtml import *
|
from pysollib.tk.tkhtml import *
|
||||||
from pysollib.tk.edittextdialog import *
|
from pysollib.tk.edittextdialog import *
|
||||||
|
|
|
@ -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 <http://www.gnu.org/licenses/>.
|
|
||||||
##
|
|
||||||
##---------------------------------------------------------------------------##
|
|
||||||
|
|
||||||
__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('<ButtonPress>', 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
|
|
|
@ -153,7 +153,6 @@ for module_name in [
|
||||||
'pysollib.tile.tkstats',
|
'pysollib.tile.tkstats',
|
||||||
'pysollib.tile.tktree',
|
'pysollib.tile.tktree',
|
||||||
'pysollib.tile.tkwidget',
|
'pysollib.tile.tkwidget',
|
||||||
'pysollib.tile.tkwrap',
|
|
||||||
'pysollib.tile.toolbar',
|
'pysollib.tile.toolbar',
|
||||||
'pysollib.tile.ttk',
|
'pysollib.tile.ttk',
|
||||||
'pysollib.tile.wizarddialog',
|
'pysollib.tile.wizarddialog',
|
||||||
|
@ -178,7 +177,6 @@ for module_name in [
|
||||||
'pysollib.tk.tkstats',
|
'pysollib.tk.tkstats',
|
||||||
'pysollib.tk.tktree',
|
'pysollib.tk.tktree',
|
||||||
'pysollib.tk.tkwidget',
|
'pysollib.tk.tkwidget',
|
||||||
'pysollib.tk.tkwrap',
|
|
||||||
'pysollib.tk.toolbar',
|
'pysollib.tk.toolbar',
|
||||||
'pysollib.tk.wizarddialog',
|
'pysollib.tk.wizarddialog',
|
||||||
'pysollib.ui.tktile.card',
|
'pysollib.ui.tktile.card',
|
||||||
|
@ -186,6 +184,7 @@ for module_name in [
|
||||||
'pysollib.ui.tktile.tkcanvas',
|
'pysollib.ui.tktile.tkcanvas',
|
||||||
'pysollib.ui.tktile.tkconst',
|
'pysollib.ui.tktile.tkconst',
|
||||||
'pysollib.ui.tktile.tkutil',
|
'pysollib.ui.tktile.tkutil',
|
||||||
|
'pysollib.ui.tktile.tkwrap',
|
||||||
'pysollib.util',
|
'pysollib.util',
|
||||||
'pysollib.winsystems.aqua',
|
'pysollib.winsystems.aqua',
|
||||||
'pysollib.winsystems.common',
|
'pysollib.winsystems.common',
|
||||||
|
|
Loading…
Add table
Reference in a new issue