From 397ae8bbcd857582234923aea317d40cb5a52a30 Mon Sep 17 00:00:00 2001 From: sqlcoder Date: Sat, 5 Jun 2010 16:53:48 +0100 Subject: [PATCH 1/8] show site name in error message if match failed --- pyfpdb/Filters.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyfpdb/Filters.py b/pyfpdb/Filters.py index 15fccd1c..a5022508 100644 --- a/pyfpdb/Filters.py +++ b/pyfpdb/Filters.py @@ -88,7 +88,7 @@ class Filters(threading.Thread): if len(result) == 1: self.siteid[site] = result[0][0] else: - print "Either 0 or more than one site matched - EEK" + print "Either 0 or more than one site matched (%s) - EEK" % site # For use in date ranges. self.start_date = gtk.Entry(max=12) From 544a6828911e3caf7e78531ce60f0177c8a14487 Mon Sep 17 00:00:00 2001 From: sqlcoder Date: Sun, 6 Jun 2010 09:01:26 +0100 Subject: [PATCH 2/8] rename fpdb.py to fpdb.pyw makes it run smoother from .exe (no dos window) --- pyfpdb/{fpdb.py => fpdb.pyw} | 0 pyfpdb/py2exe_setup.py | 2 +- run_fpdb.bat | 2 +- 3 files changed, 2 insertions(+), 2 deletions(-) rename pyfpdb/{fpdb.py => fpdb.pyw} (100%) diff --git a/pyfpdb/fpdb.py b/pyfpdb/fpdb.pyw similarity index 100% rename from pyfpdb/fpdb.py rename to pyfpdb/fpdb.pyw diff --git a/pyfpdb/py2exe_setup.py b/pyfpdb/py2exe_setup.py index 0db53a40..b734f923 100644 --- a/pyfpdb/py2exe_setup.py +++ b/pyfpdb/py2exe_setup.py @@ -130,7 +130,7 @@ setup( description = 'Free Poker DataBase', version = '0.12', - console = [ {'script': 'fpdb.py', "icon_resources": [(1, "../gfx/fpdb_large_icon.ico")]}, + windows = [ {'script': 'fpdb.pyw', "icon_resources": [(1, "../gfx/fpdb_large_icon.ico")]}, {'script': 'HUD_main.py', }, {'script': 'Configuration.py', } ], diff --git a/run_fpdb.bat b/run_fpdb.bat index 98774aa0..4bd815b9 100755 --- a/run_fpdb.bat +++ b/run_fpdb.bat @@ -3,5 +3,5 @@ rem .bat script to run fpdb cd pyfpdb -fpdb.exe +start /b fpdb.exe >fpdb_output.txt From 9421f045dd2794c5b9ce7064eef7072e78b3c16f Mon Sep 17 00:00:00 2001 From: sqlcoder Date: Sun, 6 Jun 2010 09:29:46 +0100 Subject: [PATCH 3/8] put output file from .exe startup in higher directory --- run_fpdb.bat | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/run_fpdb.bat b/run_fpdb.bat index 4bd815b9..98cfefb3 100755 --- a/run_fpdb.bat +++ b/run_fpdb.bat @@ -3,5 +3,5 @@ rem .bat script to run fpdb cd pyfpdb -start /b fpdb.exe >fpdb_output.txt +start /b fpdb.exe >..\fpdb_output.txt From da203fbe6cf8e69c491256e451f32269ae6a9316 Mon Sep 17 00:00:00 2001 From: sqlcoder Date: Sun, 6 Jun 2010 10:57:51 +0100 Subject: [PATCH 4/8] debug and refine fpdb.pyw changes for .exe version --- pyfpdb/GuiAutoImport.py | 7 ++++++- pyfpdb/fpdb.py | 31 +++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 1 deletion(-) create mode 100755 pyfpdb/fpdb.py diff --git a/pyfpdb/GuiAutoImport.py b/pyfpdb/GuiAutoImport.py index b55c9ec1..ab471fe5 100755 --- a/pyfpdb/GuiAutoImport.py +++ b/pyfpdb/GuiAutoImport.py @@ -210,7 +210,12 @@ class GuiAutoImport (threading.Thread): print "opening pipe to HUD" self.pipe_to_hud = subprocess.Popen(command, bufsize=bs, stdin=subprocess.PIPE, - universal_newlines=True) + stdout=subprocess.PIPE, # only needed for py2exe + stderr=subprocess.PIPE, # only needed for py2exe + universal_newlines=True + ) + self.pipe_to_hud.stdout.close() + self.pipe_to_hud.stderr.close() except: err = traceback.extract_tb(sys.exc_info()[2])[-1] #self.addText( "\n*** GuiAutoImport Error opening pipe: " + err[2] + "(" + str(err[1]) + "): " + str(sys.exc_info()[1])) diff --git a/pyfpdb/fpdb.py b/pyfpdb/fpdb.py new file mode 100755 index 00000000..db9050c7 --- /dev/null +++ b/pyfpdb/fpdb.py @@ -0,0 +1,31 @@ +#!/usr/bin/python + +#Copyright 2008 Steffen Jobbagy-Felso +#This program is free software: you can redistribute it and/or modify +#it under the terms of the GNU Affero General Public License as published by +#the Free Software Foundation, version 3 of the License. +# +#This program is distributed in the hope that it will be useful, +#but WITHOUT ANY WARRANTY; without even the implied warranty of +#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +#GNU General Public License for more details. +# +#You should have received a copy of the GNU Affero General Public License +#along with this program. If not, see . +#In the "official" distribution you can find the license in +#agpl-3.0.txt in the docs folder of the package. + + +# Users should run fpdb.pyw now, this is included in case they still try to run fpdb.py + + +import os +import sys + + +#print "fpdb.py has now been renamed to fpdb.pyw - calling fpdb.pyw ...\n" +sys.stdout.write('fpdb.py has been renamed to fpdb.pyw - now calling fpdb.pyw ...\n\n') +sys.stdout.flush() + +os.execvpe('python.exe', ('python.exe', 'fpdb.pyw', '-r'), os.environ) +# first arg is ignored (name of program being run) From b7a7af37d54093f28946b21f3e028b774c66f167 Mon Sep 17 00:00:00 2001 From: sqlcoder Date: Sun, 6 Jun 2010 13:20:39 +0100 Subject: [PATCH 5/8] minor whitespace change --- pyfpdb/Database.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyfpdb/Database.py b/pyfpdb/Database.py index ce4e3f6f..01b78fe5 100644 --- a/pyfpdb/Database.py +++ b/pyfpdb/Database.py @@ -1056,7 +1056,7 @@ class Database: key = "`" + inner[j][0] + "_" + m.group() + "`" c.execute("ALTER TABLE " + inner[j][0] + " DROP FOREIGN KEY " + key) self.commit() - #end drop_referential_inegrity + #end drop_referential_inegrity def recreate_tables(self): """(Re-)creates the tables of the current DB""" From 1aafe79b4abf5c4dbcbb87bcaa1ad1e0406290ce Mon Sep 17 00:00:00 2001 From: sqlcoder Date: Sun, 6 Jun 2010 13:21:21 +0100 Subject: [PATCH 6/8] fix name of list indexes query --- pyfpdb/SQL.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pyfpdb/SQL.py b/pyfpdb/SQL.py index 37d214ff..ad8ea025 100644 --- a/pyfpdb/SQL.py +++ b/pyfpdb/SQL.py @@ -55,11 +55,11 @@ class Sql: # List indexes ################################ if db_server == 'mysql': - self.query['list_tables'] = """SHOW INDEXES""" + self.query['list_indexes'] = """SHOW INDEXES""" elif db_server == 'postgresql': - self.query['list_tables'] = """SELECT tablename, indexname FROM PG_INDEXES""" + self.query['list_indexes'] = """SELECT tablename, indexname FROM PG_INDEXES""" elif db_server == 'sqlite': - self.query['list_tables'] = """SELECT name FROM sqlite_master + self.query['list_indexes'] = """SELECT name FROM sqlite_master WHERE type='index' ORDER BY name;""" From 1c897e54d5403b6128b5690f8b8a27cef335bd32 Mon Sep 17 00:00:00 2001 From: sqlcoder Date: Sun, 6 Jun 2010 21:03:03 +0100 Subject: [PATCH 7/8] rename HUD_main from .py to .pyw as well --- pyfpdb/GuiAutoImport.py | 4 ++-- pyfpdb/{HUD_main.py => HUD_main.pyw} | 0 pyfpdb/py2exe_setup.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) rename pyfpdb/{HUD_main.py => HUD_main.pyw} (100%) diff --git a/pyfpdb/GuiAutoImport.py b/pyfpdb/GuiAutoImport.py index ab471fe5..4db85872 100755 --- a/pyfpdb/GuiAutoImport.py +++ b/pyfpdb/GuiAutoImport.py @@ -199,10 +199,10 @@ class GuiAutoImport (threading.Thread): bs = 0 elif os.name == 'nt': path = sys.path[0].replace('\\','\\\\') - command = 'python "'+path+'\\HUD_main.py" ' + self.settings['cl_options'] + command = 'pythonw "'+path+'\\HUD_main.pyw" ' + self.settings['cl_options'] bs = 0 else: - command = os.path.join(sys.path[0], 'HUD_main.py') + command = os.path.join(sys.path[0], 'HUD_main.pyw') command = [command, ] + string.split(self.settings['cl_options']) bs = 1 diff --git a/pyfpdb/HUD_main.py b/pyfpdb/HUD_main.pyw similarity index 100% rename from pyfpdb/HUD_main.py rename to pyfpdb/HUD_main.pyw diff --git a/pyfpdb/py2exe_setup.py b/pyfpdb/py2exe_setup.py index b734f923..15c834b5 100644 --- a/pyfpdb/py2exe_setup.py +++ b/pyfpdb/py2exe_setup.py @@ -131,7 +131,7 @@ setup( version = '0.12', windows = [ {'script': 'fpdb.pyw', "icon_resources": [(1, "../gfx/fpdb_large_icon.ico")]}, - {'script': 'HUD_main.py', }, + {'script': 'HUD_main.pyw', }, {'script': 'Configuration.py', } ], From 8e0fb785705acdbef54939a244ce95a01d96c1ce Mon Sep 17 00:00:00 2001 From: sqlcoder Date: Mon, 7 Jun 2010 19:29:59 +0100 Subject: [PATCH 8/8] further refinements to .py -> .pyw and python -> pythonw change --- pyfpdb/fpdb.py | 2 +- run_fpdb.py | 9 +++------ 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/pyfpdb/fpdb.py b/pyfpdb/fpdb.py index db9050c7..37491505 100755 --- a/pyfpdb/fpdb.py +++ b/pyfpdb/fpdb.py @@ -27,5 +27,5 @@ import sys sys.stdout.write('fpdb.py has been renamed to fpdb.pyw - now calling fpdb.pyw ...\n\n') sys.stdout.flush() -os.execvpe('python.exe', ('python.exe', 'fpdb.pyw', '-r'), os.environ) +os.execvpe('pythonw.exe', ('pythonw.exe', 'fpdb.pyw', '-r'), os.environ) # first arg is ignored (name of program being run) diff --git a/run_fpdb.py b/run_fpdb.py index 570b7dc5..e77d789f 100644 --- a/run_fpdb.py +++ b/run_fpdb.py @@ -21,13 +21,10 @@ import sys # sys.path[0] holds the directory run_fpdb.py is in sys.path[0] = sys.path[0]+os.sep+"pyfpdb" +# cd to pyfpdb subdir os.chdir(sys.path[0]) #print "sys.path[0] =", sys.path[0], "cwd =", os.getcwd() -import fpdb - -if __name__ == "__main__": - me = fpdb.fpdb() - me.main() - exit() +os.execvpe('pythonw.exe', ('pythonw.exe', 'fpdb.pyw', '-r'), os.environ) +# first arg is ignored (name of program being run)