1
0
Fork 0
mirror of https://github.com/shlomif/PySolFC.git synced 2025-04-05 00:02:29 -04:00

- corrected rules of Whitehead

- added files to svn:ignore


git-svn-id: file:///home/shlomif/Backup/svn-dumps/PySolFC/svnsync-repos/pysolfc/PySolFC/trunk@3 efabe8c0-fbe8-4139-b769-b5e6d273206e
This commit is contained in:
skomoroh 2006-05-29 00:10:22 +00:00
parent 976a5767aa
commit c037bf7827
8 changed files with 48 additions and 125 deletions

View file

@ -9,12 +9,11 @@ PYSOLLIB_FILES=pysollib/tk/*.py pysollib/*.py \
install:
python setup.py install
dist:
./scripts/all_games.py > docs/all_games.html
dist: all_games_html rules mo
python setup.py sdist
rpm:
python setup.py bdist_rpm --use-bzip2
rpm: all_games_html rules mo
python setup.py bdist_rpm
all_games_html:
./scripts/all_games.py > docs/all_games.html

View file

@ -1023,6 +1023,7 @@ class PysolMenubarActions:
print "playing music:", music.filename
def mIconify(self, *args):
if self._cancelDrag(break_pause=False): return
self.top.wm_iconify()

View file

@ -711,11 +711,8 @@ class Application:
self.toolbar.connectGame(self.game, self.menubar)
self.game.updateStatus(player=self.opt.player)
# update "Recent games" menubar entry
while 1:
try:
self.opt.recent_gameid.remove(id)
except ValueError:
break
if id in self.opt.recent_gameid:
self.opt.recent_gameid.remove(id)
self.opt.recent_gameid.insert(0, id)
del self.opt.recent_gameid[15:]
self.menubar.updateRecentGamesMenu(self.opt.recent_gameid)

View file

@ -33,7 +33,7 @@
##
##---------------------------------------------------------------------------##
__all__ = ['DisplayTextDialog', 'EditTextDialog']
__all__ = ['EditTextDialog']
# imports
import os, sys, Tkinter
@ -42,16 +42,13 @@ import os, sys, Tkinter
from pysollib.mfxutil import destruct, kwdefault, KwStruct, Struct
# Toolkit imports
from tkconst import EVENT_HANDLED, EVENT_PROPAGATE
from tkwidget import _ToplevelDialog, MfxDialog
from tkhtml import MfxScrolledText, MfxReadonlyScrolledText
# /***********************************************************************
# //
# ************************************************************************/
class DisplayTextDialog(MfxDialog):
Text_Class = MfxReadonlyScrolledText
class EditTextDialog(MfxDialog):
def __init__(self, parent, title, text, **kw):
kw = self.initKw(kw)
@ -59,10 +56,15 @@ class DisplayTextDialog(MfxDialog):
top_frame, bottom_frame = self.createFrames(kw)
self.createBitmaps(top_frame, kw)
#
bg = top_frame["bg"]
self.text_w = self.Text_Class(top_frame, bd=1, relief="sunken",
wrap="word", width=64, height=16,
bg=bg)
self.text_w = Tkinter.Text(top_frame, bd=1, relief="sunken",
wrap="word", width=64, height=16)
self.text_w.pack(side='left', fill="both", expand=1)
###self.text_w.pack(side=Tkinter.TOP, padx=kw.padx, pady=kw.pady)
vbar = Tkinter.Scrollbar(top_frame)
vbar.pack(side='right', fill='y')
self.text_w["yscrollcommand"] = vbar.set
vbar["command"] = self.text_w.yview
#
self.text = ""
if text:
self.text = text
@ -70,25 +72,11 @@ class DisplayTextDialog(MfxDialog):
self.text_w.config(state="normal")
self.text_w.insert("insert", self.text)
self.text_w.config(state=old_state)
self.text_w.pack(side="top", fill="both", expand=1)
###self.text_w.pack(side=Tkinter.TOP, padx=kw.padx, pady=kw.pady)
#
focus = self.createButtons(bottom_frame, kw)
#focus = self.text_w
focus = self.text_w
self.mainloop(focus, kw.timeout)
def initKw(self, kw):
kw = KwStruct(kw,
strings=(_("OK"),), default=0,
resizable = 1,
separatorwidth = 0,
)
return MfxDialog.initKw(self, kw)
class EditTextDialog(DisplayTextDialog):
Text_Class = MfxScrolledText
def initKw(self, kw):
kw = KwStruct(kw,
strings=(_("OK"), _("Cancel")), default=-1,
@ -99,7 +87,7 @@ class EditTextDialog(DisplayTextDialog):
def destroy(self):
self.text = self.text_w.get("1.0", "end")
DisplayTextDialog.destroy(self)
MfxDialog.destroy(self)
def wmDeleteWindow(self, *event): # ignore
pass
@ -108,22 +96,3 @@ class EditTextDialog(DisplayTextDialog):
pass
# /***********************************************************************
# //
# ************************************************************************/
def edittextdialog_main(args):
from tkutil import wm_withdraw
tk = Tkinter.Tk()
wm_withdraw(tk)
tk.update()
d = DisplayTextDialog(tk, "Comment for game #12345", text="Test")
d = EditTextDialog(tk, "Comment for game #12345", text="Test")
print d.text
return 0
if __name__ == "__main__":
import sys
sys.exit(edittextdialog_main(sys.argv))

View file

@ -235,8 +235,9 @@ class PysolMenubar(PysolMenubarActions):
kw = { "name": "menubar" }
if 1 and os.name == "posix":
pass
kw["relief"] = "groove"
##kw["relief"] = "groove"
kw["activeborderwidth"] = 1
kw['bd'] = 1
self.__menubar = apply(MfxMenubar, (self.top,), kw)
# init keybindings

View file

@ -59,12 +59,13 @@ class MfxStatusbar:
self._row = row
self._column = column
self._columnspan = columnspan
self.padx = 0
self.pady = 0
self.padx = 1
self.pady = 2
#
self.frame = Tkinter.Frame(self.top, bd=1, relief='raised')
self.frame = Tkinter.Frame(self.top, bd=1) #, relief='raised')
self.frame.grid(row=self._row, column=self._column,
columnspan=self._columnspan, sticky='ew')
columnspan=self._columnspan, sticky='ew',
padx=self.padx, pady=self.pady)
# util
def _createLabel(self, name,
@ -74,7 +75,7 @@ class MfxStatusbar:
tooltip=None):
if padx < 0: padx = self.padx
label = Tkinter.Label(self.frame, text=text,
width=width, relief=relief)
width=width, relief=relief, bd=1)
label.pack(side=side, fill=fill, padx=padx, expand=expand)
setattr(self, name + "_label", label)
self._widgets.append(label)

