mirror of
https://github.com/shlomif/PySolFC.git
synced 2025-04-05 00:02:29 -04:00
+ improved tile support
git-svn-id: https://pysolfc.svn.sourceforge.net/svnroot/pysolfc/PySolFC/trunk@78 39dd0a4e-7c14-0410-91b3-c4f2d318f732
This commit is contained in:
parent
e19828c11d
commit
7bd3fa04c4
16 changed files with 111 additions and 40 deletions
|
@ -6,7 +6,7 @@ msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: PySol 0.0.1\n"
|
"Project-Id-Version: PySol 0.0.1\n"
|
||||||
"POT-Creation-Date: Thu Sep 21 15:57:22 2006\n"
|
"POT-Creation-Date: Thu Sep 21 15:57:22 2006\n"
|
||||||
"PO-Revision-Date: 2006-09-26 15:53+0400\n"
|
"PO-Revision-Date: 2006-10-05 16:31+0400\n"
|
||||||
"Last-Translator: Скоморох <skomoroh@gmail.com>\n"
|
"Last-Translator: Скоморох <skomoroh@gmail.com>\n"
|
||||||
"Language-Team: Russian <ru@li.org>\n"
|
"Language-Team: Russian <ru@li.org>\n"
|
||||||
"MIME-Version: 1.0\n"
|
"MIME-Version: 1.0\n"
|
||||||
|
@ -3016,7 +3016,7 @@ msgstr "Выкладывание на сброс"
|
||||||
|
|
||||||
#: pysollib/tk/soundoptionsdialog.py:80
|
#: pysollib/tk/soundoptionsdialog.py:80
|
||||||
msgid "Turn waste"
|
msgid "Turn waste"
|
||||||
msgstr "Переворачивание сброса"
|
msgstr "Перелистывание сброса"
|
||||||
|
|
||||||
#: pysollib/tk/soundoptionsdialog.py:81
|
#: pysollib/tk/soundoptionsdialog.py:81
|
||||||
msgid "Start drag"
|
msgid "Start drag"
|
||||||
|
@ -3024,11 +3024,11 @@ msgstr "Начало перемещения"
|
||||||
|
|
||||||
#: pysollib/tk/soundoptionsdialog.py:83
|
#: pysollib/tk/soundoptionsdialog.py:83
|
||||||
msgid "Drop"
|
msgid "Drop"
|
||||||
msgstr "Сбрасывание карты"
|
msgstr "Сброс карты"
|
||||||
|
|
||||||
#: pysollib/tk/soundoptionsdialog.py:84
|
#: pysollib/tk/soundoptionsdialog.py:84
|
||||||
msgid "Drop pair"
|
msgid "Drop pair"
|
||||||
msgstr "Сбрасывание двух карт"
|
msgstr "Сброс двух карт"
|
||||||
|
|
||||||
#: pysollib/tk/soundoptionsdialog.py:85
|
#: pysollib/tk/soundoptionsdialog.py:85
|
||||||
msgid "Auto drop"
|
msgid "Auto drop"
|
||||||
|
|
|
@ -88,6 +88,7 @@ def parse_option(argv):
|
||||||
"fg=", "foreground=",
|
"fg=", "foreground=",
|
||||||
"bg=", "background=",
|
"bg=", "background=",
|
||||||
"fn=", "font=",
|
"fn=", "font=",
|
||||||
|
"tile-theme=",
|
||||||
"french-only",
|
"french-only",
|
||||||
"noplugins",
|
"noplugins",
|
||||||
"nosound",
|
"nosound",
|
||||||
|
@ -104,6 +105,7 @@ def parse_option(argv):
|
||||||
"fg": None,
|
"fg": None,
|
||||||
"bg": None,
|
"bg": None,
|
||||||
"fn": None,
|
"fn": None,
|
||||||
|
"tile-theme": None,
|
||||||
"french-only": False,
|
"french-only": False,
|
||||||
"noplugins": False,
|
"noplugins": False,
|
||||||
"nosound": False,
|
"nosound": False,
|
||||||
|
@ -123,6 +125,8 @@ def parse_option(argv):
|
||||||
opts["bg"] = i[1]
|
opts["bg"] = i[1]
|
||||||
elif i[0] in ("--fn", "--font"):
|
elif i[0] in ("--fn", "--font"):
|
||||||
opts["fn"] = i[1]
|
opts["fn"] = i[1]
|
||||||
|
elif i[0] == "--tile-theme":
|
||||||
|
opts["tile-theme"] = i[1]
|
||||||
elif i[0] == "--french-only":
|
elif i[0] == "--french-only":
|
||||||
opts["french-only"] = True
|
opts["french-only"] = True
|
||||||
elif i[0] == "--noplugins":
|
elif i[0] == "--noplugins":
|
||||||
|
@ -209,6 +213,9 @@ def pysol_init(app, args):
|
||||||
app.debug = int(opts['debug'])
|
app.debug = int(opts['debug'])
|
||||||
except:
|
except:
|
||||||
print >> sys.stderr, 'invalid argument for debug'
|
print >> sys.stderr, 'invalid argument for debug'
|
||||||
|
if opts['tile-theme']:
|
||||||
|
import settings
|
||||||
|
settings.TILE_THEME = opts['tile-theme']
|
||||||
|
|
||||||
# init games database
|
# init games database
|
||||||
import games
|
import games
|
||||||
|
@ -323,14 +330,6 @@ def pysol_init(app, args):
|
||||||
app.top_palette[0] = fg
|
app.top_palette[0] = fg
|
||||||
|
|
||||||
#
|
#
|
||||||
if USE_TILE: # for tile
|
|
||||||
top.option_add('*Toolbar.relief', 'groove')
|
|
||||||
top.option_add('*Toolbar.borderWidth', 2)
|
|
||||||
top.option_add('*Toolbar.Button.Pad', 2)
|
|
||||||
top.option_add('*Toolbar.Button.default', 'disabled')
|
|
||||||
top.option_add('*Toolbar*takeFocus', 1)
|
|
||||||
top.option_add('*Tree.background', 'red')
|
|
||||||
|
|
||||||
if os.name == "posix": # Unix/X11
|
if os.name == "posix": # Unix/X11
|
||||||
top.option_add('*Entry.background', 'white', 60)
|
top.option_add('*Entry.background', 'white', 60)
|
||||||
top.option_add('*Entry.foreground', 'black', 60)
|
top.option_add('*Entry.foreground', 'black', 60)
|
||||||
|
@ -370,6 +369,24 @@ def pysol_init(app, args):
|
||||||
else:
|
else:
|
||||||
app.opt.fonts["default"] = None
|
app.opt.fonts["default"] = None
|
||||||
|
|
||||||
|
if USE_TILE: # for tile
|
||||||
|
##top.option_add('*Toolbar.relief', 'groove')
|
||||||
|
##top.option_add('*Toolbar.relief', 'raised')
|
||||||
|
top.option_add('*Toolbar.borderWidth', 1)
|
||||||
|
top.option_add('*Toolbar.Button.Pad', 2)
|
||||||
|
top.option_add('*Toolbar.Button.default', 'disabled')
|
||||||
|
top.option_add('*Toolbar*takeFocus', 0)
|
||||||
|
#
|
||||||
|
from settings import TILE_THEME
|
||||||
|
if TILE_THEME:
|
||||||
|
if font:
|
||||||
|
top.tk.call('style', 'configure', '.', '-font', font)
|
||||||
|
else:
|
||||||
|
font = top.tk.call('style', 'lookup', TILE_THEME, '-font')
|
||||||
|
top.option_add('*font', font)
|
||||||
|
bg = top.tk.call('style', 'lookup', TILE_THEME, '-background')
|
||||||
|
top.tk_setPalette(bg)
|
||||||
|
|
||||||
# check games
|
# check games
|
||||||
if len(app.gdb.getGamesIdSortedByName()) == 0:
|
if len(app.gdb.getGamesIdSortedByName()) == 0:
|
||||||
app.wm_withdraw()
|
app.wm_withdraw()
|
||||||
|
|
|
@ -34,7 +34,7 @@ VERSION_TUPLE = (4, 82)
|
||||||
|
|
||||||
TOOLKIT = 'tk' # or 'gtk'
|
TOOLKIT = 'tk' # or 'gtk'
|
||||||
USE_TILE = False
|
USE_TILE = False
|
||||||
TILE_THEME = 'clam' #'default' # name of tile's theme
|
TILE_THEME = 'default' # name of tile's theme
|
||||||
|
|
||||||
# data dirs
|
# data dirs
|
||||||
DATA_DIRS = []
|
DATA_DIRS = []
|
||||||
|
|
|
@ -177,7 +177,7 @@ class Label(Widget, Tkinter.Label):
|
||||||
|
|
||||||
class Frame(Widget, Tkinter.Frame):
|
class Frame(Widget, Tkinter.Frame):
|
||||||
def __init__(self, master=None, cnf={}, **kw):
|
def __init__(self, master=None, cnf={}, **kw):
|
||||||
for opt in ('bd', 'highlightthickness',):
|
for opt in ('bd', 'highlightbackground', 'highlightthickness',):
|
||||||
if kw.has_key(opt):
|
if kw.has_key(opt):
|
||||||
del kw[opt]
|
del kw[opt]
|
||||||
Widget.__init__(self, master, "ttk::frame", cnf, kw)
|
Widget.__init__(self, master, "ttk::frame", cnf, kw)
|
||||||
|
@ -185,6 +185,9 @@ class Frame(Widget, Tkinter.Frame):
|
||||||
|
|
||||||
class LabelFrame(Widget, Tkinter.Frame):
|
class LabelFrame(Widget, Tkinter.Frame):
|
||||||
def __init__(self, master=None, cnf={}, **kw):
|
def __init__(self, master=None, cnf={}, **kw):
|
||||||
|
for opt in ('padx', 'pady',):
|
||||||
|
if kw.has_key(opt):
|
||||||
|
del kw[opt]
|
||||||
Widget.__init__(self, master, "ttk::labelframe", cnf, kw)
|
Widget.__init__(self, master, "ttk::labelframe", cnf, kw)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -34,6 +34,8 @@ from pysollib.mfxutil import destruct, kwdefault, KwStruct, Struct
|
||||||
from tkconst import EVENT_HANDLED, EVENT_PROPAGATE
|
from tkconst import EVENT_HANDLED, EVENT_PROPAGATE
|
||||||
from tkwidget import MfxDialog
|
from tkwidget import MfxDialog
|
||||||
from tkutil import bind
|
from tkutil import bind
|
||||||
|
from tkwidget import PysolScale
|
||||||
|
|
||||||
|
|
||||||
# /***********************************************************************
|
# /***********************************************************************
|
||||||
# //
|
# //
|
||||||
|
@ -73,9 +75,12 @@ class FontChooserDialog(MfxDialog):
|
||||||
|
|
||||||
#self.family_var = Tkinter.StringVar()
|
#self.family_var = Tkinter.StringVar()
|
||||||
self.weight_var = Tkinter.BooleanVar()
|
self.weight_var = Tkinter.BooleanVar()
|
||||||
|
self.weight_var.set(self.font_weight == 'bold')
|
||||||
self.slant_var = Tkinter.BooleanVar()
|
self.slant_var = Tkinter.BooleanVar()
|
||||||
|
self.slant_var.set(self.font_slant == 'italic')
|
||||||
self.size_var = Tkinter.IntVar()
|
self.size_var = Tkinter.IntVar()
|
||||||
|
self.size_var.set(self.font_size)
|
||||||
|
#
|
||||||
frame = Tkinter.Frame(top_frame)
|
frame = Tkinter.Frame(top_frame)
|
||||||
frame.pack(expand=True, fill='both', padx=5, pady=10)
|
frame.pack(expand=True, fill='both', padx=5, pady=10)
|
||||||
frame.columnconfigure(0, weight=1)
|
frame.columnconfigure(0, weight=1)
|
||||||
|
@ -100,15 +105,12 @@ class FontChooserDialog(MfxDialog):
|
||||||
variable=self.slant_var)
|
variable=self.slant_var)
|
||||||
cb2.grid(row=3, column=0, columnspan=2, sticky='we')
|
cb2.grid(row=3, column=0, columnspan=2, sticky='we')
|
||||||
|
|
||||||
sc = Tkinter.Scale(frame, from_=6, to=40, resolution=1,
|
sc = PysolScale(frame, from_=6, to=40, resolution=1,
|
||||||
#label='Size',
|
#label='Size',
|
||||||
orient='horizontal',
|
orient='horizontal',
|
||||||
command=self.fontupdate, variable=self.size_var)
|
command=self.fontupdate, variable=self.size_var)
|
||||||
sc.grid(row=4, column=0, columnspan=2, sticky='news')
|
sc.grid(row=4, column=0, columnspan=2, sticky='news')
|
||||||
#
|
#
|
||||||
self.size_var.set(self.font_size)
|
|
||||||
self.weight_var.set(self.font_weight == 'bold')
|
|
||||||
self.slant_var.set(self.font_slant == 'italic')
|
|
||||||
font_families = list(tkFont.families())
|
font_families = list(tkFont.families())
|
||||||
font_families.sort()
|
font_families.sort()
|
||||||
selected = -1
|
selected = -1
|
||||||
|
|
|
@ -56,14 +56,12 @@ 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_geometry('400x120')
|
|
||||||
self.top.wm_minsize(400, 120)
|
|
||||||
self.top.wm_resizable(0, 0)
|
self.top.wm_resizable(0, 0)
|
||||||
self.top.config(cursor="watch")
|
self.top.config(cursor="watch")
|
||||||
#
|
#
|
||||||
self.frame = Tkinter.Frame(self.top, relief=Tkinter.FLAT, bd=0,
|
self.frame = Tkinter.Frame(self.top, relief=Tkinter.FLAT, bd=0,
|
||||||
takefocus=0)
|
takefocus=0)
|
||||||
self.progress = Tkinter.Progressbar(self.frame, maximum=100)
|
self.progress = Tkinter.Progressbar(self.frame, maximum=100, length=250)
|
||||||
##style = Tkinter.Style(self.progress)
|
##style = Tkinter.Style(self.progress)
|
||||||
##style.configure('TProgressbar', background=color)
|
##style.configure('TProgressbar', background=color)
|
||||||
if images:
|
if images:
|
||||||
|
@ -73,7 +71,7 @@ class PysolProgressBar:
|
||||||
self.f2 = Tkinter.Label(self.frame, image=images[1])
|
self.f2 = Tkinter.Label(self.frame, image=images[1])
|
||||||
self.f2.pack(side='left', ipadx=8, ipady=4)
|
self.f2.pack(side='left', ipadx=8, ipady=4)
|
||||||
else:
|
else:
|
||||||
self.progress.grid(expand='yes', fill='x')
|
self.progress.pack(expand='yes', fill='x')
|
||||||
self.frame.pack(expand='yes', fill='both')
|
self.frame.pack(expand='yes', fill='both')
|
||||||
if app:
|
if app:
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -48,6 +48,8 @@ from pysollib.pysolaudio import pysolsoundserver
|
||||||
# Toolkit imports
|
# Toolkit imports
|
||||||
from tkconst import EVENT_HANDLED, EVENT_PROPAGATE
|
from tkconst import EVENT_HANDLED, EVENT_PROPAGATE
|
||||||
from tkwidget import MfxDialog, MfxMessageDialog
|
from tkwidget import MfxDialog, MfxMessageDialog
|
||||||
|
from tkwidget import PysolScale
|
||||||
|
|
||||||
|
|
||||||
# /***********************************************************************
|
# /***********************************************************************
|
||||||
# //
|
# //
|
||||||
|
@ -121,16 +123,16 @@ class SoundOptionsDialog(MfxDialog):
|
||||||
if app.audio.CAN_PLAY_MUSIC: # and app.startup_opt.sound_mode > 0:
|
if app.audio.CAN_PLAY_MUSIC: # and app.startup_opt.sound_mode > 0:
|
||||||
row += 1
|
row += 1
|
||||||
w = Tkinter.Label(frame, text=_('Sample volume:'))
|
w = Tkinter.Label(frame, text=_('Sample volume:'))
|
||||||
w.grid(row=row, column=0, sticky='w')
|
w.grid(row=row, column=0, sticky='ew')
|
||||||
w = Tkinter.Scale(frame, from_=0, to=128, resolution=1,
|
w = PysolScale(frame, from_=0, to=128, resolution=1,
|
||||||
orient='horizontal', takefocus=0,
|
orient='horizontal', takefocus=0,
|
||||||
length="3i", #label=_('Sample volume'),
|
length="3i", #label=_('Sample volume'),
|
||||||
variable=self.sample_volume)
|
variable=self.sample_volume)
|
||||||
w.grid(row=row, column=1, sticky='w', padx=5)
|
w.grid(row=row, column=1, sticky='w', padx=5)
|
||||||
row += 1
|
row += 1
|
||||||
w = Tkinter.Label(frame, text=_('Music volume:'))
|
w = Tkinter.Label(frame, text=_('Music volume:'))
|
||||||
w.grid(row=row, column=0, sticky='w', padx=5)
|
w.grid(row=row, column=0, sticky='ew', padx=5)
|
||||||
w = Tkinter.Scale(frame, from_=0, to=128, resolution=1,
|
w = PysolScale(frame, from_=0, to=128, resolution=1,
|
||||||
orient='horizontal', takefocus=0,
|
orient='horizontal', takefocus=0,
|
||||||
length="3i", #label=_('Music volume'),
|
length="3i", #label=_('Music volume'),
|
||||||
variable=self.music_volume)
|
variable=self.music_volume)
|
||||||
|
|
|
@ -31,6 +31,8 @@ from pysollib.mfxutil import destruct, kwdefault, KwStruct, Struct
|
||||||
# Toolkit imports
|
# Toolkit imports
|
||||||
from tkconst import EVENT_HANDLED, EVENT_PROPAGATE
|
from tkconst import EVENT_HANDLED, EVENT_PROPAGATE
|
||||||
from tkwidget import MfxDialog
|
from tkwidget import MfxDialog
|
||||||
|
from tkwidget import PysolScale
|
||||||
|
|
||||||
|
|
||||||
# /***********************************************************************
|
# /***********************************************************************
|
||||||
# //
|
# //
|
||||||
|
@ -71,7 +73,7 @@ class TimeoutsDialog(MfxDialog):
|
||||||
):
|
):
|
||||||
Tkinter.Label(frame, text=title, anchor='w'
|
Tkinter.Label(frame, text=title, anchor='w'
|
||||||
).grid(row=row, column=0, sticky='we')
|
).grid(row=row, column=0, sticky='we')
|
||||||
widget = Tkinter.Scale(frame, from_=0.2, to=9.9,
|
widget = PysolScale(frame, from_=0.2, to=9.9, value=var.get(),
|
||||||
resolution=0.1, orient='horizontal',
|
resolution=0.1, orient='horizontal',
|
||||||
length="3i", variable=var, takefocus=0)
|
length="3i", variable=var, takefocus=0)
|
||||||
widget.grid(row=row, column=1)
|
widget.grid(row=row, column=1)
|
||||||
|
|
|
@ -275,7 +275,7 @@ class HTMLViewer:
|
||||||
fg='black', bg='white',
|
fg='black', bg='white',
|
||||||
bd=1, relief='sunken',
|
bd=1, relief='sunken',
|
||||||
cursor=self.defcursor,
|
cursor=self.defcursor,
|
||||||
wrap='word', padx=20, pady=20)
|
wrap='word', padx=10)
|
||||||
self.text.pack(side=Tkinter.LEFT, fill=Tkinter.BOTH, expand=1)
|
self.text.pack(side=Tkinter.LEFT, fill=Tkinter.BOTH, expand=1)
|
||||||
self.text["yscrollcommand"] = vbar.set
|
self.text["yscrollcommand"] = vbar.set
|
||||||
vbar["command"] = self.text.yview
|
vbar["command"] = self.text.yview
|
||||||
|
|
|
@ -255,8 +255,8 @@ class MfxTreeInCanvas(MfxScrolledCanvas):
|
||||||
#
|
#
|
||||||
self.style = self.Style()
|
self.style = self.Style()
|
||||||
##self.style.text_normal_fg = self.canvas.cget("insertbackground")
|
##self.style.text_normal_fg = self.canvas.cget("insertbackground")
|
||||||
self.style.text_normal_fg = self.canvas.option_get('foreground', '') or self.canvas.cget("insertbackground")
|
#self.style.text_normal_fg = self.canvas.option_get('foreground', '') or self.canvas.cget("insertbackground")
|
||||||
self.style.text_normal_bg = self.canvas.option_get('background', self.canvas.cget("background"))
|
#self.style.text_normal_bg = self.canvas.option_get('background', self.canvas.cget("background"))
|
||||||
#
|
#
|
||||||
bind(self.canvas, "<ButtonPress-1>", self.singleClick)
|
bind(self.canvas, "<ButtonPress-1>", self.singleClick)
|
||||||
bind(self.canvas, "<Double-Button-1>", self.doubleClick)
|
bind(self.canvas, "<Double-Button-1>", self.doubleClick)
|
||||||
|
|
|
@ -69,7 +69,6 @@ except ImportError:
|
||||||
# Toolkit imports
|
# Toolkit imports
|
||||||
from tkconst import tkversion
|
from tkconst import tkversion
|
||||||
from pysollib.settings import PACKAGE
|
from pysollib.settings import PACKAGE
|
||||||
from pysollib.settings import TILE_THEME
|
|
||||||
|
|
||||||
|
|
||||||
# /***********************************************************************
|
# /***********************************************************************
|
||||||
|
@ -176,10 +175,13 @@ def make_help_toplevel(app, title=None):
|
||||||
parent = app.top
|
parent = app.top
|
||||||
window = Tkinter.Tk(className=PACKAGE)
|
window = Tkinter.Tk(className=PACKAGE)
|
||||||
window.tk.call('package', 'require', 'tile')
|
window.tk.call('package', 'require', 'tile')
|
||||||
|
from pysollib.settings import TILE_THEME
|
||||||
if TILE_THEME:
|
if TILE_THEME:
|
||||||
##window.tk.call('style', 'theme', 'use', TILE_THEME)
|
##window.tk.call('style', 'theme', 'use', TILE_THEME)
|
||||||
style = Tkinter.Style(window)
|
style = Tkinter.Style(window)
|
||||||
style.theme_use(TILE_THEME)
|
style.theme_use(TILE_THEME)
|
||||||
|
bg = window.tk.call('style', 'lookup', TILE_THEME, '-background')
|
||||||
|
window.tk_setPalette(bg)
|
||||||
font = parent.option_get('font', '')
|
font = parent.option_get('font', '')
|
||||||
if font:
|
if font:
|
||||||
window.option_add('*font', font)
|
window.option_add('*font', font)
|
||||||
|
@ -202,11 +204,10 @@ def make_help_toplevel(app, title=None):
|
||||||
|
|
||||||
def __getWidgetXY(widget, parent, relx=None, rely=None,
|
def __getWidgetXY(widget, parent, relx=None, rely=None,
|
||||||
w_width=None, w_height=None):
|
w_width=None, w_height=None):
|
||||||
min_width, min_height = widget.wm_minsize()
|
|
||||||
if w_width is None:
|
if w_width is None:
|
||||||
w_width = max(min_width, widget.winfo_reqwidth())
|
w_width = widget.winfo_reqwidth()
|
||||||
if w_height is None:
|
if w_height is None:
|
||||||
w_height = max(min_height, widget.winfo_reqheight())
|
w_height = widget.winfo_reqheight()
|
||||||
s_width = widget.winfo_screenwidth()
|
s_width = widget.winfo_screenwidth()
|
||||||
s_height = widget.winfo_screenheight()
|
s_height = widget.winfo_screenheight()
|
||||||
m_x = m_y = 0
|
m_x = m_y = 0
|
||||||
|
|
|
@ -720,3 +720,49 @@ class StackDesc:
|
||||||
for b in self.bindings:
|
for b in self.bindings:
|
||||||
self.label.unbind('<ButtonPress>', b)
|
self.label.unbind('<ButtonPress>', b)
|
||||||
|
|
||||||
|
|
||||||
|
# /***********************************************************************
|
||||||
|
# //
|
||||||
|
# ************************************************************************/
|
||||||
|
|
||||||
|
class PysolScale:
|
||||||
|
def __init__(self, parent, **kw):
|
||||||
|
if kw.has_key('resolution'):
|
||||||
|
self.resolution = kw['resolution']
|
||||||
|
else:
|
||||||
|
self.resolution = 1
|
||||||
|
if kw.has_key('command'):
|
||||||
|
self.command = kw['command']
|
||||||
|
else:
|
||||||
|
self.command = None
|
||||||
|
self.frame = Tkinter.Frame(parent)
|
||||||
|
|
||||||
|
self.label = Tkinter.Label(self.frame)
|
||||||
|
self.label.pack()
|
||||||
|
|
||||||
|
kw['command'] = self._scale_command
|
||||||
|
self.scale = Tkinter.Scale(self.frame, **kw)
|
||||||
|
self.scale.pack(expand=True, fill='both')
|
||||||
|
|
||||||
|
if kw.has_key('value'):
|
||||||
|
self.label.configure(text=self._round(kw['value']))
|
||||||
|
elif kw.has_key('variable'):
|
||||||
|
self.label.configure(text=self._round(kw['variable'].get()))
|
||||||
|
|
||||||
|
def _round(self, value):
|
||||||
|
return int(float(value)/self.resolution)*self.resolution
|
||||||
|
|
||||||
|
def _scale_command(self, value):
|
||||||
|
self.label.configure(text=self._round(value))
|
||||||
|
if self.command:
|
||||||
|
self.command(value)
|
||||||
|
|
||||||
|
def pack(self, **kw):
|
||||||
|
self.frame.pack(**kw)
|
||||||
|
def grid(self, **kw):
|
||||||
|
self.frame.grid(**kw)
|
||||||
|
|
||||||
|
def configure(self, **kw):
|
||||||
|
self.scale.configure(**kw)
|
||||||
|
config = configure
|
||||||
|
|
||||||
|
|
|
@ -46,7 +46,6 @@ import Tile as Tkinter
|
||||||
|
|
||||||
# PySol imports
|
# PySol imports
|
||||||
from pysollib.mfxutil import destruct, Struct
|
from pysollib.mfxutil import destruct, Struct
|
||||||
from pysollib.settings import TILE_THEME
|
|
||||||
from tkutil import after_idle
|
from tkutil import after_idle
|
||||||
from tkconst import EVENT_HANDLED, EVENT_PROPAGATE
|
from tkconst import EVENT_HANDLED, EVENT_PROPAGATE
|
||||||
|
|
||||||
|
@ -87,6 +86,7 @@ class MfxRoot(Tkinter.Tk):
|
||||||
def __init__(self, **kw):
|
def __init__(self, **kw):
|
||||||
apply(Tkinter.Tk.__init__, (self,), kw)
|
apply(Tkinter.Tk.__init__, (self,), kw)
|
||||||
self.tk.call("package", "require", "tile")
|
self.tk.call("package", "require", "tile")
|
||||||
|
from pysollib.settings import TILE_THEME
|
||||||
if TILE_THEME:
|
if TILE_THEME:
|
||||||
##self.tk.call('style', 'theme', 'use', TILE_THEME)
|
##self.tk.call('style', 'theme', 'use', TILE_THEME)
|
||||||
style = Tkinter.Style(self)
|
style = Tkinter.Style(self)
|
||||||
|
|
|
@ -223,7 +223,7 @@ class PysolToolbar(PysolToolbarActions):
|
||||||
self.label_pady = 4
|
self.label_pady = 4
|
||||||
self.button_pad = 2
|
self.button_pad = 2
|
||||||
#
|
#
|
||||||
self.frame = Tkinter.Frame(top) #, class_='Toolbar')
|
self.frame = Tkinter.Frame(top, class_='Toolbar')
|
||||||
#
|
#
|
||||||
for l, f, t in (
|
for l, f, t in (
|
||||||
(n_("New"), self.mNewGame, _("New game")),
|
(n_("New"), self.mNewGame, _("New game")),
|
||||||
|
|
|
@ -121,12 +121,12 @@ class SoundOptionsDialog(MfxDialog):
|
||||||
if app.audio.CAN_PLAY_MUSIC: # and app.startup_opt.sound_mode > 0:
|
if app.audio.CAN_PLAY_MUSIC: # and app.startup_opt.sound_mode > 0:
|
||||||
row += 1
|
row += 1
|
||||||
w = Tkinter.Label(frame, text=_('Sample volume:'))
|
w = Tkinter.Label(frame, text=_('Sample volume:'))
|
||||||
w.grid(row=row, column=0, sticky='w')
|
w.grid(row=row, column=0, sticky='ew')
|
||||||
w = Tkinter.Scale(frame, from_=0, to=128, resolution=1,
|
w = Tkinter.Scale(frame, from_=0, to=128, resolution=1,
|
||||||
orient='horizontal', takefocus=0,
|
orient='horizontal', takefocus=0,
|
||||||
length="3i", #label=_('Sample volume'),
|
length="3i", #label=_('Sample volume'),
|
||||||
variable=self.sample_volume)
|
variable=self.sample_volume)
|
||||||
w.grid(row=row, column=1, sticky='w', padx=5)
|
w.grid(row=row, column=1, sticky='ew', padx=5)
|
||||||
row += 1
|
row += 1
|
||||||
w = Tkinter.Label(frame, text=_('Music volume:'))
|
w = Tkinter.Label(frame, text=_('Music volume:'))
|
||||||
w.grid(row=row, column=0, sticky='w', padx=5)
|
w.grid(row=row, column=0, sticky='w', padx=5)
|
||||||
|
|
|
@ -275,7 +275,7 @@ class HTMLViewer:
|
||||||
fg='black', bg='white',
|
fg='black', bg='white',
|
||||||
bd=1, relief='sunken',
|
bd=1, relief='sunken',
|
||||||
cursor=self.defcursor,
|
cursor=self.defcursor,
|
||||||
wrap='word', padx=20, pady=20)
|
wrap='word', padx=10)
|
||||||
self.text.pack(side=Tkinter.LEFT, fill=Tkinter.BOTH, expand=1)
|
self.text.pack(side=Tkinter.LEFT, fill=Tkinter.BOTH, expand=1)
|
||||||
self.text["yscrollcommand"] = vbar.set
|
self.text["yscrollcommand"] = vbar.set
|
||||||
vbar["command"] = self.text.yview
|
vbar["command"] = self.text.yview
|
||||||
|
|
Loading…
Add table
Reference in a new issue