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

- added check of os.environ['LANG']

- fixed `win32_gethomedir'
- minor changes of widgets style
- other minor fixes


git-svn-id: file:///home/shlomif/Backup/svn-dumps/PySolFC/svnsync-repos/pysolfc/PySolFC/trunk@5 efabe8c0-fbe8-4139-b769-b5e6d273206e
This commit is contained in:
skomoroh 2006-06-09 22:39:18 +00:00
parent 00e73d252b
commit ebf1cf6bbc
9 changed files with 37 additions and 28 deletions

View file

@ -1,5 +1,7 @@
# Makefile for PySolFC
override LANG=C
PYSOLLIB_FILES=pysollib/tk/*.py pysollib/*.py \
pysollib/games/*.py pysollib/games/special/*.py \
pysollib/games/contrib/*.py pysollib/games/ultra/*.py \

2
pysol
View file

@ -38,7 +38,7 @@
import sys, os
if os.name == 'nt':
if os.name == 'nt' and not os.environ.has_key('LANG'):
try:
import locale
l = locale.getdefaultlocale()

View file

@ -137,7 +137,7 @@ class Options:
if os.name == 'posix':
self.fonts["sans"] = ("helvetica", 12)
if os.name == 'nt':
self.fonts["sans"] = ("times new roman", 14)
self.fonts["sans"] = ("times new roman", 12)
self.fonts["fixed"] = ("courier new", 10)
# colors
self.table_color = "#008200"

View file

@ -204,6 +204,9 @@ def win32_getprefdir(package):
def win32_gethomedir():
# %USERPROFILE%, %APPDATA%
hd = os.environ.get('APPDATA')
if hd:
return hd
hd = os.path.expanduser('~')
if hd == '~': # win9x
return os.path.abspath('/')

View file

@ -59,26 +59,24 @@ class MfxStatusbar:
self._row = row
self._column = column
self._columnspan = columnspan
self.padx = 1
self.pady = 2
#
self.padx = 1
self.frame = Tkinter.Frame(self.top, bd=1)
self.frame.grid(row=self._row, column=self._column,
columnspan=self._columnspan, sticky='ew',
padx=self.padx, pady=self.pady)
padx=1, pady=1)
#if os.name == "mac":
# Tkinter.Label(self.frame, width=2).pack(side='right')
if os.name == 'nt':
self.frame.config(relief='raised')
self.padx = 0
# util
def _createLabel(self, name,
text="", relief='sunken',
side='left', fill='none',
padx=-1, expand=0, width=0,
def _createLabel(self, name, side='left',
fill='none', expand=0, width=0,
tooltip=None):
if padx < 0: padx = self.padx
label = Tkinter.Label(self.frame, text=text,
width=width, relief=relief, bd=1)
label.pack(side=side, fill=fill, padx=padx, expand=expand)
label = Tkinter.Label(self.frame, width=width, relief='sunken', bd=1)
label.pack(side=side, fill=fill, padx=self.padx, expand=expand)
setattr(self, name + "_label", label)
self._widgets.append(label)
if tooltip:
@ -150,15 +148,14 @@ class HelpStatusbar(MfxStatusbar):
def __init__(self, top):
MfxStatusbar.__init__(self, top, row=4, column=0, columnspan=3)
l = self._createLabel("info", fill='both', expand=1)
l.config(text="", justify="left", anchor='w', padx=8)
l.config(justify="left", anchor='w', padx=8)
class HtmlStatusbar(MfxStatusbar):
def __init__(self, top, row, column, columnspan):
MfxStatusbar.__init__(self, top,
row=row, column=column, columnspan=columnspan)
MfxStatusbar.__init__(self, top, row=row, column=column, columnspan=columnspan)
l = self._createLabel("url", fill='both', expand=1)
l.config(text="", justify="left", anchor='w', padx=8)
l.config(justify="left", anchor='w', padx=8)
# /***********************************************************************

View file

@ -141,8 +141,9 @@ class MfxDialog: # ex. _ToplevelDialog
raise SystemExit
def altKeyEvent(self, event):
key = event.char.lower()
key = event.char
key = unicode(key, 'utf-8')
key = key.lower()
button = self.accel_keys.get(key)
if not button is None:
self.mDone(button)
@ -197,7 +198,8 @@ class MfxDialog: # ex. _ToplevelDialog
s = s[0]
if s:
##s = re.sub(r"[\s\.\,]", "", s)
s = s.replace('...', '.')
#if os.name == 'posix':
# s = s.replace('...', '.')
s = s.replace('&', '')
max_len = max(max_len, len(s))
##print s, len(s)

View file

@ -220,10 +220,9 @@ class PysolToolbar(PysolToolbarActions):
# (see also setRelief)
if os.name == 'posix':
#self.frame.config(bd=0, highlightthickness=1)
relief = self.button_relief == 'flat' and 'raised' or 'flat'
self.frame.config(bd=1, relief=relief, highlightthickness=0)
self.frame.config(bd=1, relief=self.frame_relief, highlightthickness=0)
elif os.name == "nt":
self.frame.config(bd=2, relief="groove", padx=2, pady=2)
self.frame.config(bd=2, relief=self.frame_relief, padx=2, pady=2)
#self._createSeparator(width=4, side=Tkinter.LEFT, relief=Tkinter.FLAT)
#self._createSeparator(width=4, side=Tkinter.RIGHT, relief=Tkinter.FLAT)
else:
@ -267,9 +266,16 @@ class PysolToolbar(PysolToolbarActions):
relief = 'flat'
self.button_relief = relief
if relief == 'raised':
self.frame_relief = 'flat'
self.separator_relief = 'flat'
if os.name == 'nt':
self.frame_relief = 'groove'
else:
self.frame_relief = 'raised'
self.separator_relief = 'sunken' #'raised'
if os.name == 'nt':
self.frame_relief = 'groove'
self.separator_relief = 'groove'
return relief
# util
@ -465,10 +471,7 @@ class PysolToolbar(PysolToolbarActions):
if self.button_relief == relief:
return False
self._setRelief(relief)
if os.name == 'posix':
relief = self.button_relief == 'flat' and 'raised' or 'flat'
self.frame.config(relief=relief)
#self.frame.config(relief=self.separator_relief)
self.frame.config(relief=self.frame_relief)
for w in self._widgets:
if isinstance(w, ToolbarButton):
w.config(relief=self.button_relief)

View file

@ -4,7 +4,7 @@ cd ..
rm -rf dist
mkdir dist
cp -r locale dist
cp freecell-solver\freecell-solver-2.8.6-bin\fc-solve.exe dist
cp fc-solve.exe dist
python setup.py py2exe
python scripts\create_iss.py
"d:\Program Files\Inno Setup 5\ISCC.exe" setup.iss

View file

@ -1,7 +1,6 @@
#!/usr/bin/env python
prog_name = 'PySol Fan Club edition'
prog_version = '0.9.0'
import os
@ -12,6 +11,9 @@ for root, dirs, files in os.walk('dist'):
files_list.append(root)
dirs_list.append(root)
execfile(os.path.join('pysollib', 'version.py'))
prog_version = FC_VERSION
out = open('setup.iss', 'w')
print >> out, '''