p65 - fixed minor bugs in the various calls to fpdb_import

bulk import works on single files again
table viewer works again
fixed CLI import
This commit is contained in:
steffen123
2008-08-22 20:32:20 +01:00
parent 6879815320
commit 76448ce06f
5 changed files with 15 additions and 16 deletions
+1 -1
View File
@@ -69,7 +69,7 @@ class GuiBulkImport (threading.Thread):
if os.path.isdir(self.inputFile):
self.import_dir()
else:
fpdb_import.import_file_dict(self)
fpdb_import.import_file_dict(self, self.settings)
def get_vbox(self):
"""returns the vbox of this thread"""
+2 -6
View File
@@ -201,13 +201,9 @@ class GuiTableViewer (threading.Thread):
def read_names_clicked(self, widget, data):
"""runs when user clicks read names"""
#print "start of table_viewer.read_names_clicked"
#print "self.last_read_hand:",self.last_read_hand
self.db.reconnect()
self.cursor=self.db.cursor
self.cursor.execute("""SELECT id FROM Hands WHERE siteHandNo=%s""", (self.last_read_hand))
hands_id_tmp=self.db.cursor.fetchone()
#print "tmp:",hands_id_tmp
self.hands_id=hands_id_tmp[0]
self.hands_id=self.last_read_hand_id
self.db.cursor.execute("SELECT gametypeId FROM Hands WHERE id=%s", (self.hands_id, ))
self.gametype_id=self.db.cursor.fetchone()[0]
@@ -243,7 +239,7 @@ class GuiTableViewer (threading.Thread):
self.minPrint=0
self.handCount=0
self.last_read_hand=fpdb_import.import_file_dict(self, self.settings)
self.last_read_hand_id=fpdb_import.import_file_dict(self, self.settings, False)
#end def table_viewer.import_clicked
def all_clicked(self, widget, data):
+1 -1
View File
@@ -376,7 +376,7 @@ This program is licensed under the AGPL3, see docs"""+os.sep+"agpl-3.0.txt")
self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
self.window.connect("delete_event", self.delete_event)
self.window.connect("destroy", self.destroy)
self.window.set_title("Free Poker DB - version: alpha1+, p57")
self.window.set_title("Free Poker DB - version: alpha1+, p65")
self.window.set_border_width(1)
self.window.set_size_request(1020,400)
self.window.set_resizable(True)
+5 -4
View File
@@ -37,7 +37,7 @@ def import_file(server, database, user, password, inputFile):
self.settings={'imp-callFpdbHud':False}
import_file_dict(self, settings)
def import_file_dict(options, settings):
def import_file_dict(options, settings, callHud=True):
last_read_hand=0
if (options.inputFile=="stdin"):
inputFile=sys.stdin
@@ -106,7 +106,7 @@ def import_file_dict(options, settings):
db.commit()
stored+=1
if settings['imp-callFpdbHud']:
if settings['imp-callFpdbHud'] and callHud:
print "call to HUD here. handsId:",handsId
# pipe the Hands.id out to the HUD
options.pipe_to_hud.stdin.write("%s\n" % (handsId))
@@ -192,5 +192,6 @@ if __name__ == "__main__":
help="If this option is passed it quits when it encounters any error")
(options, sys.argv) = parser.parse_args()
import_file_dict(options)
settings={'imp-callFpdbHud':False}
import_file_dict(options, settings, False)