View file

@ -36,7 +36,7 @@
__all__ = ['tkHTMLViewer']
# imports
import os, sys, re, string, types
import os, sys, re, types
import htmllib, formatter
import Tkinter
@ -53,58 +53,6 @@ from statusbar import HtmlStatusbar
REMOTE_PROTOCOLS = ("ftp:", "gopher:", "http:", "mailto:", "news:", "telnet:")
# /***********************************************************************
# //
# ************************************************************************/
class MfxScrolledText(Tkinter.Text):
def __init__(self, parent=None, **cnf):
fcnf = {}
for k in cnf.keys():
if type(k) is types.ClassType or k == "name":
fcnf[k] = cnf[k]
del cnf[k]
if cnf.has_key("bg"):
fcnf["bg"] = cnf["bg"]
self.frame = apply(Tkinter.Frame, (parent,), fcnf)
self.vbar = Tkinter.Scrollbar(self.frame, name="vbar")
self.vbar.pack(side=Tkinter.RIGHT, fill=Tkinter.Y)
cnf["name"] = "text"
apply(Tkinter.Text.__init__, (self, self.frame), cnf)
self.pack(side=Tkinter.LEFT, fill=Tkinter.BOTH, expand=1)
self["yscrollcommand"] = self.vbar.set
self.vbar["command"] = self.yview
# FIXME: copy Pack methods of self.frame -- this is a hack!
for m in Tkinter.Pack.__dict__.keys():
if m[0] != "_" and m != "config" and m != "configure":
##print m, getattr(self.frame, m)
setattr(self, m, getattr(self.frame, m))
self.frame["highlightthickness"] = 0
self.vbar["highlightthickness"] = 0
##print self.__dict__
# XXX these are missing in Tkinter.py
def xview_moveto(self, fraction):
return self.tk.call(self._w, "xview", "moveto", fraction)
def xview_scroll(self, number, what):
return self.tk.call(self._w, "xview", "scroll", number, what)
def yview_moveto(self, fraction):
return self.tk.call(self._w, "yview", "moveto", fraction)
def yview_scroll(self, number, what):
return self.tk.call(self._w, "yview", "scroll", number, what)
class MfxReadonlyScrolledText(MfxScrolledText):
def __init__(self, parent=None, **cnf):
apply(MfxScrolledText.__init__, (self, parent), cnf)
self.config(state="disabled", insertofftime=0)
self.frame.config(takefocus=0)
self.config(takefocus=0)
self.vbar.config(takefocus=0)
# /***********************************************************************
# //
# ************************************************************************/
@ -273,6 +221,7 @@ class tkHTMLViewer:
)
self.images = {} # need to keep a reference because of garbage collection
self.defcursor = parent["cursor"]
##self.defcursor = 'xterm'
self.handcursor = "hand2"
# create buttons
@ -297,11 +246,15 @@ class tkHTMLViewer:
# create text widget
text_frame = Tkinter.Frame(parent)
text_frame.grid(row=1, column=0, columnspan=4, sticky='nsew')
self.text = MfxReadonlyScrolledText(text_frame,
fg="#000000", bg="#f7f3ff",
cursor=self.defcursor,
wrap="word", padx=20, pady=20)
self.text.pack(side="top", fill="both", expand=1)
self.text = Tkinter.Text(text_frame,
fg='black', bg='white', bd=0,
cursor=self.defcursor,
wrap='word', padx=20, pady=20)
self.text.pack(side=Tkinter.LEFT, fill=Tkinter.BOTH, expand=1)
vbar = Tkinter.Scrollbar(text_frame)
vbar.pack(side=Tkinter.RIGHT, fill=Tkinter.Y)
self.text["yscrollcommand"] = vbar.set
vbar["command"] = self.text.yview
# statusbar
self.statusbar = HtmlStatusbar(parent, row=2, column=0, columnspan=4)

