From 03f89ee439a105793a28e2b00808cc157fa56e70 Mon Sep 17 00:00:00 2001 From: Matt Turnbull Date: Mon, 23 Feb 2009 01:03:18 +0000 Subject: [PATCH 01/20] for some reason my GuiBulkImport was missing get_vbox() Added a combobox for selecting a filter But import brokea bit --- pyfpdb/GuiBulkImport.py | 45 ++++++++++++++++++++++++----------------- 1 file changed, 26 insertions(+), 19 deletions(-) diff --git a/pyfpdb/GuiBulkImport.py b/pyfpdb/GuiBulkImport.py index b5e87755..376ceb47 100755 --- a/pyfpdb/GuiBulkImport.py +++ b/pyfpdb/GuiBulkImport.py @@ -35,17 +35,6 @@ import Configuration class GuiBulkImport(): - def import_dir(self): - """imports a directory, non-recursive. todo: move this to fpdb_import so CLI can use it""" - - self.path = self.inputFile - self.importer.addImportDirectory(self.path) - self.importer.setCallHud(False) - starttime = time() - (stored, dups, partial, errs, ttime) = self.importer.runImport() - print 'GuiBulkImport.import_dir done: Stored: %d Duplicates: %d Partial: %d Errors: %d in %s seconds - %d/sec'\ - % (stored, dups, partial, errs, ttime, stored / ttime) - def load_clicked(self, widget, data=None): # get the dir to import from the chooser self.inputFile = self.chooser.get_filename() @@ -63,18 +52,22 @@ class GuiBulkImport(): self.importer.setDropIndexes(cb_model[cb_index][0]) else: self.importer.setDropIndexes("auto") - + hhc=self.cbfilter.get_model()[self.cbfilter.get_active()][0] self.lab_info.set_text("Importing") - if os.path.isdir(self.inputFile): - self.import_dir() - else: - self.importer.addImportFile(self.inputFile) - self.importer.setCallHud(False) - self.importer.runImport() - self.importer.clearFileList() + + self.importer.addImportFile(self.inputFile,filter=hhc) + self.importer.setCallHud(False) + starttime = time() + (stored, dups, partial, errs, ttime) = self.importer.runImport() + print 'GuiBulkImport.import_dir done: Stored: %d Duplicates: %d Partial: %d Errors: %d in %s seconds - %d/sec'\ + % (stored, dups, partial, errs, ttime, stored / ttime) + self.importer.clearFileList() self.lab_info.set_text("Import finished") + def get_vbox(self): + return self.vbox + def __init__(self, db, settings, config): self.db = db # this is an instance of fpdb_db self.settings = settings @@ -159,6 +152,20 @@ class GuiBulkImport(): self.table.attach(self.cb, 4, 5, 1, 2, xpadding = 10, ypadding = 0, yoptions=gtk.SHRINK) self.cb.show() +# label - filter + self.lab_filter = gtk.Label("Site filter:") + self.table.attach(self.lab_filter, 2, 3, 2, 3, xpadding = 0, ypadding = 0, yoptions=gtk.SHRINK) + self.lab_filter.show() + self.lab_filter.set_justify(gtk.JUSTIFY_RIGHT) + +# ComboBox - filter + self.cbfilter = gtk.combo_box_new_text() + self.cbfilter.append_text("passthrough") + self.cbfilter.append_text("Everleaf") + self.cbfilter.set_active(0) + self.table.attach(self.cbfilter, 3, 4, 2, 3, xpadding = 10, ypadding = 0, yoptions=gtk.SHRINK) + self.cbfilter.show() + # label - info self.lab_info = gtk.Label() self.table.attach(self.lab_info, 0, 4, 2, 3, xpadding = 0, ypadding = 0, yoptions=gtk.SHRINK) From bca9fb15cf5371232b82b4e1ab9c29e445ba06d9 Mon Sep 17 00:00:00 2001 From: Worros Date: Tue, 24 Feb 2009 22:46:05 +0900 Subject: [PATCH 02/20] Note in code re: os.walk --- pyfpdb/fpdb_import.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pyfpdb/fpdb_import.py b/pyfpdb/fpdb_import.py index aeb1e027..cdfee353 100644 --- a/pyfpdb/fpdb_import.py +++ b/pyfpdb/fpdb_import.py @@ -118,6 +118,8 @@ class Importer: #dirlist is a hash of lists: #dirlist{ 'PokerStars' => ["/path/to/import/", "filtername"] } def addImportDirectory(self,dir,monitor = False, site = "default", filter = "passthrough"): + #This should really be using os.walk + #http://docs.python.org/library/os.html if os.path.isdir(dir): if monitor == True: self.monitor = True From c535dc7f247b4821e19040b535f748b94b9b8dba Mon Sep 17 00:00:00 2001 From: Ray Date: Tue, 24 Feb 2009 10:54:02 -0500 Subject: [PATCH 03/20] Cleaner intermediate print during autoimport. --- pyfpdb/GuiAutoImport.py | 3 ++- pyfpdb/fpdb_import.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/pyfpdb/GuiAutoImport.py b/pyfpdb/GuiAutoImport.py index ceb3da0d..eccba8cd 100644 --- a/pyfpdb/GuiAutoImport.py +++ b/pyfpdb/GuiAutoImport.py @@ -106,7 +106,8 @@ class GuiAutoImport (threading.Thread): """Callback for timer to do an import iteration.""" if self.doAutoImportBool: self.importer.runUpdated() - print "GuiAutoImport.import_dir done" + sys.stdout.write(".") + sys.stdout.flush() return True else: return False diff --git a/pyfpdb/fpdb_import.py b/pyfpdb/fpdb_import.py index 220abe3c..258aa238 100644 --- a/pyfpdb/fpdb_import.py +++ b/pyfpdb/fpdb_import.py @@ -320,7 +320,7 @@ class Importer: sys.exit(0) startpos=endpos ttime = time() - starttime - print "Total stored:", stored, "duplicates:", duplicates, "partial:", partial, "errors:", errors, " time:", ttime + print "\rTotal stored:", stored, "duplicates:", duplicates, "partial:", partial, "errors:", errors, " time:", ttime if stored==0: if duplicates>0: From b38c62367ae4f91d2b336e55ff469503fa663787 Mon Sep 17 00:00:00 2001 From: Worros Date: Wed, 25 Feb 2009 01:17:25 +0900 Subject: [PATCH 04/20] Preliminary razz support for Fulltilt Breaks stuff --- pyfpdb/FulltiltToFpdb.py | 35 +++++++++++++++++++++++++++------- pyfpdb/Hand.py | 3 +++ pyfpdb/HandHistoryConverter.py | 25 +++++++++++++++++++----- 3 files changed, 51 insertions(+), 12 deletions(-) diff --git a/pyfpdb/FulltiltToFpdb.py b/pyfpdb/FulltiltToFpdb.py index ef50c518..ecaab23a 100755 --- a/pyfpdb/FulltiltToFpdb.py +++ b/pyfpdb/FulltiltToFpdb.py @@ -28,10 +28,9 @@ class FullTilt(HandHistoryConverter): HandHistoryConverter.__init__(self, config, file, sitename="FullTilt") # Call super class init. self.sitename = "FullTilt" self.setFileType("text", "cp1252") - - self.re_GameInfo = re.compile('- \$?(?P[.0-9]+)/\$?(?P[.0-9]+) - (?P(No|Pot)) Limit (?P(Hold\'em|Omaha))') + self.re_GameInfo = re.compile('- \$?(?P[.0-9]+)/\$?(?P[.0-9]+) (Ante \$(?P[.0-9]+) )?- (?P(No|Pot)? )?Limit (?P(Hold\'em|Omaha|Razz))') self.re_SplitHands = re.compile(r"\n\n+") - self.re_HandInfo = re.compile('.*#(?P[0-9]+): Table (?P[- a-zA-Z]+) (\((?P.+)\) )?- \$?(?P[.0-9]+)/\$?(?P[.0-9]+) - (?P[a-zA-Z\' ]+) - (?P.*)') + self.re_HandInfo = re.compile('.*#(?P[0-9]+): Table (?P
[- a-zA-Z]+) (\((?P.+)\) )?- \$?(?P[.0-9]+)/\$?(?P[.0-9]+) (Ante \$(?P[.0-9]+) )?- (?P[a-zA-Z\' ]+) - (?P.*)') self.re_Button = re.compile('The button is in seat #(?P
[- a-zA-Z]+)") + re_Button = re.compile(r"^Seat (?P
[- a-zA-Z]+)\nSeat (?P
[- a-zA-Z]+) (\((?P.+)\) )?- \$?(?P[.0-9]+)/\$?(?P[.0-9]+) (Ante \$(?P[.0-9]+) )?- (?P[a-zA-Z\' ]+) - (?P.*)') + re_Button = re.compile('^The button is in seat #(?P
[- a-zA-Z]+) (\((?P.+)\) )?- \$?(?P[.0-9]+)/\$?(?P[.0-9]+) (Ante \$(?P[.0-9]+) )?- (?P[a-zA-Z\' ]+) - (?P.*)') - self.re_Button = re.compile('The button is in seat #(?P
[- a-zA-Z]+) (\((?P.+)\) )?- \$?(?P[.0-9]+)/\$?(?P[.0-9]+) (Ante \$(?P[.0-9]+) )?- (?P[a-zA-Z\' ]+) - (?P.*)') - re_Button = re.compile('^The button is in seat #(?P