From fb811ca38863274993b549afab93850c108d7a37 Mon Sep 17 00:00:00 2001 From: sqlcoder Date: Mon, 7 Jun 2010 21:58:04 +0100 Subject: [PATCH 1/9] minor heading change in Preferences dialog --- pyfpdb/GuiPrefs.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyfpdb/GuiPrefs.py b/pyfpdb/GuiPrefs.py index b85b3f6a..e5458cc7 100755 --- a/pyfpdb/GuiPrefs.py +++ b/pyfpdb/GuiPrefs.py @@ -60,7 +60,7 @@ class GuiPrefs: configColumn.pack_start(cRender, True) configColumn.add_attribute(cRender, 'text', 1) - configColumn = gtk.TreeViewColumn("Value") + configColumn = gtk.TreeViewColumn("Value (double-click to change)") self.configView.append_column(configColumn) cRender = gtk.CellRendererText() configColumn.pack_start(cRender, True) From d26b0f3a9fe59f0dfc1bf1a320eb378c2ecdab9f Mon Sep 17 00:00:00 2001 From: sqlcoder Date: Mon, 7 Jun 2010 21:59:01 +0100 Subject: [PATCH 2/9] another python -> pythonw change --- pyfpdb/fpdb.pyw | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyfpdb/fpdb.pyw b/pyfpdb/fpdb.pyw index 3d9db3d7..0594a805 100755 --- a/pyfpdb/fpdb.pyw +++ b/pyfpdb/fpdb.pyw @@ -35,7 +35,7 @@ if os.name == 'nt' and sys.version[0:3] not in ('2.5', '2.6') and '-r' not in sy os.environ['PATH'] = tmppath print "Python " + sys.version[0:3] + ' - press return to continue\n' sys.stdin.readline() - os.execvpe('python.exe', ('python.exe', 'fpdb.py', '-r'), os.environ) # first arg is ignored (name of program being run) + os.execvpe('pythonw.exe', ('pythonw.exe', 'fpdb.pyw', '-r'), os.environ) # first arg is ignored (name of program being run) else: print "\npython 2.5 not found, please install python 2.5 or 2.6 for fpdb\n" raw_input("Press ENTER to continue.") From 5803933ba066ed8f72c505399b662f7f286e0720 Mon Sep 17 00:00:00 2001 From: sqlcoder Date: Wed, 9 Jun 2010 20:58:05 +0100 Subject: [PATCH 3/9] update py2exe instructions --- pyfpdb/py2exe_setup.py | 53 ++++++++++++++++++++++++++++-------------- 1 file changed, 36 insertions(+), 17 deletions(-) diff --git a/pyfpdb/py2exe_setup.py b/pyfpdb/py2exe_setup.py index 15c834b5..97c24526 100644 --- a/pyfpdb/py2exe_setup.py +++ b/pyfpdb/py2exe_setup.py @@ -39,16 +39,14 @@ Py2exe script for fpdb. # MSVCP90.dll. These are somewhere in your windows install, so you # can just copy them to your working folder. (or just assume other # person will have them? any copyright issues with including them?) -#- [ If it works, you'll have 3 new folders, build and dist and gfx. Build is -# working space and should be deleted. Dist and gfx contain the files to be -# distributed. ] -# If it works, you'll have a new dir fpdb-XXX-YYYYMMDD-exe which should +#- If it works, you'll have a new dir fpdb-YYYYMMDD-exe which should # contain 2 dirs; gfx and pyfpdb and run_fpdb.bat -#- Last, you must copy the etc/, lib/ and share/ folders from your -# gtk/bin/ (just /gtk/?) folder to the pyfpdb folder. (the whole folders, -# not just the contents) +#- [ This bit is now automated: +# Last, you must copy the etc/, lib/ and share/ folders from your +# gtk/bin/ (just /gtk/?) folder to the pyfpdb folder. (the whole folders, +# not just the contents) ] #- You can (should) then prune the etc/, lib/ and share/ folders to -# remove components we don't need. +# remove components we don't need. (see output at end of program run) # sqlcoder notes: this worked for me with the following notes: #- I used the following versions: @@ -116,11 +114,11 @@ test_and_remove('build') today = date.today().strftime('%Y%m%d') -print "\n" + r"Output will be created in \pyfpdb\ and \fpdb_XXX_"+today+'\\' -print "Enter value for XXX (any length): ", # the comma means no newline -xxx = sys.stdin.readline().rstrip() -dist_dirname = r'fpdb-' + xxx + '-' + today + '-exe' -dist_dir = r'..\fpdb-' + xxx + '-' + today + '-exe' +print "\n" + r"Output will be created in \pyfpdb\ and \fpdb_"+today+'\\' +#print "Enter value for XXX (any length): ", # the comma means no newline +#xxx = sys.stdin.readline().rstrip() +dist_dirname = r'fpdb-' + today + '-exe' +dist_dir = r'..\fpdb-' + today + '-exe' print test_and_remove(dist_dir) @@ -163,10 +161,11 @@ setup( os.rename('dist', 'pyfpdb') -print '\n' + 'If py2exe was successful add the \\etc \\lib and \\share dirs ' -print 'from your gtk dir to \\%s\\pyfpdb\\\n' % dist_dirname -print 'Also copy libgobject-2.0-0.dll and libgdk-win32-2.0-0.dll from \\bin' -print 'into there' +# these instructions no longer needed: +#print '\n' + 'If py2exe was successful add the \\etc \\lib and \\share dirs ' +#print 'from your gtk dir to \\%s\\pyfpdb\\\n' % dist_dirname +#print 'Also copy libgobject-2.0-0.dll and libgdk-win32-2.0-0.dll from \\bin' +#print 'into there' dest = os.path.join(dist_dirname, 'pyfpdb') #print "try renaming pyfpdb to", dest @@ -207,4 +206,24 @@ dest_dir = os.path.join(dest, 'share') dest_dir = dest_dir.replace('\\', '\\\\') shutil.copytree( src_dir, dest_dir ) +print "\nIf py2exe was successful you should now have a new dir" +print dist_dirname+" in your pyfpdb dir" +print """ +The following dirs can probably removed to make the final package smaller: + +pyfpdb/lib/glib-2.0 +pyfpdb/lib/gtk-2.0/include +pyfpdb/lib/pkgconfig +pyfpdb/share/aclocal +pyfpdb/share/doc +pyfpdb/share/glib-2.0 +pyfpdb/share/gtk-2.0 +pyfpdb/share/gtk-doc +pyfpdb/share/locale +pyfpdb/share/man +pyfpdb/share/themes/Default + +Use 7-zip to zip up the distribution and create a self extracting archive and that's it! +""" + From fbefe1e611cf53570ba8a744ab95112d6131d8c5 Mon Sep 17 00:00:00 2001 From: sqlcoder Date: Wed, 9 Jun 2010 22:46:17 +0100 Subject: [PATCH 4/9] try to wrap long lines in config file, attributes are still sorted into alpha order :-( --- pyfpdb/Configuration.py | 30 +++++++++++++++++++++++++++++- pyfpdb/HUD_config.xml.example | 5 +++++ 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/pyfpdb/Configuration.py b/pyfpdb/Configuration.py index ee957e2d..4b5134af 100755 --- a/pyfpdb/Configuration.py +++ b/pyfpdb/Configuration.py @@ -32,6 +32,7 @@ import string import traceback import shutil import locale +import re import xml.dom.minidom from xml.dom.minidom import Node @@ -662,7 +663,34 @@ class Config: pass with open(file, 'w') as f: - self.doc.writexml(f) + #self.doc.writexml(f) + f.write( self.wrap_long_lines( self.doc.toxml() ) ) + + def wrap_long_lines(self, s): + lines = [ self.wrap_long_line(l) for l in s.splitlines() ] + return('\n'.join(lines) + '\n') + + def wrap_long_line(self, l): + if 'config_wrap_len' in self.general: + wrap_len = int(self.general['config_wrap_len']) + else: + wrap_len = -1 # < 0 means no wrap + + if wrap_len >= 0 and len(l) > wrap_len: + m = re.compile('\s+\S+\s+') + mo = m.match(l) + if mo: + indent_len = mo.end() + #print "indent = %s (%s)" % (indent_len, l[0:indent_len]) + indent = '\n' + ' ' * indent_len + m = re.compile('(\S+="[^"]+"\s+)') + parts = [x for x in m.split(l[indent_len:]) if x] + if len(parts) > 1: + #print "parts =", parts + l = l[0:indent_len] + indent.join(parts) + return(l) + else: + return(l) def edit_layout(self, site_name, max, width = None, height = None, fav_seat = None, locations = None): diff --git a/pyfpdb/HUD_config.xml.example b/pyfpdb/HUD_config.xml.example index 5a72c4c6..617a34d3 100644 --- a/pyfpdb/HUD_config.xml.example +++ b/pyfpdb/HUD_config.xml.example @@ -2,6 +2,11 @@ + + day_start="5" + /> + - day_start="5" + + diff --git a/pyfpdb/fpdb.pyw b/pyfpdb/fpdb.pyw index 0594a805..58a1b230 100755 --- a/pyfpdb/fpdb.pyw +++ b/pyfpdb/fpdb.pyw @@ -714,7 +714,7 @@ class fpdb: self.warning_box( "There is an error in your config file\n" + self.config.file + "\n\nError is: " + str(self.config.file_error) , diatitle="CONFIG FILE ERROR" ) - exit() + sys.exit() log = Configuration.get_logger("logging.conf", "fpdb", log_dir=self.config.dir_log) print "Logfile is " + os.path.join(self.config.dir_log, self.config.log_file) + "\n" @@ -905,7 +905,11 @@ This program is licensed under the AGPL3, see docs"""+os.sep+"agpl-3.0.txt") self.window.connect("destroy", self.destroy) self.window.set_title("Free Poker DB - v%s or higher" % (VERSION, )) self.window.set_border_width(1) - self.window.set_default_size(900,720) + defx, defy = 900, 720 + sx, sy = gtk.gdk.screen_width(), gtk.gdk.screen_height() + if sx < defx: defx = sx + if sy < defy: defy = sy + self.window.set_default_size(defx, defy) self.window.set_resizable(True) self.main_vbox = gtk.VBox(False, 1)