View file

@ -103,7 +103,7 @@ class ToolbarSeparator(Tkinter.Frame):
width = 4
height = 4
padx = 6
pady = 4
pady = 6
if orient == Tkinter.HORIZONTAL:
self.config(width=width, height=height)
self.grid(row=0,
@ -259,16 +259,16 @@ class PysolToolbar(PysolToolbarActions):
def _setRelief(self, relief):
if type(relief) is types.IntType:
relief = (Tkinter.RAISED, Tkinter.FLAT)[relief]
elif relief in (Tkinter.RAISED, Tkinter.FLAT):
relief = ('raised', 'flat')[relief]
elif relief in ('raised', 'flat'):
pass
else:
relief = Tkinter.FLAT
relief = 'flat'
self.button_relief = relief
if relief == Tkinter.RAISED:
self.separator_relief = Tkinter.FLAT
if relief == 'raised':
self.separator_relief = 'flat'
else:
self.separator_relief = Tkinter.RAISED
self.separator_relief = 'sunken' #'raised'
return relief
# util
@ -465,7 +465,9 @@ class PysolToolbar(PysolToolbarActions):
return False
self._setRelief(relief)
if os.name == 'posix':
self.frame.config(relief=self.separator_relief)
relief = self.button_relief == 'flat' and 'raised' or 'flat'
self.frame.config(relief=relief)
#self.frame.config(relief=self.separator_relief)
for w in self._widgets:
if isinstance(w, ToolbarButton):
w.config(relief=self.button_relief)