From 6c30899fd9c96c03eea5ee24a377911e11d64cba Mon Sep 17 00:00:00 2001 From: skomoroh Date: Sat, 30 Jun 2007 21:24:04 +0000 Subject: [PATCH] * improved look for x11 * renamed option `separatorwidth' to `separator' (dialogs) git-svn-id: file:///home/shlomif/Backup/svn-dumps/PySolFC/svnsync-repos/pysolfc/PySolFC/trunk@179 efabe8c0-fbe8-4139-b769-b5e6d273206e --- data/tcl/fsdialog8.4.tcl | 4 ++-- data/tcl/fsdialog8.5.tcl | 4 ++-- pysollib/app.py | 6 +++--- pysollib/game.py | 14 +++++--------- pysollib/help.py | 4 ++-- pysollib/pysolgtk/tkwidget.py | 6 +++--- pysollib/tile/Tile.py | 3 ++- pysollib/tile/edittextdialog.py | 4 ++-- pysollib/tile/findcarddialog.py | 2 +- pysollib/tile/gameinfodialog.py | 2 +- pysollib/tile/progressbar.py | 2 +- pysollib/tile/selectcardset.py | 6 +++--- pysollib/tile/selectgame.py | 4 ++-- pysollib/tile/selecttile.py | 2 +- pysollib/tile/tkstats.py | 6 +++--- pysollib/tile/tkwidget.py | 12 ++++++------ pysollib/tile/wizarddialog.py | 1 + pysollib/tk/edittextdialog.py | 4 ++-- pysollib/tk/findcarddialog.py | 2 +- pysollib/tk/gameinfodialog.py | 2 +- pysollib/tk/playeroptionsdialog.py | 4 ++-- pysollib/tk/progressbar.py | 2 +- pysollib/tk/selectcardset.py | 6 +++--- pysollib/tk/selectgame.py | 4 ++-- pysollib/tk/selecttile.py | 2 +- pysollib/tk/soundoptionsdialog.py | 1 - pysollib/tk/tkstats.py | 8 ++++---- pysollib/tk/tkwidget.py | 15 +++++++-------- pysollib/tk/wizarddialog.py | 1 + pysollib/winsystems/x11.py | 27 ++++++++++++++++++++++----- pysollib/wizardutil.py | 2 +- 31 files changed, 88 insertions(+), 74 deletions(-) diff --git a/data/tcl/fsdialog8.4.tcl b/data/tcl/fsdialog8.4.tcl index 395f136f..7b59f15e 100644 --- a/data/tcl/fsdialog8.4.tcl +++ b/data/tcl/fsdialog8.4.tcl @@ -1676,8 +1676,8 @@ if {![llength [info procs lassign]]} { } style default Slim.TButton -padding 0 -option add *TkFDialog*selectBackground #0a5f89 -option add *TkFDialog*selectForeground #ffffff +# option add *TkFDialog*selectBackground #0a5f89 +# option add *TkFDialog*selectForeground #ffffff option add *TkFDialog*Toolbar*takeFocus 0 option add *TkFDialog*Text.background white # option add *TkFDialog*Menu.activeBackground #0a5f89 diff --git a/data/tcl/fsdialog8.5.tcl b/data/tcl/fsdialog8.5.tcl index 67315019..80c5ba9a 100644 --- a/data/tcl/fsdialog8.5.tcl +++ b/data/tcl/fsdialog8.5.tcl @@ -1639,8 +1639,8 @@ if {![llength [info procs lassign]]} { } } -option add *TkFDialog*selectBackground #0a5f89 -option add *TkFDialog*selectForeground #ffffff +# option add *TkFDialog*selectBackground #0a5f89 +# option add *TkFDialog*selectForeground #ffffff option add *TkFDialog*Toolbar*takeFocus 0 option add *TkFDialog*Text.background white # option add *TkFDialog*Menu.activeBackground #0a5f89 diff --git a/pysollib/app.py b/pysollib/app.py index 8e265735..78665c2b 100644 --- a/pysollib/app.py +++ b/pysollib/app.py @@ -414,12 +414,11 @@ class Options: val = config.getfloat(section, key) else: # str val = config.get(section, key) - if isinstance(val, str): - val = unicode(val, 'utf-8') + val = unicode(val, 'utf-8') except ConfigParser.NoOptionError: val = None except: - print >> sys.stderr, 'Load option error:', key + print_err('load option error: '+key) traceback.print_exc() val = None return val @@ -969,6 +968,7 @@ class Application: raise # internal error? traceback.print_exc() self.nextgame.id = 2 + self.freeGame() continue if self.nextgame.holdgame: assert self.nextgame.id <= 0 diff --git a/pysollib/game.py b/pysollib/game.py index 10749ee1..91130a7a 100644 --- a/pysollib/game.py +++ b/pysollib/game.py @@ -37,7 +37,6 @@ # imports import time import math -import md5 import traceback from cStringIO import StringIO @@ -667,7 +666,7 @@ class Game: def leaveState(self, old_state): self.moves.state = old_state - def getSnapshot(self, hex=False): + def getSnapshot(self): # generate hash (unique string) of current move sn = [] for stack in self.allstacks: @@ -676,11 +675,8 @@ class Game: s.append('%d%03d%d' % (card.suit, card.rank, card.face_up)) sn.append(''.join(s)) sn = '-'.join(sn) - # make more short string - if hex: - sn = md5.new(sn).hexdigest() - else: - sn = md5.new(sn).digest() + # optimisation + sn = hash(sn) return sn def createSnGroups(self): @@ -1690,7 +1686,7 @@ for %d moves. %s ''') % (time, self.moves.index, top_msg), strings=(_("&New game"), None, _("&Cancel")), - image=self.app.gimages.logos[5], separatorwidth=2) + image=self.app.gimages.logos[5]) elif status == 1: top_msg = self.updateStats() time = self.getTime() @@ -1706,7 +1702,7 @@ for %d moves. %s ''') % (time, self.moves.index, top_msg), strings=(_("&New game"), None, _("&Cancel")), - image=self.app.gimages.logos[4], separatorwidth=2) + image=self.app.gimages.logos[4]) elif self.gstats.updated < 0: self.finished = True self.playSample("gamefinished", priority=1000) diff --git a/pysollib/help.py b/pysollib/help.py index a1c2e089..e3c689e8 100644 --- a/pysollib/help.py +++ b/pysollib/help.py @@ -76,7 +76,7 @@ For more information about this application visit''') % (t, version), url=PACKAGE_URL, image=app.gimages.logos[2], strings=strings, default=0, - separatorwidth=2) + separator=True) if d.status == 0 and d.button == 1: help_credits(app, sound=sound) return d.status @@ -103,7 +103,7 @@ Natascha The Python, %s, SDL & Linux crews for making this program possible''') % t, image=app.gimages.logos[3], image_side="right", - separatorwidth=2) + separator=True) return d.status diff --git a/pysollib/pysolgtk/tkwidget.py b/pysollib/pysolgtk/tkwidget.py index cf0f5552..67c8663b 100644 --- a/pysollib/pysolgtk/tkwidget.py +++ b/pysollib/pysolgtk/tkwidget.py @@ -73,7 +73,7 @@ class MfxDialog(_MyDialog): width=-1, height=-1, text='', justify='center', strings=("OK",), default=0, - separatorwidth=0, + separator=False, padx=20, pady=20, bitmap=None, bitmap_side='left', bitmap_padx=20, bitmap_pady=20, @@ -172,8 +172,8 @@ class MfxDialog(_MyDialog): image_padx=10, image_pady=20, ) ## # default to separator if more than one button -## sw = 2 * (len(kw.strings) > 1) -## kwdefault(kw.__dict__, separatorwidth=sw) +## sw = len(kw.strings) > 1 +## kwdefault(kw.__dict__, separator=sw) return kw def done(self, button): diff --git a/pysollib/tile/Tile.py b/pysollib/tile/Tile.py index d386fd8f..ba81291d 100644 --- a/pysollib/tile/Tile.py +++ b/pysollib/tile/Tile.py @@ -36,6 +36,7 @@ class Style(Tkinter.Misc): def default(self, style, **kw): """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) 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) 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 is specified, returns a dictionary of option/value pairs. If a single -option is specified, returns the value of that option. Otherwise, the diff --git a/pysollib/tile/edittextdialog.py b/pysollib/tile/edittextdialog.py index b7086f90..52212403 100644 --- a/pysollib/tile/edittextdialog.py +++ b/pysollib/tile/edittextdialog.py @@ -82,8 +82,8 @@ class EditTextDialog(MfxDialog): kw = KwStruct(kw, strings=(_("&OK"), _("&Cancel")), default=-1, - resizable=1, - separatorwidth=0, + resizable=False, + separator=False, ) return MfxDialog.initKw(self, kw) diff --git a/pysollib/tile/findcarddialog.py b/pysollib/tile/findcarddialog.py index 93afbd78..53252932 100644 --- a/pysollib/tile/findcarddialog.py +++ b/pysollib/tile/findcarddialog.py @@ -49,7 +49,7 @@ class FindCardDialog(Tkinter.Toplevel): def __init__(self, parent, game, dir, size='large'): Tkinter.Toplevel.__init__(self) self.title(_('Find card')) - self.wm_resizable(0, 0) + self.wm_resizable(False, False) # ##self.images_dir = dir if size == 'large': diff --git a/pysollib/tile/gameinfodialog.py b/pysollib/tile/gameinfodialog.py index ccb1d7a4..b0b51b76 100644 --- a/pysollib/tile/gameinfodialog.py +++ b/pysollib/tile/gameinfodialog.py @@ -153,6 +153,6 @@ class GameInfoDialog(MfxDialog): kw = KwStruct(kw, strings=(_("&OK"),), default=0, - separatorwidth=2, + separator=True, ) return MfxDialog.initKw(self, kw) diff --git a/pysollib/tile/progressbar.py b/pysollib/tile/progressbar.py index 4d4cf2de..a10262ba 100644 --- a/pysollib/tile/progressbar.py +++ b/pysollib/tile/progressbar.py @@ -56,7 +56,7 @@ class PysolProgressBar: self.top = makeToplevel(parent, title=title) self.top.wm_protocol("WM_DELETE_WINDOW", self.wmDeleteWindow) self.top.wm_group(parent) - self.top.wm_resizable(0, 0) + self.top.wm_resizable(False, False) self.top.config(cursor="watch") # self.frame = Tile.Frame(self.top, relief='flat', borderwidth=0) diff --git a/pysollib/tile/selectcardset.py b/pysollib/tile/selectcardset.py index 9009dbc3..94990a81 100644 --- a/pysollib/tile/selectcardset.py +++ b/pysollib/tile/selectcardset.py @@ -237,7 +237,7 @@ class SelectCardsetDialogWithPreview(MfxDialog): strings = ((_("&Info..."), 10), 'sep', _("&Load"), _("&Cancel"),), default=0, - resizable=1, + resizable=True, ) return MfxDialog.initKw(self, kw) @@ -388,8 +388,8 @@ class CardsetInfoDialog(MfxDialog): kw = KwStruct(kw, strings=(_("&OK"),), default=0, - resizable=1, - separatorwidth=2, + resizable=True, + separator=True, ) return MfxDialog.initKw(self, kw) diff --git a/pysollib/tile/selectgame.py b/pysollib/tile/selectgame.py index f8c42ac5..05c2f523 100644 --- a/pysollib/tile/selectgame.py +++ b/pysollib/tile/selectgame.py @@ -298,8 +298,8 @@ class SelectGameDialog(MfxDialog): def initKw(self, kw): kw = KwStruct(kw, strings=(None, None, _("&Cancel"),), default=0, - separatorwidth=2, - resizable=1, + resizable=True, + separator=True, ) return MfxDialog.initKw(self, kw) diff --git a/pysollib/tile/selecttile.py b/pysollib/tile/selecttile.py index 924883f7..af2f94c6 100644 --- a/pysollib/tile/selecttile.py +++ b/pysollib/tile/selecttile.py @@ -156,7 +156,7 @@ class SelectTileDialogWithPreview(MfxDialog): strings=((_("&Solid color..."), 10), 'sep', _("&OK"), _("&Cancel"),), default=0, - resizable=1, + resizable=True, font=None, ) return MfxDialog.initKw(self, kw) diff --git a/pysollib/tile/tkstats.py b/pysollib/tile/tkstats.py index 4db7cae2..b2e4743a 100644 --- a/pysollib/tile/tkstats.py +++ b/pysollib/tile/tkstats.py @@ -123,7 +123,7 @@ class StatsDialog(MfxDialog): "sep", _("&OK"), (_("&Reset..."), 500)), default=0, - separatorwidth=0, + separator=False, ) return MfxDialog.initKw(self, kw) @@ -554,7 +554,7 @@ class LogDialog(MfxDialog): (_("&Save to file"), 500)), default=0, width=76*self.CHAR_W, - separatorwidth=0, + separator=False, ) return MfxDialog.initKw(self, kw) @@ -732,7 +732,7 @@ class _TopDialog(MfxDialog): 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) diff --git a/pysollib/tile/tkwidget.py b/pysollib/tile/tkwidget.py index 73074d70..a5ad988b 100644 --- a/pysollib/tile/tkwidget.py +++ b/pysollib/tile/tkwidget.py @@ -69,7 +69,7 @@ class MfxDialog: # ex. _ToplevelDialog 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.status = 0 self.button = default @@ -150,7 +150,7 @@ class MfxDialog: # ex. _ToplevelDialog def initKw(self, kw): kw = KwStruct(kw, - timeout=0, resizable=0, + timeout=0, resizable=False, text="", justify="center", strings=(_("&OK"),), default=0, @@ -162,14 +162,14 @@ class MfxDialog: # ex. _ToplevelDialog image_padx=10, image_pady=20, ) # default to separator if more than one button - sw = 2 * (len(kw.strings) > 1) - kwdefault(kw.__dict__, separatorwidth=sw) + sep = len(kw.strings) > 1 + kwdefault(kw.__dict__, separator=sep) return kw def createFrames(self, kw): bottom_frame = Tile.Frame(self._frame, relief='flat', borderwidth=4) bottom_frame.pack(side='bottom', fill='both', expand=False) - if kw.separatorwidth > 0: + if kw.separator: separator = Tile.Separator(self._frame) separator.pack(side='bottom', fill='x') top_frame = Tile.Frame(self._frame) @@ -361,7 +361,7 @@ class MfxSimpleEntry(MfxDialog): def initKw(self, kw): kw = KwStruct(kw, strings=(_("&OK"), _("&Cancel")), default=0, - separatorwidth = 0, + separator=False, ) return MfxDialog.initKw(self, kw) diff --git a/pysollib/tile/wizarddialog.py b/pysollib/tile/wizarddialog.py index 3a93e070..67997407 100644 --- a/pysollib/tile/wizarddialog.py +++ b/pysollib/tile/wizarddialog.py @@ -147,6 +147,7 @@ class WizardDialog(MfxDialog): kw = KwStruct(kw, strings=(_('&OK'), _('&Cancel')), default=0, + separator=False, ) return MfxDialog.initKw(self, kw) diff --git a/pysollib/tk/edittextdialog.py b/pysollib/tk/edittextdialog.py index c8415575..2a423908 100644 --- a/pysollib/tk/edittextdialog.py +++ b/pysollib/tk/edittextdialog.py @@ -81,8 +81,8 @@ class EditTextDialog(MfxDialog): kw = KwStruct(kw, strings=(_("&OK"), _("&Cancel")), default=-1, - resizable=1, - separatorwidth=0, + resizable=True, + separator=False, ) return MfxDialog.initKw(self, kw) diff --git a/pysollib/tk/findcarddialog.py b/pysollib/tk/findcarddialog.py index 42d0b633..4cfa4b99 100644 --- a/pysollib/tk/findcarddialog.py +++ b/pysollib/tk/findcarddialog.py @@ -52,7 +52,7 @@ class FindCardDialog(Tkinter.Toplevel): def __init__(self, parent, game, dir, size='large'): Tkinter.Toplevel.__init__(self) self.title(_('Find card')) - self.wm_resizable(0, 0) + self.wm_resizable(False, False) # ##self.images_dir = dir if size == 'large': diff --git a/pysollib/tk/gameinfodialog.py b/pysollib/tk/gameinfodialog.py index 25cfabc9..a54d4f79 100644 --- a/pysollib/tk/gameinfodialog.py +++ b/pysollib/tk/gameinfodialog.py @@ -153,6 +153,6 @@ class GameInfoDialog(MfxDialog): kw = KwStruct(kw, strings=(_("&OK"),), default=0, - separatorwidth=2, + separator=True, ) return MfxDialog.initKw(self, kw) diff --git a/pysollib/tk/playeroptionsdialog.py b/pysollib/tk/playeroptionsdialog.py index f1291db8..4b5b2134 100644 --- a/pysollib/tk/playeroptionsdialog.py +++ b/pysollib/tk/playeroptionsdialog.py @@ -82,8 +82,8 @@ class SelectUserNameDialog(MfxDialog): def initKw(self, kw): kw = KwStruct(kw, strings=(_("&OK"), _("&Cancel")), default=0, - separatorwidth=0, - resizable=0, + separator=False, + resizable=False, padx=10, pady=10, buttonpadx=10, buttonpady=5, ) diff --git a/pysollib/tk/progressbar.py b/pysollib/tk/progressbar.py index 87f536ee..ef1c0c32 100644 --- a/pysollib/tk/progressbar.py +++ b/pysollib/tk/progressbar.py @@ -55,7 +55,7 @@ class PysolProgressBar: self.top = makeToplevel(parent, title=title) self.top.wm_protocol("WM_DELETE_WINDOW", self.wmDeleteWindow) 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, takefocus=0) self.cframe = Tkinter.Frame(self.frame, relief='sunken', bd=1, diff --git a/pysollib/tk/selectcardset.py b/pysollib/tk/selectcardset.py index 023b2667..81e917b6 100644 --- a/pysollib/tk/selectcardset.py +++ b/pysollib/tk/selectcardset.py @@ -236,7 +236,7 @@ class SelectCardsetDialogWithPreview(MfxDialog): kw = KwStruct(kw, strings=(_("&OK"), _("&Load"), _("&Cancel"),), default=0, - resizable=1, + resizable=True, padx=10, pady=10, buttonpadx=10, buttonpady=5, ) @@ -388,8 +388,8 @@ class CardsetInfoDialog(MfxDialog): kw = KwStruct(kw, strings=(_("&OK"),), default=0, - resizable=1, - separatorwidth=2, + resizable=True, + separator=True, padx=10, pady=10, buttonpadx=10, buttonpady=5, ) diff --git a/pysollib/tk/selectgame.py b/pysollib/tk/selectgame.py index 38cd11af..3329c34d 100644 --- a/pysollib/tk/selectgame.py +++ b/pysollib/tk/selectgame.py @@ -300,8 +300,8 @@ class SelectGameDialog(MfxDialog): def initKw(self, kw): kw = KwStruct(kw, strings=(None, None, _("&Cancel"),), default=0, - separatorwidth=2, - resizable=1, + separator=True, + resizable=True, padx=10, pady=10, buttonpadx=10, buttonpady=5, ) diff --git a/pysollib/tk/selecttile.py b/pysollib/tk/selecttile.py index 9cec3f6a..c32a59bb 100644 --- a/pysollib/tk/selecttile.py +++ b/pysollib/tk/selecttile.py @@ -155,7 +155,7 @@ class SelectTileDialogWithPreview(MfxDialog): kw = KwStruct(kw, strings=(_("&OK"), _("&Solid color..."), _("&Cancel"),), default=0, - resizable=1, + resizable=True, font=None, padx=10, pady=10, buttonpadx=10, buttonpady=5, diff --git a/pysollib/tk/soundoptionsdialog.py b/pysollib/tk/soundoptionsdialog.py index 63d84f46..a1fc0c97 100644 --- a/pysollib/tk/soundoptionsdialog.py +++ b/pysollib/tk/soundoptionsdialog.py @@ -167,7 +167,6 @@ class SoundOptionsDialog(MfxDialog): kw = KwStruct(kw, strings=strings, default=0, - resizable=1, padx=10, pady=10, buttonpadx=10, buttonpady=5, ) diff --git a/pysollib/tk/tkstats.py b/pysollib/tk/tkstats.py index 0437ce3b..59c71a25 100644 --- a/pysollib/tk/tkstats.py +++ b/pysollib/tk/tkstats.py @@ -512,7 +512,7 @@ class AllGames_StatsDialog(MfxDialog): (_("&Save to file"), 202), (_("&Reset all..."), 301),), default=0, - resizable=1, + resizable=True, padx=10, pady=10, #width=900, ) @@ -704,7 +704,7 @@ class _TopDialog(MfxDialog): 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) @@ -791,7 +791,7 @@ class Top_StatsDialog(MfxDialog): strings=(_('&OK'),), default=0, image=self.app.gimages.logos[4], - separatorwidth=2, + separator=True, ) return MfxDialog.initKw(self, kw) @@ -956,7 +956,7 @@ class ProgressionDialog(MfxDialog): 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) diff --git a/pysollib/tk/tkwidget.py b/pysollib/tk/tkwidget.py index fd066c02..2f8005e5 100644 --- a/pysollib/tk/tkwidget.py +++ b/pysollib/tk/tkwidget.py @@ -67,7 +67,7 @@ from tkcanvas import MfxCanvas class MfxDialog: # ex. _ToplevelDialog 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.status = 0 self.button = default @@ -156,7 +156,7 @@ class MfxDialog: # ex. _ToplevelDialog def initKw(self, kw): kw = KwStruct(kw, - timeout=0, resizable=0, + timeout=0, resizable=False, text="", justify="center", strings=(_("&OK"),), default=0, @@ -168,18 +168,17 @@ class MfxDialog: # ex. _ToplevelDialog image_padx=10, image_pady=20, ) # default to separator if more than one button - sw = 2 * (len(kw.strings) > 1) - kwdefault(kw.__dict__, separatorwidth=sw) + sep = len(kw.strings) > 1 + kwdefault(kw.__dict__, separator=sep) return kw def createFrames(self, kw): bottom_frame = Tkinter.Frame(self.top) bottom_frame.pack(side='bottom', fill='both', expand=False, ipadx=3, ipady=3) - if kw.separatorwidth > 0: + if kw.separator: separator = Tkinter.Frame(self.top, relief="sunken", - height=kw.separatorwidth, width=kw.separatorwidth, - borderwidth=kw.separatorwidth / 2) + height=2, width=2, borderwidth=1) separator.pack(side='bottom', fill='x') top_frame = Tkinter.Frame(self.top) top_frame.pack(side='top', fill='both', expand=True) @@ -358,7 +357,7 @@ class MfxSimpleEntry(MfxDialog): def initKw(self, kw): kw = KwStruct(kw, strings=(_("&OK"), _("&Cancel")), default=0, - separatorwidth = 0, + separator=False, ) return MfxDialog.initKw(self, kw) diff --git a/pysollib/tk/wizarddialog.py b/pysollib/tk/wizarddialog.py index 609c23a3..34c727fc 100644 --- a/pysollib/tk/wizarddialog.py +++ b/pysollib/tk/wizarddialog.py @@ -137,6 +137,7 @@ class WizardDialog(MfxDialog): kw = KwStruct(kw, strings=(_('&OK'), _('&Cancel')), default=0, + separator=False, ) return MfxDialog.initKw(self, kw) diff --git a/pysollib/winsystems/x11.py b/pysollib/winsystems/x11.py index b6152341..812a6700 100644 --- a/pysollib/winsystems/x11.py +++ b/pysollib/winsystems/x11.py @@ -90,8 +90,21 @@ def init_root_window(root, app): root.option_add('*Listbox.background', 'white', 60) root.option_add('*Listbox.foreground', 'black', 60) - root.option_add('*Listbox*selectBackground', '#0a5f89', 60) - root.option_add('*Listbox*selectForeground', 'white', 60) + root.option_add('*Text.background', '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) if font: @@ -113,7 +126,7 @@ def init_root_window(root, app): root.option_add('*font', font) app.opt.fonts['default'] = fn if app.opt.tile_theme in ('clam', 'clearlooks'): - root.wm_minsize(550, 360) + ##root.wm_minsize(550, 360) style.configure('TLabelframe', labeloutside=False, 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('*Listbox.background', 'white', 60) root.option_add('*Listbox.foreground', 'black', 60) - root.option_add('*Listbox*selectBackground', '#0a5f89', 60) - root.option_add('*Listbox*selectForeground', 'white', 60) + root.option_add('*Text.background', '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('*Button.borderWidth', '1', 50) root.option_add('*Scrollbar.elementBorderWidth', 1, 60) diff --git a/pysollib/wizardutil.py b/pysollib/wizardutil.py index 52d4b0f1..ed6b0840 100644 --- a/pysollib/wizardutil.py +++ b/pysollib/wizardutil.py @@ -19,7 +19,7 @@ ## ##---------------------------------------------------------------------------## -import sys, os +import os from gamedb import GI, loadGame from util import *