mirror of
https://github.com/shlomif/PySolFC.git
synced 2025-04-05 00:02:29 -04:00
* pysollib/tk: removed unused imports
* minor bugfixes git-svn-id: https://pysolfc.svn.sourceforge.net/svnroot/pysolfc/PySolFC/trunk@178 39dd0a4e-7c14-0410-91b3-c4f2d318f732
This commit is contained in:
parent
1fa0eff039
commit
ad42f34172
31 changed files with 108 additions and 156 deletions
2
README
2
README
|
@ -6,7 +6,7 @@ Requirements.
|
|||
-------------
|
||||
|
||||
- Python (2.3 or later)
|
||||
- Tkinter
|
||||
- Tkinter (Tcl/Tk 8.4 or later)
|
||||
|
||||
** for sound support (optional) **
|
||||
- PySol-Sound-Server: http://www.pysol.org/ (mp3, wav, tracker music)
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
There is no need to compile anything since the whole program is just
|
||||
a Python script. Just run it, and that's all.
|
||||
<p>
|
||||
PySol requires Python 2.3 and Tcl/Tk 8.3 or better. Both packages are
|
||||
PySol requires Python 2.3 and Tcl/Tk 8.4 or better. Both packages are
|
||||
freely available for Unix, Windows and Macintosh platforms.
|
||||
<p>
|
||||
PySol is free <i>Open Source</i> software distributed under the terms of the
|
||||
|
|
|
@ -351,6 +351,8 @@ class Options:
|
|||
# general
|
||||
for key, t in self.GENERAL_OPTIONS:
|
||||
val = getattr(self, key)
|
||||
if t == 'str' and isinstance(val, unicode):
|
||||
val = val.encode('utf-8')
|
||||
config.set('general', key, val)
|
||||
|
||||
recent_gameid = ' '.join([str(i) for i in self.recent_gameid])
|
||||
|
@ -410,8 +412,10 @@ class Options:
|
|||
val = config.getint(section, key)
|
||||
elif t == 'float':
|
||||
val = config.getfloat(section, key)
|
||||
else:
|
||||
else: # str
|
||||
val = config.get(section, key)
|
||||
if isinstance(val, str):
|
||||
val = unicode(val, 'utf-8')
|
||||
except ConfigParser.NoOptionError:
|
||||
val = None
|
||||
except:
|
||||
|
|
|
@ -110,8 +110,12 @@ def init():
|
|||
sys.argv.remove('--tile')
|
||||
if settings.TOOLKIT == 'tk':
|
||||
import Tkinter
|
||||
root = Tkinter.Tk(className='PySol')
|
||||
root = Tkinter.Tk(className=settings.PACKAGE)
|
||||
root.withdraw()
|
||||
if Tkinter.TkVersion < 8.4:
|
||||
# we need unicode support
|
||||
sys.exit("%s needs Tcl/Tk 8.4 or better (you have %s)" %
|
||||
(settings.PACKAGE, str(Tkinter.TkVersion)))
|
||||
settings.WIN_SYSTEM = root.tk.call('tk', 'windowingsystem')
|
||||
if settings.WIN_SYSTEM == 'aqua':
|
||||
# TkAqua displays the console automatically in application
|
||||
|
@ -123,7 +127,7 @@ def init():
|
|||
# check Tile
|
||||
settings.USE_TILE = False
|
||||
try:
|
||||
root.tk.call('package', 'require', 'tile', '0.7.8')
|
||||
root.tk.eval('package require tile 0.7.8')
|
||||
except Tkinter.TclError:
|
||||
pass
|
||||
else:
|
||||
|
|
|
@ -77,6 +77,9 @@ class BasicStatusbar:
|
|||
label.pop(0)
|
||||
label.push(0, unicode(v))
|
||||
|
||||
def config(self, name, show):
|
||||
# FIXME
|
||||
pass
|
||||
|
||||
def configLabel(self, name, **kw):
|
||||
label = getattr(self, name + "_label")
|
||||
|
|
|
@ -22,15 +22,13 @@
|
|||
__all__ = ['ColorsDialog']
|
||||
|
||||
# imports
|
||||
import os, sys
|
||||
import Tkinter
|
||||
from tkColorChooser import askcolor
|
||||
|
||||
# PySol imports
|
||||
from pysollib.mfxutil import destruct, kwdefault, KwStruct, Struct
|
||||
from pysollib.mfxutil import KwStruct
|
||||
|
||||
# Toolkit imports
|
||||
from tkconst import EVENT_HANDLED, EVENT_PROPAGATE
|
||||
from tkwidget import MfxDialog
|
||||
|
||||
# /***********************************************************************
|
||||
|
|
|
@ -36,10 +36,10 @@
|
|||
__all__ = ['EditTextDialog']
|
||||
|
||||
# imports
|
||||
import os, sys, Tkinter
|
||||
import Tkinter
|
||||
|
||||
# PySol imports
|
||||
from pysollib.mfxutil import destruct, kwdefault, KwStruct, Struct
|
||||
from pysollib.mfxutil import KwStruct
|
||||
|
||||
# Toolkit imports
|
||||
from tkwidget import MfxDialog
|
||||
|
|
|
@ -27,7 +27,7 @@ __all__ = ['create_find_card_dialog',
|
|||
# imports
|
||||
import os
|
||||
import Tkinter
|
||||
import traceback
|
||||
##import traceback
|
||||
|
||||
# PySol imports
|
||||
|
||||
|
|
|
@ -22,16 +22,13 @@
|
|||
__all__ = ['FontsDialog']
|
||||
|
||||
# imports
|
||||
import os, sys
|
||||
import types
|
||||
import Tkinter
|
||||
import tkFont
|
||||
|
||||
# PySol imports
|
||||
from pysollib.mfxutil import destruct, kwdefault, KwStruct, Struct
|
||||
from pysollib.mfxutil import KwStruct
|
||||
|
||||
# Toolkit imports
|
||||
from tkconst import EVENT_HANDLED, EVENT_PROPAGATE
|
||||
from tkwidget import MfxDialog
|
||||
from tkutil import bind
|
||||
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
__all__ = ['GameInfoDialog']
|
||||
|
||||
# imports
|
||||
import os, sys
|
||||
import Tkinter
|
||||
|
||||
# PySol imports
|
||||
|
|
|
@ -38,10 +38,11 @@ __all__ = ['PysolMenubar']
|
|||
|
||||
# imports
|
||||
import math, os, sys, re
|
||||
import traceback
|
||||
import Tkinter, tkFileDialog
|
||||
|
||||
# PySol imports
|
||||
from pysollib.mfxutil import destruct, Struct, kwdefault
|
||||
from pysollib.mfxutil import Struct, kwdefault
|
||||
from pysollib.mfxutil import Image
|
||||
from pysollib.util import CARDSET
|
||||
from pysollib.settings import PACKAGE, WIN_SYSTEM
|
||||
|
@ -55,6 +56,7 @@ from pysollib.actions import PysolMenubarActions
|
|||
# toolkit imports
|
||||
from tkconst import EVENT_HANDLED, EVENT_PROPAGATE, CURSOR_WATCH, COMPOUNDS
|
||||
from tkutil import bind, after_idle
|
||||
from tkwidget import MfxMessageDialog
|
||||
from selectgame import SelectGameDialog, SelectGameDialogWithPreview
|
||||
from soundoptionsdialog import SoundOptionsDialog
|
||||
from selectcardset import SelectCardsetDialogWithPreview
|
||||
|
@ -80,12 +82,11 @@ def createToolbarMenu(menubar, menu):
|
|||
## submenu.add_radiobutton(label=name,
|
||||
## variable=menubar.tkopt.toolbar_style,
|
||||
## value=f, command=menubar.mOptToolbarStyle)
|
||||
if Tkinter.TkVersion >= 8.4:
|
||||
submenu = MfxMenu(menu, label=n_('Compound'), tearoff=tearoff)
|
||||
for comp, label in COMPOUNDS:
|
||||
submenu.add_radiobutton(
|
||||
label=label, variable=menubar.tkopt.toolbar_compound,
|
||||
value=comp, command=menubar.mOptToolbarCompound)
|
||||
submenu = MfxMenu(menu, label=n_('Compound'), tearoff=tearoff)
|
||||
for comp, label in COMPOUNDS:
|
||||
submenu.add_radiobutton(
|
||||
label=label, variable=menubar.tkopt.toolbar_compound,
|
||||
value=comp, command=menubar.mOptToolbarCompound)
|
||||
menu.add_separator()
|
||||
menu.add_radiobutton(label=n_("Hide"),
|
||||
variable=menubar.tkopt.toolbar, value=0,
|
||||
|
|
|
@ -36,13 +36,12 @@
|
|||
__all__ = ['PlayerOptionsDialog']
|
||||
|
||||
# imports
|
||||
import os, sys, Tkinter
|
||||
import Tkinter
|
||||
|
||||
# PySol imports
|
||||
from pysollib.mfxutil import destruct, kwdefault, KwStruct, Struct
|
||||
from pysollib.mfxutil import KwStruct, Struct
|
||||
|
||||
# Toolkit imports
|
||||
from tkconst import EVENT_HANDLED, EVENT_PROPAGATE
|
||||
from tkwidget import MfxDialog
|
||||
from tkutil import bind
|
||||
|
||||
|
|
|
@ -36,10 +36,10 @@
|
|||
__all__ = ['PysolProgressBar']
|
||||
|
||||
# imports
|
||||
import os, sys, Tkinter
|
||||
import Tkinter
|
||||
|
||||
# Toolkit imports
|
||||
from tkconst import EVENT_HANDLED, EVENT_PROPAGATE
|
||||
from tkconst import EVENT_HANDLED
|
||||
from tkutil import makeToplevel, setTransient
|
||||
|
||||
|
||||
|
|
|
@ -36,10 +36,11 @@
|
|||
__all__ = ['SelectCardsetDialogWithPreview']
|
||||
|
||||
# imports
|
||||
import os, re, sys, types, Tkinter
|
||||
import os
|
||||
import Tkinter
|
||||
|
||||
# PySol imports
|
||||
from pysollib.mfxutil import destruct, Struct, KwStruct
|
||||
from pysollib.mfxutil import KwStruct
|
||||
from pysollib.util import CARDSET
|
||||
from pysollib.resource import CSI
|
||||
|
||||
|
@ -199,18 +200,13 @@ class SelectCardsetDialogWithPreview(MfxDialog):
|
|||
w1, w2 = 216, 400
|
||||
else:
|
||||
w1, w2 = 200, 300
|
||||
if Tkinter.TkVersion >= 8.4:
|
||||
paned_window = Tkinter.PanedWindow(top_frame)
|
||||
paned_window.pack(expand=True, fill='both')
|
||||
left_frame = Tkinter.Frame(paned_window)
|
||||
right_frame = Tkinter.Frame(paned_window)
|
||||
paned_window.add(left_frame)
|
||||
paned_window.add(right_frame)
|
||||
else:
|
||||
left_frame = Tkinter.Frame(top_frame)
|
||||
right_frame = Tkinter.Frame(top_frame)
|
||||
left_frame.pack(side='left', expand=False, fill='both')
|
||||
right_frame.pack(side='right', expand=True, fill='both')
|
||||
paned_window = Tkinter.PanedWindow(top_frame)
|
||||
paned_window.pack(expand=True, fill='both')
|
||||
left_frame = Tkinter.Frame(paned_window)
|
||||
right_frame = Tkinter.Frame(paned_window)
|
||||
paned_window.add(left_frame)
|
||||
paned_window.add(right_frame)
|
||||
|
||||
font = app.getFont("default")
|
||||
self.tree = self.Tree_Class(self, left_frame, key=key,
|
||||
default=kw.default,
|
||||
|
@ -315,10 +311,7 @@ class CardsetInfoDialog(MfxDialog):
|
|||
frame.pack(fill="both", expand=True, padx=5, pady=10)
|
||||
#
|
||||
#
|
||||
if Tkinter.TkVersion >= 8.4:
|
||||
info_frame = Tkinter.LabelFrame(frame, text=_('About cardset'))
|
||||
else:
|
||||
info_frame = Tkinter.Frame(frame)
|
||||
info_frame = Tkinter.LabelFrame(frame, text=_('About cardset'))
|
||||
info_frame.grid(row=0, column=0, columnspan=2, sticky='ew',
|
||||
padx=0, pady=5, ipadx=5, ipady=5)
|
||||
styles = nationalities = year = None
|
||||
|
|
|
@ -35,7 +35,8 @@
|
|||
|
||||
|
||||
# imports
|
||||
import os, re, sys, types, Tkinter
|
||||
import os
|
||||
import Tkinter
|
||||
from UserList import UserList
|
||||
|
||||
# PySol imports
|
||||
|
@ -48,7 +49,6 @@ from pysollib.resource import CSI
|
|||
# Toolkit imports
|
||||
from tkutil import unbind_destroy
|
||||
from tkwidget import MfxDialog, MfxScrolledCanvas
|
||||
from tkcanvas import MfxCanvasText
|
||||
from selecttree import SelectDialogTreeLeaf, SelectDialogTreeNode
|
||||
from selecttree import SelectDialogTreeData, SelectDialogTreeCanvas
|
||||
|
||||
|
@ -363,30 +363,20 @@ class SelectGameDialogWithPreview(SelectGameDialog):
|
|||
##padx, pady = kw.padx, kw.pady
|
||||
padx, pady = kw.padx/2, kw.pady/2
|
||||
# PanedWindow
|
||||
if Tkinter.TkVersion >= 8.4:
|
||||
paned_window = Tkinter.PanedWindow(top_frame)
|
||||
paned_window.pack(expand=True, fill='both')
|
||||
left_frame = Tkinter.Frame(paned_window)
|
||||
right_frame = Tkinter.Frame(paned_window)
|
||||
paned_window.add(left_frame)
|
||||
paned_window.add(right_frame)
|
||||
else:
|
||||
left_frame = Tkinter.Frame(top_frame)
|
||||
right_frame = Tkinter.Frame(top_frame)
|
||||
left_frame.pack(side='left', expand=True, fill='both')
|
||||
right_frame.pack(side='right', expand=True, fill='both')
|
||||
paned_window = Tkinter.PanedWindow(top_frame)
|
||||
paned_window.pack(expand=True, fill='both')
|
||||
left_frame = Tkinter.Frame(paned_window)
|
||||
right_frame = Tkinter.Frame(paned_window)
|
||||
paned_window.add(left_frame)
|
||||
paned_window.add(right_frame)
|
||||
# Tree
|
||||
font = app.getFont("default")
|
||||
self.tree = self.Tree_Class(self, left_frame, key=gameid,
|
||||
default=kw.default, font=font, width=w1)
|
||||
self.tree.frame.pack(padx=padx, pady=pady, expand=True, fill='both')
|
||||
# LabelFrame
|
||||
if Tkinter.TkVersion >= 8.4:
|
||||
info_frame = Tkinter.LabelFrame(right_frame, text=_('About game'))
|
||||
stats_frame = Tkinter.LabelFrame(right_frame, text=_('Statistics'))
|
||||
else:
|
||||
info_frame = Tkinter.Frame(right_frame, bd=2, relief='groove')
|
||||
stats_frame = Tkinter.Frame(right_frame, bd=2, relief='groove')
|
||||
info_frame = Tkinter.LabelFrame(right_frame, text=_('About game'))
|
||||
stats_frame = Tkinter.LabelFrame(right_frame, text=_('Statistics'))
|
||||
info_frame.grid(row=0, column=0, padx=padx, pady=pady,
|
||||
ipadx=padx, ipady=pady, sticky='nws')
|
||||
stats_frame.grid(row=0, column=1, padx=padx, pady=pady,
|
||||
|
|
|
@ -35,15 +35,12 @@
|
|||
|
||||
|
||||
# imports
|
||||
import os, string, sys, types
|
||||
import Tkinter, tkColorChooser
|
||||
|
||||
# PySol imports
|
||||
from pysollib.mfxutil import destruct, Struct, KwStruct
|
||||
from pysollib.resource import CSI
|
||||
from pysollib.mfxutil import KwStruct
|
||||
|
||||
# Toolkit imports
|
||||
from tkutil import loadImage
|
||||
from tkwidget import MfxDialog, MfxScrolledCanvas
|
||||
from selecttree import SelectDialogTreeLeaf, SelectDialogTreeNode
|
||||
from selecttree import SelectDialogTreeData, SelectDialogTreeCanvas
|
||||
|
|
|
@ -36,15 +36,9 @@
|
|||
__all__ = ['SelectDialogTreeData']
|
||||
|
||||
# imports
|
||||
import os, re, sys, types
|
||||
import Tkinter, tkFont
|
||||
|
||||
# PySol imports
|
||||
from pysollib.mfxutil import destruct, Struct, KwStruct, kwdefault
|
||||
import tkFont
|
||||
|
||||
# Toolkit imports
|
||||
from tkutil import makeImage
|
||||
from tkcanvas import MfxCanvas
|
||||
from tktree import MfxTreeLeaf, MfxTreeNode, MfxTreeInCanvas
|
||||
|
||||
|
||||
|
|
|
@ -28,18 +28,16 @@ __all__ = [
|
|||
]
|
||||
|
||||
# imports
|
||||
import os, sys
|
||||
import Tkinter
|
||||
import traceback
|
||||
##import traceback
|
||||
|
||||
# PySol imports
|
||||
from pysollib.mfxutil import destruct, kwdefault, KwStruct, Struct
|
||||
from pysollib.mfxutil import KwStruct
|
||||
from pysollib.settings import PACKAGE
|
||||
|
||||
# Toolkit imports
|
||||
from tkconst import EVENT_HANDLED, EVENT_PROPAGATE
|
||||
from tkconst import EVENT_HANDLED
|
||||
from tkwidget import MfxDialog
|
||||
from tkutil import bind, unbind_destroy
|
||||
|
||||
|
||||
# /***********************************************************************
|
||||
|
|
|
@ -36,17 +36,16 @@
|
|||
__all__ = ['SoundOptionsDialog']
|
||||
|
||||
# imports
|
||||
import os, sys, string
|
||||
import os
|
||||
import Tkinter
|
||||
import traceback
|
||||
|
||||
# PySol imports
|
||||
from pysollib.mfxutil import destruct, kwdefault, KwStruct, Struct
|
||||
from pysollib.mfxutil import KwStruct
|
||||
from pysollib.settings import PACKAGE
|
||||
from pysollib.pysolaudio import pysolsoundserver
|
||||
|
||||
# Toolkit imports
|
||||
from tkconst import EVENT_HANDLED, EVENT_PROPAGATE
|
||||
from tkconst import EVENT_HANDLED
|
||||
from tkwidget import MfxDialog, MfxMessageDialog
|
||||
|
||||
# /***********************************************************************
|
||||
|
@ -140,11 +139,8 @@ class SoundOptionsDialog(MfxDialog):
|
|||
# remove "Apply" button
|
||||
kw.strings[1] = None
|
||||
#
|
||||
if Tkinter.TkVersion >= 8.4:
|
||||
frame = Tkinter.LabelFrame(top_frame, text=_('Enable samles'),
|
||||
padx=5, pady=5)
|
||||
else:
|
||||
frame = Tkinter.Frame(top_frame, bd=2, relief='groove')
|
||||
frame = Tkinter.LabelFrame(top_frame, text=_('Enable samles'),
|
||||
padx=5, pady=5)
|
||||
frame.pack(expand=True, fill='both', padx=5, pady=5)
|
||||
frame.columnconfigure(0, weight=1)
|
||||
frame.columnconfigure(1, weight=1)
|
||||
|
|
|
@ -22,14 +22,12 @@
|
|||
__all__ = ['TimeoutsDialog']
|
||||
|
||||
# imports
|
||||
import os, sys
|
||||
import Tkinter
|
||||
|
||||
# PySol imports
|
||||
from pysollib.mfxutil import destruct, kwdefault, KwStruct, Struct
|
||||
from pysollib.mfxutil import KwStruct
|
||||
|
||||
# Toolkit imports
|
||||
from tkconst import EVENT_HANDLED, EVENT_PROPAGATE
|
||||
from tkwidget import MfxDialog
|
||||
|
||||
# /***********************************************************************
|
||||
|
|
|
@ -41,7 +41,6 @@ __all__ = ['MfxCanvasGroup',
|
|||
'MfxCanvas']
|
||||
|
||||
# imports
|
||||
import os, sys, types
|
||||
import Tkinter, Canvas
|
||||
|
||||
# PySol imports
|
||||
|
|
|
@ -51,7 +51,6 @@ __all__ = ['EVENT_HANDLED',
|
|||
]
|
||||
|
||||
# imports
|
||||
import sys, os
|
||||
import Tkinter
|
||||
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
__all__ = ['HTMLViewer']
|
||||
|
||||
# imports
|
||||
import os, sys, re, types
|
||||
import os, sys
|
||||
import htmllib, formatter
|
||||
import Tkinter
|
||||
|
||||
|
@ -51,7 +51,7 @@ from pysollib.mfxutil import Struct, openURL
|
|||
from pysollib.settings import PACKAGE
|
||||
|
||||
# Toolkit imports
|
||||
from tkutil import bind, unbind_destroy, loadImage
|
||||
from tkutil import bind, unbind_destroy
|
||||
from tkwidget import MfxMessageDialog
|
||||
from statusbar import HtmlStatusbar
|
||||
|
||||
|
|
|
@ -43,12 +43,12 @@ __all__ = ['SingleGame_StatsDialog',
|
|||
]
|
||||
|
||||
# imports
|
||||
import os, string, sys, types
|
||||
import os
|
||||
import time
|
||||
import Tkinter, tkFont
|
||||
|
||||
# PySol imports
|
||||
from pysollib.mfxutil import destruct, Struct, kwdefault, KwStruct
|
||||
from pysollib.mfxutil import kwdefault, KwStruct
|
||||
from pysollib.mfxutil import format_time
|
||||
##from pysollib.util import *
|
||||
from pysollib.stats import PysolStatsFormatter, ProgressionFormatter
|
||||
|
@ -415,9 +415,9 @@ class CanvasFormatter(PysolStatsFormatter):
|
|||
y += self.h
|
||||
#
|
||||
y += self.h
|
||||
total, played, won, lost, time, moves, perc = self.getStatSummary()
|
||||
total, played, won, lost, time_, moves, perc = self.getStatSummary()
|
||||
s = _("Total (%d out of %d games)") % (played, total)
|
||||
self.pstats(y, (s, won+lost, won, lost, time, moves, perc))
|
||||
self.pstats(y, (s, won+lost, won, lost, time_, moves, perc))
|
||||
|
||||
def writeLog(self, player, prev_games):
|
||||
y = 0
|
||||
|
@ -907,10 +907,7 @@ class ProgressionDialog(MfxDialog):
|
|||
justify='left', anchor='w'
|
||||
)
|
||||
b.pack(fill='x', expand=True, padx=3, pady=1)
|
||||
if Tkinter.TkVersion >= 8.4:
|
||||
label_frame = Tkinter.LabelFrame(right_frame, text=_('Statistics for'))
|
||||
else:
|
||||
label_frame = Tkinter.Frame(right_frame)
|
||||
label_frame = Tkinter.LabelFrame(right_frame, text=_('Statistics for'))
|
||||
label_frame.pack(side='top', fill='x', pady=10)
|
||||
self.variable = var = Tkinter.StringVar()
|
||||
var.set('week')
|
||||
|
@ -925,10 +922,7 @@ class ProgressionDialog(MfxDialog):
|
|||
justify='left', anchor='w'
|
||||
)
|
||||
b.pack(fill='x', expand=True, padx=3, pady=1)
|
||||
if Tkinter.TkVersion >= 8.4:
|
||||
label_frame = Tkinter.LabelFrame(right_frame, text=_('Show graphs'))
|
||||
else:
|
||||
label_frame = Tkinter.Frame(right_frame)
|
||||
label_frame = Tkinter.LabelFrame(right_frame, text=_('Show graphs'))
|
||||
label_frame.pack(side='top', fill='x')
|
||||
self.played_graph_var = Tkinter.BooleanVar()
|
||||
self.played_graph_var.set(True)
|
||||
|
|
|
@ -56,8 +56,7 @@ __all__ = ['wm_withdraw',
|
|||
]
|
||||
|
||||
# imports
|
||||
import sys, os, re
|
||||
import traceback
|
||||
import re
|
||||
import Tkinter
|
||||
from tkFont import Font
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ __all__ = ['MfxDialog',
|
|||
]
|
||||
|
||||
# imports
|
||||
import os, sys, time, types
|
||||
import time
|
||||
import Tkinter
|
||||
import tkFont
|
||||
import traceback
|
||||
|
@ -54,8 +54,7 @@ from pysollib.mfxutil import destruct, kwdefault, KwStruct, openURL
|
|||
from pysollib.settings import WIN_SYSTEM
|
||||
|
||||
# Toolkit imports
|
||||
from tkconst import EVENT_HANDLED, EVENT_PROPAGATE
|
||||
from tkutil import after, after_idle, after_cancel
|
||||
from tkutil import after, after_cancel
|
||||
from tkutil import bind, unbind_destroy
|
||||
from tkutil import makeToplevel, setTransient
|
||||
from tkcanvas import MfxCanvas
|
||||
|
|
|
@ -37,17 +37,11 @@ __all__ = ['TclError',
|
|||
'MfxRoot']
|
||||
|
||||
# imports
|
||||
import os, sys, time, types
|
||||
import Tkinter
|
||||
from Tkinter import TclError
|
||||
from tkFont import Font
|
||||
TclError = Tkinter.TclError
|
||||
|
||||
# PySol imports
|
||||
from pysollib.mfxutil import destruct, Struct
|
||||
from pysollib.settings import PACKAGE, VERSION, WIN_SYSTEM
|
||||
from pysollib.macosx.appSupport import setupApp
|
||||
from tkutil import after_idle
|
||||
from tkconst import EVENT_HANDLED, EVENT_PROPAGATE
|
||||
from tkconst import EVENT_PROPAGATE
|
||||
|
||||
|
||||
# /***********************************************************************
|
||||
|
|
|
@ -36,8 +36,8 @@
|
|||
__all__ = ['PysolToolbar']
|
||||
|
||||
# imports
|
||||
import os, sys, types, Tkinter
|
||||
import traceback
|
||||
import os
|
||||
import Tkinter
|
||||
|
||||
# PySol imports
|
||||
from pysollib.mfxutil import destruct
|
||||
|
@ -48,7 +48,7 @@ from pysollib.actions import PysolToolbarActions
|
|||
from pysollib.winsystems import TkSettings
|
||||
|
||||
# Toolkit imports
|
||||
from tkconst import EVENT_HANDLED, EVENT_PROPAGATE
|
||||
from tkconst import EVENT_HANDLED
|
||||
from tkwidget import MfxTooltip
|
||||
from menubar import createToolbarMenu, MfxMenu
|
||||
|
||||
|
@ -321,14 +321,12 @@ class PysolToolbar(PysolToolbarActions):
|
|||
'relief' : button_relief,
|
||||
'padx' : padx,
|
||||
'pady' : pady,
|
||||
'overrelief' : 'raised',
|
||||
}
|
||||
if Tkinter.TkVersion >= 8.4:
|
||||
kw['overrelief'] = 'raised'
|
||||
if image:
|
||||
kw['image'] = image
|
||||
if check:
|
||||
if Tkinter.TkVersion >= 8.4:
|
||||
kw['offrelief'] = button_relief
|
||||
kw['offrelief'] = button_relief
|
||||
kw['indicatoron'] = False
|
||||
kw['selectcolor'] = ''
|
||||
button = ToolbarCheckbutton(self.frame, **kw)
|
||||
|
@ -466,8 +464,6 @@ class PysolToolbar(PysolToolbarActions):
|
|||
return 1
|
||||
|
||||
def setCompound(self, compound, force=False):
|
||||
if Tkinter.TkVersion < 8.4:
|
||||
return False
|
||||
if not force and self.compound == compound:
|
||||
return False
|
||||
for w in self._widgets:
|
||||
|
|
|
@ -23,11 +23,11 @@ __all__ = ['WizardDialog']
|
|||
|
||||
|
||||
# imports
|
||||
from Tkinter import *
|
||||
import Tkinter
|
||||
from tabpage import TabPageSet
|
||||
|
||||
# PySol imports
|
||||
from pysollib.mfxutil import destruct, kwdefault, KwStruct, Struct
|
||||
from pysollib.mfxutil import KwStruct
|
||||
from pysollib.wizardutil import WizardWidgets
|
||||
from pysollib.wizardpresets import presets
|
||||
|
||||
|
@ -46,7 +46,7 @@ class WizardDialog(MfxDialog):
|
|||
top_frame, bottom_frame = self.createFrames(kw)
|
||||
self.createBitmaps(top_frame, kw)
|
||||
|
||||
frame = Frame(top_frame)
|
||||
frame = Tkinter.Frame(top_frame)
|
||||
frame.pack(expand=True, fill='both', padx=10, pady=10)
|
||||
frame.columnconfigure(0, weight=1)
|
||||
|
||||
|
@ -56,49 +56,50 @@ class WizardDialog(MfxDialog):
|
|||
for w in WizardWidgets:
|
||||
if isinstance(w, basestring):
|
||||
p = notebook.AddPage(w)
|
||||
frame = Frame(notebook.pages[w]['page'])
|
||||
frame = Tkinter.Frame(notebook.pages[w]['page'])
|
||||
frame.pack(expand=True, fill='both', padx=2, pady=4)
|
||||
frame.columnconfigure(1, weight=1)
|
||||
row = 0
|
||||
continue
|
||||
|
||||
Label(frame, text=w.label).grid(row=row, column=0, padx=2)
|
||||
Tkinter.Label(frame, text=w.label).grid(row=row, column=0, padx=2)
|
||||
|
||||
if w.widget == 'preset':
|
||||
if w.variable is None:
|
||||
w.variable = StringVar()
|
||||
w.variable = Tkinter.StringVar()
|
||||
values = [_(v) for v in w.values]
|
||||
default = _(w.default)
|
||||
values.remove(default)
|
||||
values.sort()
|
||||
values.insert(0, default)
|
||||
callback = lambda v, w=w: self.presetSelected(v, w)
|
||||
om = OptionMenu(frame, w.variable,
|
||||
command=callback, *values)
|
||||
om = Tkinter.OptionMenu(frame, w.variable,
|
||||
command=callback, *values)
|
||||
om.grid(row=row, column=1, sticky='ew', padx=2)
|
||||
elif w.widget == 'entry':
|
||||
if w.variable is None:
|
||||
w.variable = StringVar()
|
||||
en = Entry(frame, textvariable=w.variable)
|
||||
w.variable = Tkinter.StringVar()
|
||||
en = Tkinter.Entry(frame, textvariable=w.variable)
|
||||
en.grid(row=row, column=1, sticky='ew', padx=2)
|
||||
elif w.widget == 'menu':
|
||||
if w.variable is None:
|
||||
w.variable = StringVar()
|
||||
w.variable = Tkinter.StringVar()
|
||||
values = [_(v) for v in w.values]
|
||||
om = OptionMenu(frame, w.variable, *values)
|
||||
om = Tkinter.OptionMenu(frame, w.variable, *values)
|
||||
om.grid(row=row, column=1, sticky='ew', padx=2)
|
||||
elif w.widget == 'spin':
|
||||
if w.variable is None:
|
||||
w.variable = IntVar()
|
||||
w.variable = Tkinter.IntVar()
|
||||
from_, to = w.values
|
||||
s = Scale(frame, from_=from_, to=to, resolution=1,
|
||||
orient='horizontal', length=200, variable=w.variable)
|
||||
s = Tkinter.Scale(frame, from_=from_, to=to, resolution=1,
|
||||
orient='horizontal', length=200,
|
||||
variable=w.variable)
|
||||
s.grid(row=row, column=1, sticky='ew', padx=2)
|
||||
elif w.widget == 'check':
|
||||
if w.variable is None:
|
||||
w.variable = BooleanVar()
|
||||
ch = Checkbutton(frame, variable=w.variable,
|
||||
takefocus=False, anchor='w')
|
||||
w.variable = Tkinter.BooleanVar()
|
||||
ch = Tkinter.Checkbutton(frame, variable=w.variable,
|
||||
takefocus=False, anchor='w')
|
||||
ch.grid(row=row, column=1, sticky='ew', padx=2, pady=2)
|
||||
|
||||
if w.current_value is None:
|
||||
|
|
|
@ -34,14 +34,14 @@ def init_tile(app, top):
|
|||
# load available themes
|
||||
d = os.path.join(app.dataloader.dir, 'themes')
|
||||
if os.path.isdir(d):
|
||||
top.tk.call('lappend', 'auto_path', d)
|
||||
top.tk.eval('global auto_path; lappend auto_path {%s}' % d)
|
||||
for t in os.listdir(d):
|
||||
if os.path.exists(os.path.join(d, t, 'pkgIndex.tcl')):
|
||||
try:
|
||||
if Tile.TileVersion < '0.8':
|
||||
top.tk.call('package', 'require', 'tile::theme::'+t)
|
||||
top.tk.eval('package require tile::theme::'+t)
|
||||
else:
|
||||
top.tk.call('package', 'require', 'ttk::theme::'+t)
|
||||
top.tk.eval('package require ttk::theme::'+t)
|
||||
#print 'load theme:', t
|
||||
except:
|
||||
traceback.print_exc()
|
||||
|
|
|
@ -50,7 +50,7 @@ def init_root_window(root, app):
|
|||
f = os.path.join(app.dataloader.dir, 'tcl', 'menu8.4.tcl')
|
||||
if os.path.exists(f):
|
||||
try:
|
||||
root.tk.call('source', f)
|
||||
root.tk.evalfile(f)
|
||||
except:
|
||||
traceback.print_exc()
|
||||
f = 'clrpick8.4.tcl'
|
||||
|
@ -59,7 +59,7 @@ def init_root_window(root, app):
|
|||
f = os.path.join(app.dataloader.dir, 'tcl', f)
|
||||
if os.path.exists(f):
|
||||
try:
|
||||
root.tk.call('source', f)
|
||||
root.tk.evalfile(f)
|
||||
except:
|
||||
traceback.print_exc()
|
||||
f = 'fsdialog8.4.tcl'
|
||||
|
@ -68,7 +68,7 @@ def init_root_window(root, app):
|
|||
f = os.path.join(app.dataloader.dir, 'tcl', f)
|
||||
if os.path.exists(f):
|
||||
try:
|
||||
root.tk.call('source', f)
|
||||
root.tk.evalfile(f)
|
||||
except:
|
||||
traceback.print_exc()
|
||||
else:
|
||||
|
|
Loading…
Add table
Reference in a new issue