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: https://pysolfc.svn.sourceforge.net/svnroot/pysolfc/PySolFC/trunk@5 39dd0a4e-7c14-0410-91b3-c4f2d318f732
This commit is contained in:
skomoroh 2006-06-09 22:39:18 +00:00
parent 16934784ba
commit 0c3f1915da
9 changed files with 37 additions and 28 deletions

View file

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

2
pysol
View file

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

View file

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

View file

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

View file

@ -59,26 +59,24 @@ class MfxStatusbar:
self._row = row self._row = row
self._column = column self._column = column
self._columnspan = columnspan self._columnspan = columnspan
self.padx = 1
self.pady = 2
# #
self.padx = 1
self.frame = Tkinter.Frame(self.top, bd=1) self.frame = Tkinter.Frame(self.top, bd=1)
self.frame.grid(row=self._row, column=self._column, 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) padx=1, pady=1)
#if os.name == "mac": #if os.name == "mac":
# Tkinter.Label(self.frame, width=2).pack(side='right') # Tkinter.Label(self.frame, width=2).pack(side='right')
if os.name == 'nt':
self.frame.config(relief='raised')
self.padx = 0
# util # util
def _createLabel(self, name, def _createLabel(self, name, side='left',
text="", relief='sunken', fill='none', expand=0, width=0,
side='left', fill='none',
padx=-1, expand=0, width=0,
tooltip=None): tooltip=None):
if padx < 0: padx = self.padx label = Tkinter.Label(self.frame, width=width, relief='sunken', bd=1)
label = Tkinter.Label(self.frame, text=text, label.pack(side=side, fill=fill, padx=self.padx, expand=expand)
width=width, relief=relief, bd=1)
label.pack(side=side, fill=fill, padx=padx, expand=expand)
setattr(self, name + "_label", label) setattr(self, name + "_label", label)
self._widgets.append(label) self._widgets.append(label)
if tooltip: if tooltip:
@ -150,15 +148,14 @@ class HelpStatusbar(MfxStatusbar):
def __init__(self, top): def __init__(self, top):
MfxStatusbar.__init__(self, top, row=4, column=0, columnspan=3) MfxStatusbar.__init__(self, top, row=4, column=0, columnspan=3)
l = self._createLabel("info", fill='both', expand=1) 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): class HtmlStatusbar(MfxStatusbar):
def __init__(self, top, row, column, columnspan): def __init__(self, top, row, column, columnspan):
MfxStatusbar.__init__(self, top, MfxStatusbar.__init__(self, top, row=row, column=column, columnspan=columnspan)
row=row, column=column, columnspan=columnspan)
l = self._createLabel("url", fill='both', expand=1) 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 raise SystemExit
def altKeyEvent(self, event): def altKeyEvent(self, event):
key = event.char.lower() key = event.char
key = unicode(key, 'utf-8') key = unicode(key, 'utf-8')
key = key.lower()
button = self.accel_keys.get(key) button = self.accel_keys.get(key)
if not button is None: if not button is None:
self.mDone(button) self.mDone(button)
@ -197,7 +198,8 @@ class MfxDialog: # ex. _ToplevelDialog
s = s[0] s = s[0]
if s: if s:
##s = re.sub(r"[\s\.\,]", "", s) ##s = re.sub(r"[\s\.\,]", "", s)
s = s.replace('...', '.') #if os.name == 'posix':
# s = s.replace('...', '.')
s = s.replace('&', '') s = s.replace('&', '')
max_len = max(max_len, len(s)) max_len = max(max_len, len(s))
##print s, len(s) ##print s, len(s)

View file

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

View file

@ -4,7 +4,7 @@ cd ..
rm -rf dist rm -rf dist
mkdir dist mkdir dist
cp -r locale 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 setup.py py2exe
python scripts\create_iss.py python scripts\create_iss.py
"d:\Program Files\Inno Setup 5\ISCC.exe" setup.iss "d:\Program Files\Inno Setup 5\ISCC.exe" setup.iss

View file

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