mirror of
https://github.com/shlomif/PySolFC.git
synced 2025-04-05 00:02:29 -04:00
* improved look for x11
* renamed option `separatorwidth' to `separator' (dialogs) git-svn-id: https://pysolfc.svn.sourceforge.net/svnroot/pysolfc/PySolFC/trunk@179 39dd0a4e-7c14-0410-91b3-c4f2d318f732
This commit is contained in:
parent
ad42f34172
commit
116e119c5f
31 changed files with 88 additions and 74 deletions
|
@ -1676,8 +1676,8 @@ if {![llength [info procs lassign]]} {
|
||||||
}
|
}
|
||||||
|
|
||||||
style default Slim.TButton -padding 0
|
style default Slim.TButton -padding 0
|
||||||
option add *TkFDialog*selectBackground #0a5f89
|
# option add *TkFDialog*selectBackground #0a5f89
|
||||||
option add *TkFDialog*selectForeground #ffffff
|
# option add *TkFDialog*selectForeground #ffffff
|
||||||
option add *TkFDialog*Toolbar*takeFocus 0
|
option add *TkFDialog*Toolbar*takeFocus 0
|
||||||
option add *TkFDialog*Text.background white
|
option add *TkFDialog*Text.background white
|
||||||
# option add *TkFDialog*Menu.activeBackground #0a5f89
|
# option add *TkFDialog*Menu.activeBackground #0a5f89
|
||||||
|
|
|
@ -1639,8 +1639,8 @@ if {![llength [info procs lassign]]} {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
option add *TkFDialog*selectBackground #0a5f89
|
# option add *TkFDialog*selectBackground #0a5f89
|
||||||
option add *TkFDialog*selectForeground #ffffff
|
# option add *TkFDialog*selectForeground #ffffff
|
||||||
option add *TkFDialog*Toolbar*takeFocus 0
|
option add *TkFDialog*Toolbar*takeFocus 0
|
||||||
option add *TkFDialog*Text.background white
|
option add *TkFDialog*Text.background white
|
||||||
# option add *TkFDialog*Menu.activeBackground #0a5f89
|
# option add *TkFDialog*Menu.activeBackground #0a5f89
|
||||||
|
|
|
@ -414,12 +414,11 @@ class Options:
|
||||||
val = config.getfloat(section, key)
|
val = config.getfloat(section, key)
|
||||||
else: # str
|
else: # str
|
||||||
val = config.get(section, key)
|
val = config.get(section, key)
|
||||||
if isinstance(val, str):
|
|
||||||
val = unicode(val, 'utf-8')
|
val = unicode(val, 'utf-8')
|
||||||
except ConfigParser.NoOptionError:
|
except ConfigParser.NoOptionError:
|
||||||
val = None
|
val = None
|
||||||
except:
|
except:
|
||||||
print >> sys.stderr, 'Load option error:', key
|
print_err('load option error: '+key)
|
||||||
traceback.print_exc()
|
traceback.print_exc()
|
||||||
val = None
|
val = None
|
||||||
return val
|
return val
|
||||||
|
@ -969,6 +968,7 @@ class Application:
|
||||||
raise # internal error?
|
raise # internal error?
|
||||||
traceback.print_exc()
|
traceback.print_exc()
|
||||||
self.nextgame.id = 2
|
self.nextgame.id = 2
|
||||||
|
self.freeGame()
|
||||||
continue
|
continue
|
||||||
if self.nextgame.holdgame:
|
if self.nextgame.holdgame:
|
||||||
assert self.nextgame.id <= 0
|
assert self.nextgame.id <= 0
|
||||||
|
|
|
@ -37,7 +37,6 @@
|
||||||
# imports
|
# imports
|
||||||
import time
|
import time
|
||||||
import math
|
import math
|
||||||
import md5
|
|
||||||
import traceback
|
import traceback
|
||||||
from cStringIO import StringIO
|
from cStringIO import StringIO
|
||||||
|
|
||||||
|
@ -667,7 +666,7 @@ class Game:
|
||||||
def leaveState(self, old_state):
|
def leaveState(self, old_state):
|
||||||
self.moves.state = old_state
|
self.moves.state = old_state
|
||||||
|
|
||||||
def getSnapshot(self, hex=False):
|
def getSnapshot(self):
|
||||||
# generate hash (unique string) of current move
|
# generate hash (unique string) of current move
|
||||||
sn = []
|
sn = []
|
||||||
for stack in self.allstacks:
|
for stack in self.allstacks:
|
||||||
|
@ -676,11 +675,8 @@ class Game:
|
||||||
s.append('%d%03d%d' % (card.suit, card.rank, card.face_up))
|
s.append('%d%03d%d' % (card.suit, card.rank, card.face_up))
|
||||||
sn.append(''.join(s))
|
sn.append(''.join(s))
|
||||||
sn = '-'.join(sn)
|
sn = '-'.join(sn)
|
||||||
# make more short string
|
# optimisation
|
||||||
if hex:
|
sn = hash(sn)
|
||||||
sn = md5.new(sn).hexdigest()
|
|
||||||
else:
|
|
||||||
sn = md5.new(sn).digest()
|
|
||||||
return sn
|
return sn
|
||||||
|
|
||||||
def createSnGroups(self):
|
def createSnGroups(self):
|
||||||
|
@ -1690,7 +1686,7 @@ for %d moves.
|
||||||
%s
|
%s
|
||||||
''') % (time, self.moves.index, top_msg),
|
''') % (time, self.moves.index, top_msg),
|
||||||
strings=(_("&New game"), None, _("&Cancel")),
|
strings=(_("&New game"), None, _("&Cancel")),
|
||||||
image=self.app.gimages.logos[5], separatorwidth=2)
|
image=self.app.gimages.logos[5])
|
||||||
elif status == 1:
|
elif status == 1:
|
||||||
top_msg = self.updateStats()
|
top_msg = self.updateStats()
|
||||||
time = self.getTime()
|
time = self.getTime()
|
||||||
|
@ -1706,7 +1702,7 @@ for %d moves.
|
||||||
%s
|
%s
|
||||||
''') % (time, self.moves.index, top_msg),
|
''') % (time, self.moves.index, top_msg),
|
||||||
strings=(_("&New game"), None, _("&Cancel")),
|
strings=(_("&New game"), None, _("&Cancel")),
|
||||||
image=self.app.gimages.logos[4], separatorwidth=2)
|
image=self.app.gimages.logos[4])
|
||||||
elif self.gstats.updated < 0:
|
elif self.gstats.updated < 0:
|
||||||
self.finished = True
|
self.finished = True
|
||||||
self.playSample("gamefinished", priority=1000)
|
self.playSample("gamefinished", priority=1000)
|
||||||
|
|
|
@ -76,7 +76,7 @@ For more information about this application visit''') % (t, version),
|
||||||
url=PACKAGE_URL,
|
url=PACKAGE_URL,
|
||||||
image=app.gimages.logos[2],
|
image=app.gimages.logos[2],
|
||||||
strings=strings, default=0,
|
strings=strings, default=0,
|
||||||
separatorwidth=2)
|
separator=True)
|
||||||
if d.status == 0 and d.button == 1:
|
if d.status == 0 and d.button == 1:
|
||||||
help_credits(app, sound=sound)
|
help_credits(app, sound=sound)
|
||||||
return d.status
|
return d.status
|
||||||
|
@ -103,7 +103,7 @@ Natascha
|
||||||
The Python, %s, SDL & Linux crews
|
The Python, %s, SDL & Linux crews
|
||||||
for making this program possible''') % t,
|
for making this program possible''') % t,
|
||||||
image=app.gimages.logos[3], image_side="right",
|
image=app.gimages.logos[3], image_side="right",
|
||||||
separatorwidth=2)
|
separator=True)
|
||||||
return d.status
|
return d.status
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -73,7 +73,7 @@ class MfxDialog(_MyDialog):
|
||||||
width=-1, height=-1,
|
width=-1, height=-1,
|
||||||
text='', justify='center',
|
text='', justify='center',
|
||||||
strings=("OK",), default=0,
|
strings=("OK",), default=0,
|
||||||
separatorwidth=0,
|
separator=False,
|
||||||
padx=20, pady=20,
|
padx=20, pady=20,
|
||||||
bitmap=None, bitmap_side='left',
|
bitmap=None, bitmap_side='left',
|
||||||
bitmap_padx=20, bitmap_pady=20,
|
bitmap_padx=20, bitmap_pady=20,
|
||||||
|
@ -172,8 +172,8 @@ class MfxDialog(_MyDialog):
|
||||||
image_padx=10, image_pady=20,
|
image_padx=10, image_pady=20,
|
||||||
)
|
)
|
||||||
## # default to separator if more than one button
|
## # default to separator if more than one button
|
||||||
## sw = 2 * (len(kw.strings) > 1)
|
## sw = len(kw.strings) > 1
|
||||||
## kwdefault(kw.__dict__, separatorwidth=sw)
|
## kwdefault(kw.__dict__, separator=sw)
|
||||||
return kw
|
return kw
|
||||||
|
|
||||||
def done(self, button):
|
def done(self, button):
|
||||||
|
|
|
@ -36,6 +36,7 @@ class Style(Tkinter.Misc):
|
||||||
|
|
||||||
def default(self, style, **kw):
|
def default(self, style, **kw):
|
||||||
"""Sets the default value of the specified option(s) in style"""
|
"""Sets the default value of the specified option(s) in style"""
|
||||||
|
assert TileVersion < '0.8' # removed in Tile-0.8.0
|
||||||
opts = self._options(kw)
|
opts = self._options(kw)
|
||||||
return self.tk.call(_tile_prefix+"style", "default", style, *opts)
|
return self.tk.call(_tile_prefix+"style", "default", style, *opts)
|
||||||
|
|
||||||
|
@ -496,7 +497,7 @@ class Treeview(Widget, Tkinter.Listbox):
|
||||||
if id: args = args + ('-id', id)
|
if id: args = args + ('-id', id)
|
||||||
return self.tk.call(args + self._options(kw))
|
return self.tk.call(args + self._options(kw))
|
||||||
|
|
||||||
def item(item, **kw):
|
def item(self, item, **kw):
|
||||||
"""Query or modify the options for the specified item. If no -option
|
"""Query or modify the options for the specified item. If no -option
|
||||||
is specified, returns a dictionary of option/value pairs. If a single
|
is specified, returns a dictionary of option/value pairs. If a single
|
||||||
-option is specified, returns the value of that option. Otherwise, the
|
-option is specified, returns the value of that option. Otherwise, the
|
||||||
|
|
|
@ -82,8 +82,8 @@ class EditTextDialog(MfxDialog):
|
||||||
kw = KwStruct(kw,
|
kw = KwStruct(kw,
|
||||||
strings=(_("&OK"), _("&Cancel")),
|
strings=(_("&OK"), _("&Cancel")),
|
||||||
default=-1,
|
default=-1,
|
||||||
resizable=1,
|
resizable=False,
|
||||||
separatorwidth=0,
|
separator=False,
|
||||||
)
|
)
|
||||||
return MfxDialog.initKw(self, kw)
|
return MfxDialog.initKw(self, kw)
|
||||||
|
|
||||||
|
|
|
@ -49,7 +49,7 @@ class FindCardDialog(Tkinter.Toplevel):
|
||||||
def __init__(self, parent, game, dir, size='large'):
|
def __init__(self, parent, game, dir, size='large'):
|
||||||
Tkinter.Toplevel.__init__(self)
|
Tkinter.Toplevel.__init__(self)
|
||||||
self.title(_('Find card'))
|
self.title(_('Find card'))
|
||||||
self.wm_resizable(0, 0)
|
self.wm_resizable(False, False)
|
||||||
#
|
#
|
||||||
##self.images_dir = dir
|
##self.images_dir = dir
|
||||||
if size == 'large':
|
if size == 'large':
|
||||||
|
|
|
@ -153,6 +153,6 @@ class GameInfoDialog(MfxDialog):
|
||||||
kw = KwStruct(kw,
|
kw = KwStruct(kw,
|
||||||
strings=(_("&OK"),),
|
strings=(_("&OK"),),
|
||||||
default=0,
|
default=0,
|
||||||
separatorwidth=2,
|
separator=True,
|
||||||
)
|
)
|
||||||
return MfxDialog.initKw(self, kw)
|
return MfxDialog.initKw(self, kw)
|
||||||
|
|
|
@ -56,7 +56,7 @@ class PysolProgressBar:
|
||||||
self.top = makeToplevel(parent, title=title)
|
self.top = makeToplevel(parent, title=title)
|
||||||
self.top.wm_protocol("WM_DELETE_WINDOW", self.wmDeleteWindow)
|
self.top.wm_protocol("WM_DELETE_WINDOW", self.wmDeleteWindow)
|
||||||
self.top.wm_group(parent)
|
self.top.wm_group(parent)
|
||||||
self.top.wm_resizable(0, 0)
|
self.top.wm_resizable(False, False)
|
||||||
self.top.config(cursor="watch")
|
self.top.config(cursor="watch")
|
||||||
#
|
#
|
||||||
self.frame = Tile.Frame(self.top, relief='flat', borderwidth=0)
|
self.frame = Tile.Frame(self.top, relief='flat', borderwidth=0)
|
||||||
|
|
|
@ -237,7 +237,7 @@ class SelectCardsetDialogWithPreview(MfxDialog):
|
||||||
strings = ((_("&Info..."), 10), 'sep',
|
strings = ((_("&Info..."), 10), 'sep',
|
||||||
_("&Load"), _("&Cancel"),),
|
_("&Load"), _("&Cancel"),),
|
||||||
default=0,
|
default=0,
|
||||||
resizable=1,
|
resizable=True,
|
||||||
)
|
)
|
||||||
return MfxDialog.initKw(self, kw)
|
return MfxDialog.initKw(self, kw)
|
||||||
|
|
||||||
|
@ -388,8 +388,8 @@ class CardsetInfoDialog(MfxDialog):
|
||||||
kw = KwStruct(kw,
|
kw = KwStruct(kw,
|
||||||
strings=(_("&OK"),),
|
strings=(_("&OK"),),
|
||||||
default=0,
|
default=0,
|
||||||
resizable=1,
|
resizable=True,
|
||||||
separatorwidth=2,
|
separator=True,
|
||||||
)
|
)
|
||||||
return MfxDialog.initKw(self, kw)
|
return MfxDialog.initKw(self, kw)
|
||||||
|
|
||||||
|
|
|
@ -298,8 +298,8 @@ class SelectGameDialog(MfxDialog):
|
||||||
def initKw(self, kw):
|
def initKw(self, kw):
|
||||||
kw = KwStruct(kw,
|
kw = KwStruct(kw,
|
||||||
strings=(None, None, _("&Cancel"),), default=0,
|
strings=(None, None, _("&Cancel"),), default=0,
|
||||||
separatorwidth=2,
|
resizable=True,
|
||||||
resizable=1,
|
separator=True,
|
||||||
)
|
)
|
||||||
return MfxDialog.initKw(self, kw)
|
return MfxDialog.initKw(self, kw)
|
||||||
|
|
||||||
|
|
|
@ -156,7 +156,7 @@ class SelectTileDialogWithPreview(MfxDialog):
|
||||||
strings=((_("&Solid color..."), 10),
|
strings=((_("&Solid color..."), 10),
|
||||||
'sep', _("&OK"), _("&Cancel"),),
|
'sep', _("&OK"), _("&Cancel"),),
|
||||||
default=0,
|
default=0,
|
||||||
resizable=1,
|
resizable=True,
|
||||||
font=None,
|
font=None,
|
||||||
)
|
)
|
||||||
return MfxDialog.initKw(self, kw)
|
return MfxDialog.initKw(self, kw)
|
||||||
|
|
|
@ -123,7 +123,7 @@ class StatsDialog(MfxDialog):
|
||||||
"sep", _("&OK"),
|
"sep", _("&OK"),
|
||||||
(_("&Reset..."), 500)),
|
(_("&Reset..."), 500)),
|
||||||
default=0,
|
default=0,
|
||||||
separatorwidth=0,
|
separator=False,
|
||||||
)
|
)
|
||||||
return MfxDialog.initKw(self, kw)
|
return MfxDialog.initKw(self, kw)
|
||||||
|
|
||||||
|
@ -554,7 +554,7 @@ class LogDialog(MfxDialog):
|
||||||
(_("&Save to file"), 500)),
|
(_("&Save to file"), 500)),
|
||||||
default=0,
|
default=0,
|
||||||
width=76*self.CHAR_W,
|
width=76*self.CHAR_W,
|
||||||
separatorwidth=0,
|
separator=False,
|
||||||
)
|
)
|
||||||
return MfxDialog.initKw(self, kw)
|
return MfxDialog.initKw(self, kw)
|
||||||
|
|
||||||
|
@ -732,7 +732,7 @@ class _TopDialog(MfxDialog):
|
||||||
|
|
||||||
|
|
||||||
def initKw(self, kw):
|
def initKw(self, kw):
|
||||||
kw = KwStruct(kw, strings=(_('&OK'),), default=0, separatorwidth=2)
|
kw = KwStruct(kw, strings=(_('&OK'),), default=0, separator=True)
|
||||||
return MfxDialog.initKw(self, kw)
|
return MfxDialog.initKw(self, kw)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -69,7 +69,7 @@ class MfxDialog: # ex. _ToplevelDialog
|
||||||
img = {}
|
img = {}
|
||||||
button_img = {}
|
button_img = {}
|
||||||
|
|
||||||
def __init__(self, parent, title="", resizable=0, default=-1):
|
def __init__(self, parent, title="", resizable=False, default=-1):
|
||||||
self.parent = parent
|
self.parent = parent
|
||||||
self.status = 0
|
self.status = 0
|
||||||
self.button = default
|
self.button = default
|
||||||
|
@ -150,7 +150,7 @@ class MfxDialog: # ex. _ToplevelDialog
|
||||||
|
|
||||||
def initKw(self, kw):
|
def initKw(self, kw):
|
||||||
kw = KwStruct(kw,
|
kw = KwStruct(kw,
|
||||||
timeout=0, resizable=0,
|
timeout=0, resizable=False,
|
||||||
text="", justify="center",
|
text="", justify="center",
|
||||||
strings=(_("&OK"),),
|
strings=(_("&OK"),),
|
||||||
default=0,
|
default=0,
|
||||||
|
@ -162,14 +162,14 @@ class MfxDialog: # ex. _ToplevelDialog
|
||||||
image_padx=10, image_pady=20,
|
image_padx=10, image_pady=20,
|
||||||
)
|
)
|
||||||
# default to separator if more than one button
|
# default to separator if more than one button
|
||||||
sw = 2 * (len(kw.strings) > 1)
|
sep = len(kw.strings) > 1
|
||||||
kwdefault(kw.__dict__, separatorwidth=sw)
|
kwdefault(kw.__dict__, separator=sep)
|
||||||
return kw
|
return kw
|
||||||
|
|
||||||
def createFrames(self, kw):
|
def createFrames(self, kw):
|
||||||
bottom_frame = Tile.Frame(self._frame, relief='flat', borderwidth=4)
|
bottom_frame = Tile.Frame(self._frame, relief='flat', borderwidth=4)
|
||||||
bottom_frame.pack(side='bottom', fill='both', expand=False)
|
bottom_frame.pack(side='bottom', fill='both', expand=False)
|
||||||
if kw.separatorwidth > 0:
|
if kw.separator:
|
||||||
separator = Tile.Separator(self._frame)
|
separator = Tile.Separator(self._frame)
|
||||||
separator.pack(side='bottom', fill='x')
|
separator.pack(side='bottom', fill='x')
|
||||||
top_frame = Tile.Frame(self._frame)
|
top_frame = Tile.Frame(self._frame)
|
||||||
|
@ -361,7 +361,7 @@ class MfxSimpleEntry(MfxDialog):
|
||||||
def initKw(self, kw):
|
def initKw(self, kw):
|
||||||
kw = KwStruct(kw,
|
kw = KwStruct(kw,
|
||||||
strings=(_("&OK"), _("&Cancel")), default=0,
|
strings=(_("&OK"), _("&Cancel")), default=0,
|
||||||
separatorwidth = 0,
|
separator=False,
|
||||||
)
|
)
|
||||||
return MfxDialog.initKw(self, kw)
|
return MfxDialog.initKw(self, kw)
|
||||||
|
|
||||||
|
|
|
@ -147,6 +147,7 @@ class WizardDialog(MfxDialog):
|
||||||
kw = KwStruct(kw,
|
kw = KwStruct(kw,
|
||||||
strings=(_('&OK'), _('&Cancel')),
|
strings=(_('&OK'), _('&Cancel')),
|
||||||
default=0,
|
default=0,
|
||||||
|
separator=False,
|
||||||
)
|
)
|
||||||
return MfxDialog.initKw(self, kw)
|
return MfxDialog.initKw(self, kw)
|
||||||
|
|
||||||
|
|
|
@ -81,8 +81,8 @@ class EditTextDialog(MfxDialog):
|
||||||
kw = KwStruct(kw,
|
kw = KwStruct(kw,
|
||||||
strings=(_("&OK"), _("&Cancel")),
|
strings=(_("&OK"), _("&Cancel")),
|
||||||
default=-1,
|
default=-1,
|
||||||
resizable=1,
|
resizable=True,
|
||||||
separatorwidth=0,
|
separator=False,
|
||||||
)
|
)
|
||||||
return MfxDialog.initKw(self, kw)
|
return MfxDialog.initKw(self, kw)
|
||||||
|
|
||||||
|
|
|
@ -52,7 +52,7 @@ class FindCardDialog(Tkinter.Toplevel):
|
||||||
def __init__(self, parent, game, dir, size='large'):
|
def __init__(self, parent, game, dir, size='large'):
|
||||||
Tkinter.Toplevel.__init__(self)
|
Tkinter.Toplevel.__init__(self)
|
||||||
self.title(_('Find card'))
|
self.title(_('Find card'))
|
||||||
self.wm_resizable(0, 0)
|
self.wm_resizable(False, False)
|
||||||
#
|
#
|
||||||
##self.images_dir = dir
|
##self.images_dir = dir
|
||||||
if size == 'large':
|
if size == 'large':
|
||||||
|
|
|
@ -153,6 +153,6 @@ class GameInfoDialog(MfxDialog):
|
||||||
kw = KwStruct(kw,
|
kw = KwStruct(kw,
|
||||||
strings=(_("&OK"),),
|
strings=(_("&OK"),),
|
||||||
default=0,
|
default=0,
|
||||||
separatorwidth=2,
|
separator=True,
|
||||||
)
|
)
|
||||||
return MfxDialog.initKw(self, kw)
|
return MfxDialog.initKw(self, kw)
|
||||||
|
|
|
@ -82,8 +82,8 @@ class SelectUserNameDialog(MfxDialog):
|
||||||
def initKw(self, kw):
|
def initKw(self, kw):
|
||||||
kw = KwStruct(kw,
|
kw = KwStruct(kw,
|
||||||
strings=(_("&OK"), _("&Cancel")), default=0,
|
strings=(_("&OK"), _("&Cancel")), default=0,
|
||||||
separatorwidth=0,
|
separator=False,
|
||||||
resizable=0,
|
resizable=False,
|
||||||
padx=10, pady=10,
|
padx=10, pady=10,
|
||||||
buttonpadx=10, buttonpady=5,
|
buttonpadx=10, buttonpady=5,
|
||||||
)
|
)
|
||||||
|
|
|
@ -55,7 +55,7 @@ class PysolProgressBar:
|
||||||
self.top = makeToplevel(parent, title=title)
|
self.top = makeToplevel(parent, title=title)
|
||||||
self.top.wm_protocol("WM_DELETE_WINDOW", self.wmDeleteWindow)
|
self.top.wm_protocol("WM_DELETE_WINDOW", self.wmDeleteWindow)
|
||||||
self.top.wm_group(parent)
|
self.top.wm_group(parent)
|
||||||
self.top.wm_resizable(0, 0)
|
self.top.wm_resizable(False, False)
|
||||||
self.frame = Tkinter.Frame(self.top, relief='flat', bd=0,
|
self.frame = Tkinter.Frame(self.top, relief='flat', bd=0,
|
||||||
takefocus=0)
|
takefocus=0)
|
||||||
self.cframe = Tkinter.Frame(self.frame, relief='sunken', bd=1,
|
self.cframe = Tkinter.Frame(self.frame, relief='sunken', bd=1,
|
||||||
|
|
|
@ -236,7 +236,7 @@ class SelectCardsetDialogWithPreview(MfxDialog):
|
||||||
kw = KwStruct(kw,
|
kw = KwStruct(kw,
|
||||||
strings=(_("&OK"), _("&Load"), _("&Cancel"),),
|
strings=(_("&OK"), _("&Load"), _("&Cancel"),),
|
||||||
default=0,
|
default=0,
|
||||||
resizable=1,
|
resizable=True,
|
||||||
padx=10, pady=10,
|
padx=10, pady=10,
|
||||||
buttonpadx=10, buttonpady=5,
|
buttonpadx=10, buttonpady=5,
|
||||||
)
|
)
|
||||||
|
@ -388,8 +388,8 @@ class CardsetInfoDialog(MfxDialog):
|
||||||
kw = KwStruct(kw,
|
kw = KwStruct(kw,
|
||||||
strings=(_("&OK"),),
|
strings=(_("&OK"),),
|
||||||
default=0,
|
default=0,
|
||||||
resizable=1,
|
resizable=True,
|
||||||
separatorwidth=2,
|
separator=True,
|
||||||
padx=10, pady=10,
|
padx=10, pady=10,
|
||||||
buttonpadx=10, buttonpady=5,
|
buttonpadx=10, buttonpady=5,
|
||||||
)
|
)
|
||||||
|
|
|
@ -300,8 +300,8 @@ class SelectGameDialog(MfxDialog):
|
||||||
def initKw(self, kw):
|
def initKw(self, kw):
|
||||||
kw = KwStruct(kw,
|
kw = KwStruct(kw,
|
||||||
strings=(None, None, _("&Cancel"),), default=0,
|
strings=(None, None, _("&Cancel"),), default=0,
|
||||||
separatorwidth=2,
|
separator=True,
|
||||||
resizable=1,
|
resizable=True,
|
||||||
padx=10, pady=10,
|
padx=10, pady=10,
|
||||||
buttonpadx=10, buttonpady=5,
|
buttonpadx=10, buttonpady=5,
|
||||||
)
|
)
|
||||||
|
|
|
@ -155,7 +155,7 @@ class SelectTileDialogWithPreview(MfxDialog):
|
||||||
kw = KwStruct(kw,
|
kw = KwStruct(kw,
|
||||||
strings=(_("&OK"), _("&Solid color..."), _("&Cancel"),),
|
strings=(_("&OK"), _("&Solid color..."), _("&Cancel"),),
|
||||||
default=0,
|
default=0,
|
||||||
resizable=1,
|
resizable=True,
|
||||||
font=None,
|
font=None,
|
||||||
padx=10, pady=10,
|
padx=10, pady=10,
|
||||||
buttonpadx=10, buttonpady=5,
|
buttonpadx=10, buttonpady=5,
|
||||||
|
|
|
@ -167,7 +167,6 @@ class SoundOptionsDialog(MfxDialog):
|
||||||
kw = KwStruct(kw,
|
kw = KwStruct(kw,
|
||||||
strings=strings,
|
strings=strings,
|
||||||
default=0,
|
default=0,
|
||||||
resizable=1,
|
|
||||||
padx=10, pady=10,
|
padx=10, pady=10,
|
||||||
buttonpadx=10, buttonpady=5,
|
buttonpadx=10, buttonpady=5,
|
||||||
)
|
)
|
||||||
|
|
|
@ -512,7 +512,7 @@ class AllGames_StatsDialog(MfxDialog):
|
||||||
(_("&Save to file"), 202),
|
(_("&Save to file"), 202),
|
||||||
(_("&Reset all..."), 301),),
|
(_("&Reset all..."), 301),),
|
||||||
default=0,
|
default=0,
|
||||||
resizable=1,
|
resizable=True,
|
||||||
padx=10, pady=10,
|
padx=10, pady=10,
|
||||||
#width=900,
|
#width=900,
|
||||||
)
|
)
|
||||||
|
@ -704,7 +704,7 @@ class _TopDialog(MfxDialog):
|
||||||
|
|
||||||
|
|
||||||
def initKw(self, kw):
|
def initKw(self, kw):
|
||||||
kw = KwStruct(kw, strings=(_('&OK'),), default=0, separatorwidth=2)
|
kw = KwStruct(kw, strings=(_('&OK'),), default=0, separator=True)
|
||||||
return MfxDialog.initKw(self, kw)
|
return MfxDialog.initKw(self, kw)
|
||||||
|
|
||||||
|
|
||||||
|
@ -791,7 +791,7 @@ class Top_StatsDialog(MfxDialog):
|
||||||
strings=(_('&OK'),),
|
strings=(_('&OK'),),
|
||||||
default=0,
|
default=0,
|
||||||
image=self.app.gimages.logos[4],
|
image=self.app.gimages.logos[4],
|
||||||
separatorwidth=2,
|
separator=True,
|
||||||
)
|
)
|
||||||
return MfxDialog.initKw(self, kw)
|
return MfxDialog.initKw(self, kw)
|
||||||
|
|
||||||
|
@ -956,7 +956,7 @@ class ProgressionDialog(MfxDialog):
|
||||||
|
|
||||||
|
|
||||||
def initKw(self, kw):
|
def initKw(self, kw):
|
||||||
kw = KwStruct(kw, strings=(_('&OK'),), default=0, separatorwidth=2)
|
kw = KwStruct(kw, strings=(_('&OK'),), default=0, separator=True)
|
||||||
return MfxDialog.initKw(self, kw)
|
return MfxDialog.initKw(self, kw)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -67,7 +67,7 @@ from tkcanvas import MfxCanvas
|
||||||
class MfxDialog: # ex. _ToplevelDialog
|
class MfxDialog: # ex. _ToplevelDialog
|
||||||
img = {}
|
img = {}
|
||||||
button_img = {}
|
button_img = {}
|
||||||
def __init__(self, parent, title="", resizable=0, default=-1):
|
def __init__(self, parent, title="", resizable=False, default=-1):
|
||||||
self.parent = parent
|
self.parent = parent
|
||||||
self.status = 0
|
self.status = 0
|
||||||
self.button = default
|
self.button = default
|
||||||
|
@ -156,7 +156,7 @@ class MfxDialog: # ex. _ToplevelDialog
|
||||||
|
|
||||||
def initKw(self, kw):
|
def initKw(self, kw):
|
||||||
kw = KwStruct(kw,
|
kw = KwStruct(kw,
|
||||||
timeout=0, resizable=0,
|
timeout=0, resizable=False,
|
||||||
text="", justify="center",
|
text="", justify="center",
|
||||||
strings=(_("&OK"),),
|
strings=(_("&OK"),),
|
||||||
default=0,
|
default=0,
|
||||||
|
@ -168,18 +168,17 @@ class MfxDialog: # ex. _ToplevelDialog
|
||||||
image_padx=10, image_pady=20,
|
image_padx=10, image_pady=20,
|
||||||
)
|
)
|
||||||
# default to separator if more than one button
|
# default to separator if more than one button
|
||||||
sw = 2 * (len(kw.strings) > 1)
|
sep = len(kw.strings) > 1
|
||||||
kwdefault(kw.__dict__, separatorwidth=sw)
|
kwdefault(kw.__dict__, separator=sep)
|
||||||
return kw
|
return kw
|
||||||
|
|
||||||
def createFrames(self, kw):
|
def createFrames(self, kw):
|
||||||
bottom_frame = Tkinter.Frame(self.top)
|
bottom_frame = Tkinter.Frame(self.top)
|
||||||
bottom_frame.pack(side='bottom', fill='both', expand=False,
|
bottom_frame.pack(side='bottom', fill='both', expand=False,
|
||||||
ipadx=3, ipady=3)
|
ipadx=3, ipady=3)
|
||||||
if kw.separatorwidth > 0:
|
if kw.separator:
|
||||||
separator = Tkinter.Frame(self.top, relief="sunken",
|
separator = Tkinter.Frame(self.top, relief="sunken",
|
||||||
height=kw.separatorwidth, width=kw.separatorwidth,
|
height=2, width=2, borderwidth=1)
|
||||||
borderwidth=kw.separatorwidth / 2)
|
|
||||||
separator.pack(side='bottom', fill='x')
|
separator.pack(side='bottom', fill='x')
|
||||||
top_frame = Tkinter.Frame(self.top)
|
top_frame = Tkinter.Frame(self.top)
|
||||||
top_frame.pack(side='top', fill='both', expand=True)
|
top_frame.pack(side='top', fill='both', expand=True)
|
||||||
|
@ -358,7 +357,7 @@ class MfxSimpleEntry(MfxDialog):
|
||||||
def initKw(self, kw):
|
def initKw(self, kw):
|
||||||
kw = KwStruct(kw,
|
kw = KwStruct(kw,
|
||||||
strings=(_("&OK"), _("&Cancel")), default=0,
|
strings=(_("&OK"), _("&Cancel")), default=0,
|
||||||
separatorwidth = 0,
|
separator=False,
|
||||||
)
|
)
|
||||||
return MfxDialog.initKw(self, kw)
|
return MfxDialog.initKw(self, kw)
|
||||||
|
|
||||||
|
|
|
@ -137,6 +137,7 @@ class WizardDialog(MfxDialog):
|
||||||
kw = KwStruct(kw,
|
kw = KwStruct(kw,
|
||||||
strings=(_('&OK'), _('&Cancel')),
|
strings=(_('&OK'), _('&Cancel')),
|
||||||
default=0,
|
default=0,
|
||||||
|
separator=False,
|
||||||
)
|
)
|
||||||
return MfxDialog.initKw(self, kw)
|
return MfxDialog.initKw(self, kw)
|
||||||
|
|
||||||
|
|
|
@ -90,8 +90,21 @@ def init_root_window(root, app):
|
||||||
|
|
||||||
root.option_add('*Listbox.background', 'white', 60)
|
root.option_add('*Listbox.background', 'white', 60)
|
||||||
root.option_add('*Listbox.foreground', 'black', 60)
|
root.option_add('*Listbox.foreground', 'black', 60)
|
||||||
root.option_add('*Listbox*selectBackground', '#0a5f89', 60)
|
root.option_add('*Text.background', 'white', 60)
|
||||||
root.option_add('*Listbox*selectForeground', 'white', 60)
|
root.option_add('*Text.foreground', 'black', 60)
|
||||||
|
root.option_add('*selectForeground', 'white', 60)
|
||||||
|
root.option_add('*selectBackground', '#0a5f89', 60)
|
||||||
|
root.option_add('*inactiveSelectBackground', '#0a5f89', 60) # Tk-8.5
|
||||||
|
|
||||||
|
color = style.lookup('TEntry', 'selectbackground', 'focus')
|
||||||
|
if color:
|
||||||
|
root.option_add('*selectBackground', color, 60)
|
||||||
|
root.option_add('*inactiveSelectBackground', color, 60)
|
||||||
|
color = style.lookup('TEntry', 'selectforeground', 'focus')
|
||||||
|
if color:
|
||||||
|
root.option_add('*selectForeground', color, 60)
|
||||||
|
|
||||||
|
root.option_add('*selectBorderWidth', 0, 60)
|
||||||
|
|
||||||
font = root.option_get('font', PACKAGE)
|
font = root.option_get('font', PACKAGE)
|
||||||
if font:
|
if font:
|
||||||
|
@ -113,7 +126,7 @@ def init_root_window(root, app):
|
||||||
root.option_add('*font', font)
|
root.option_add('*font', font)
|
||||||
app.opt.fonts['default'] = fn
|
app.opt.fonts['default'] = fn
|
||||||
if app.opt.tile_theme in ('clam', 'clearlooks'):
|
if app.opt.tile_theme in ('clam', 'clearlooks'):
|
||||||
root.wm_minsize(550, 360)
|
##root.wm_minsize(550, 360)
|
||||||
style.configure('TLabelframe', labeloutside=False,
|
style.configure('TLabelframe', labeloutside=False,
|
||||||
labelmargins=(8, 0, 8, 0))
|
labelmargins=(8, 0, 8, 0))
|
||||||
|
|
||||||
|
@ -123,8 +136,12 @@ def init_root_window(root, app):
|
||||||
root.option_add('*Entry.foreground', 'black', 60)
|
root.option_add('*Entry.foreground', 'black', 60)
|
||||||
root.option_add('*Listbox.background', 'white', 60)
|
root.option_add('*Listbox.background', 'white', 60)
|
||||||
root.option_add('*Listbox.foreground', 'black', 60)
|
root.option_add('*Listbox.foreground', 'black', 60)
|
||||||
root.option_add('*Listbox*selectBackground', '#0a5f89', 60)
|
root.option_add('*Text.background', 'white', 60)
|
||||||
root.option_add('*Listbox*selectForeground', 'white', 60)
|
root.option_add('*Text.foreground', 'black', 60)
|
||||||
|
root.option_add('*selectForeground', 'white', 60)
|
||||||
|
root.option_add('*selectBackground', '#0a5f89', 60)
|
||||||
|
root.option_add('*inactiveSelectBackground', '#0a5f89', 60) # Tk-8.5
|
||||||
|
root.option_add('*selectBorderWidth', 0, 60)
|
||||||
##root.option_add('*borderWidth', '1', 50)
|
##root.option_add('*borderWidth', '1', 50)
|
||||||
##root.option_add('*Button.borderWidth', '1', 50)
|
##root.option_add('*Button.borderWidth', '1', 50)
|
||||||
root.option_add('*Scrollbar.elementBorderWidth', 1, 60)
|
root.option_add('*Scrollbar.elementBorderWidth', 1, 60)
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
##
|
##
|
||||||
##---------------------------------------------------------------------------##
|
##---------------------------------------------------------------------------##
|
||||||
|
|
||||||
import sys, os
|
import os
|
||||||
|
|
||||||
from gamedb import GI, loadGame
|
from gamedb import GI, loadGame
|
||||||
from util import *
|
from util import *
|
||||||
|
|
Loading…
Add table
Reference in a new issue