From be0cb6fc2abebc5cb787c01dc1409d0420632291 Mon Sep 17 00:00:00 2001 From: Worros Date: Tue, 15 Dec 2009 22:56:18 +0800 Subject: [PATCH 1/9] Fix a couple of typos --- pyfpdb/fpdb_db.py | 2 +- pyfpdb/fpdb_import.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pyfpdb/fpdb_db.py b/pyfpdb/fpdb_db.py index baabb4bf..2d7f2e0c 100644 --- a/pyfpdb/fpdb_db.py +++ b/pyfpdb/fpdb_db.py @@ -158,7 +158,7 @@ class fpdb_db: if not os.path.isdir(Configuration.DIR_DATABASES) and not database == ":memory:": print "Creating directory: '%s'" % (Configuration.DIR_DATABASES) os.mkdir(Configuration.DIR_DATABASES) - database = os.path.join(Configuration.DIR_DATABASE, database) + database = os.path.join(Configuration.DIR_DATABASES, database) self.db = sqlite3.connect(database, detect_types=sqlite3.PARSE_DECLTYPES ) sqlite3.register_converter("bool", lambda x: bool(int(x))) sqlite3.register_adapter(bool, lambda x: "1" if x else "0") diff --git a/pyfpdb/fpdb_import.py b/pyfpdb/fpdb_import.py index ca321de1..dd46d7c6 100644 --- a/pyfpdb/fpdb_import.py +++ b/pyfpdb/fpdb_import.py @@ -440,8 +440,8 @@ class Importer: if self.callHud and hand.dbid_hands != 0: #print "DEBUG: call to HUD: handsId: %s" % hand.dbid_hands #pipe the Hands.id out to the HUD - print "fpdb_import: sending hand to hud", handsId, "pipe =", self.caller.pipe_to_hud - #self.caller.pipe_to_hud.stdin.write("%s" % (hand.dbid_hands) + os.linesep) + print "fpdb_import: sending hand to hud", hand.dbid_hands, "pipe =", self.caller.pipe_to_hud + self.caller.pipe_to_hud.stdin.write("%s" % (hand.dbid_hands) + os.linesep) errors = getattr(hhc, 'numErrors') stored = getattr(hhc, 'numHands') From 1d531965684b305d2528a9d7c55795bae7d75238 Mon Sep 17 00:00:00 2001 From: Worros Date: Wed, 16 Dec 2009 20:04:10 +0800 Subject: [PATCH 2/9] Fix loal variable scope bug Never have been quite sure of local variable scope using python indentation, this didn't appear to affect anyone until a poster on 2+2 --- pyfpdb/Filters.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyfpdb/Filters.py b/pyfpdb/Filters.py index c74d5579..dc2e4859 100644 --- a/pyfpdb/Filters.py +++ b/pyfpdb/Filters.py @@ -479,7 +479,8 @@ class Filters(threading.Thread): self.cursor.execute(self.sql.query['getLimits2']) # selects limitType, bigBlind result = self.db.cursor.fetchall() - fl, nl = False, False + found = {'nl':False, 'fl':False, 'ring':False, 'tour':False} + if len(result) >= 1: hbox = gtk.HBox(True, 0) vbox1.pack_start(hbox, False, False, 0) @@ -487,7 +488,6 @@ class Filters(threading.Thread): hbox.pack_start(vbox2, False, False, 0) vbox3 = gtk.VBox(False, 0) hbox.pack_start(vbox3, False, False, 0) - found = {'nl':False, 'fl':False, 'ring':False, 'tour':False} for i, line in enumerate(result): if "UseType" in self.display: if line[0] != self.display["UseType"]: From 353fec235f00c036b1b0bf23e8f28919b16ed6c6 Mon Sep 17 00:00:00 2001 From: Worros Date: Wed, 16 Dec 2009 22:41:48 +0800 Subject: [PATCH 3/9] [NEWIMPORT] Convert start stack to cents --- pyfpdb/DerivedStats.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyfpdb/DerivedStats.py b/pyfpdb/DerivedStats.py index 1064a600..aaaea60a 100644 --- a/pyfpdb/DerivedStats.py +++ b/pyfpdb/DerivedStats.py @@ -135,7 +135,7 @@ class DerivedStats(): #hand.players = [[seat, name, chips],[seat, name, chips]] for player in hand.players: self.handsplayers[player[1]]['seatNo'] = player[0] - self.handsplayers[player[1]]['startCash'] = player[2] + self.handsplayers[player[1]]['startCash'] = int(100 * player[2]) for i, street in enumerate(hand.actionStreets[2:]): self.seen(self.hand, i+1) From c50addf8679b347a2aa08448328d39a6ba2b86f0 Mon Sep 17 00:00:00 2001 From: Worros Date: Wed, 16 Dec 2009 22:48:38 +0800 Subject: [PATCH 4/9] [NEWIMPORT] Fix startCash fix --- pyfpdb/DerivedStats.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pyfpdb/DerivedStats.py b/pyfpdb/DerivedStats.py index aaaea60a..c6216306 100644 --- a/pyfpdb/DerivedStats.py +++ b/pyfpdb/DerivedStats.py @@ -17,6 +17,7 @@ #fpdb modules import Card +from decimal import Decimal DEBUG = False @@ -135,7 +136,7 @@ class DerivedStats(): #hand.players = [[seat, name, chips],[seat, name, chips]] for player in hand.players: self.handsplayers[player[1]]['seatNo'] = player[0] - self.handsplayers[player[1]]['startCash'] = int(100 * player[2]) + self.handsplayers[player[1]]['startCash'] = int(100 * Decimal(player[2])) for i, street in enumerate(hand.actionStreets[2:]): self.seen(self.hand, i+1) From 52d1ce1402e6e4a1b11dd857586e76c4ba15ec4d Mon Sep 17 00:00:00 2001 From: Worros Date: Wed, 16 Dec 2009 22:58:54 +0800 Subject: [PATCH 5/9] [NEWIMPOR] Fix insert type for wonAtSD --- pyfpdb/DerivedStats.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyfpdb/DerivedStats.py b/pyfpdb/DerivedStats.py index c6216306..88d8b452 100644 --- a/pyfpdb/DerivedStats.py +++ b/pyfpdb/DerivedStats.py @@ -46,7 +46,7 @@ class DerivedStats(): self.handsplayers[player[1]]['street4Aggr'] = False self.handsplayers[player[1]]['wonWhenSeenStreet1'] = False self.handsplayers[player[1]]['sawShowdown'] = False - self.handsplayers[player[1]]['wonAtSD'] = False + self.handsplayers[player[1]]['wonAtSD'] = 0.0 for i in range(5): self.handsplayers[player[1]]['street%dCalls' % i] = 0 self.handsplayers[player[1]]['street%dBets' % i] = 0 @@ -158,7 +158,7 @@ class DerivedStats(): if self.handsplayers[player]['street1Seen'] == True: self.handsplayers[player]['wonWhenSeenStreet1'] = True if self.handsplayers[player]['sawShowdown'] == True: - self.handsplayers[player]['wonAtSD'] = True + self.handsplayers[player]['wonAtSD'] = 1.0 for player in hand.pot.committed: self.handsplayers[player]['totalProfit'] = int(self.handsplayers[player]['winnings'] - (100*hand.pot.committed[player])) From 826ca4b2c7fa4d607ad431fbdfec52463f64936a Mon Sep 17 00:00:00 2001 From: Worros Date: Wed, 16 Dec 2009 23:11:08 +0800 Subject: [PATCH 6/9] [NEWIMPORT] 'correct' the type for wonWhenSeenStreet1 --- pyfpdb/DerivedStats.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyfpdb/DerivedStats.py b/pyfpdb/DerivedStats.py index 88d8b452..1a34db1e 100644 --- a/pyfpdb/DerivedStats.py +++ b/pyfpdb/DerivedStats.py @@ -44,7 +44,7 @@ class DerivedStats(): self.handsplayers[player[1]]['totalProfit'] = 0 self.handsplayers[player[1]]['street4Seen'] = False self.handsplayers[player[1]]['street4Aggr'] = False - self.handsplayers[player[1]]['wonWhenSeenStreet1'] = False + self.handsplayers[player[1]]['wonWhenSeenStreet1'] = 0.0 self.handsplayers[player[1]]['sawShowdown'] = False self.handsplayers[player[1]]['wonAtSD'] = 0.0 for i in range(5): @@ -156,7 +156,7 @@ class DerivedStats(): # Should be fine for split-pots, but won't be accurate for multi-way pots self.handsplayers[player]['rake'] = int(100* hand.rake)/len(hand.collectees) if self.handsplayers[player]['street1Seen'] == True: - self.handsplayers[player]['wonWhenSeenStreet1'] = True + self.handsplayers[player]['wonWhenSeenStreet1'] = 1.0 if self.handsplayers[player]['sawShowdown'] == True: self.handsplayers[player]['wonAtSD'] = 1.0 From 5c0323c842bcc0034c4d9d569d0e40eef04a867a Mon Sep 17 00:00:00 2001 From: Worros Date: Thu, 17 Dec 2009 00:12:53 +0800 Subject: [PATCH 7/9] Add PartyPoker 10 seat hud layout to example file --- pyfpdb/HUD_config.xml.example | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/pyfpdb/HUD_config.xml.example b/pyfpdb/HUD_config.xml.example index b0f26c53..b1ebd761 100644 --- a/pyfpdb/HUD_config.xml.example +++ b/pyfpdb/HUD_config.xml.example @@ -387,6 +387,18 @@ Left-Drag to Move" + + + + + + + + + + + + From 80c324c8e15d4da5de39b734ea8549fff7a70047 Mon Sep 17 00:00:00 2001 From: Worros Date: Thu, 17 Dec 2009 00:40:36 +0800 Subject: [PATCH 8/9] [NEWIMPORT] Add a commit at the end of the fpdb_import cycle --- pyfpdb/fpdb_import.py | 1 + 1 file changed, 1 insertion(+) diff --git a/pyfpdb/fpdb_import.py b/pyfpdb/fpdb_import.py index dd46d7c6..3fc35339 100644 --- a/pyfpdb/fpdb_import.py +++ b/pyfpdb/fpdb_import.py @@ -442,6 +442,7 @@ class Importer: #pipe the Hands.id out to the HUD print "fpdb_import: sending hand to hud", hand.dbid_hands, "pipe =", self.caller.pipe_to_hud self.caller.pipe_to_hud.stdin.write("%s" % (hand.dbid_hands) + os.linesep) + self.database.commit() errors = getattr(hhc, 'numErrors') stored = getattr(hhc, 'numHands') From 1f70a9ad8a4d2381b2f71564b3f48836f9f0b4ce Mon Sep 17 00:00:00 2001 From: Worros Date: Thu, 17 Dec 2009 01:55:48 +0800 Subject: [PATCH 9/9] [NEWIMPORT] Fix thinko on insertPlayer Was returning the player name instead of id in the case where the player exists in the database, but wasn't cached already Removing some merge gunge too --- pyfpdb/Database.py | 6 ++++-- pyfpdb/SQL.py | 2 -- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pyfpdb/Database.py b/pyfpdb/Database.py index c5cd156a..9d1f3f85 100644 --- a/pyfpdb/Database.py +++ b/pyfpdb/Database.py @@ -1867,8 +1867,10 @@ class Database: ,(name, site_id)) #Get last id might be faster here. #c.execute ("SELECT id FROM Players WHERE name=%s", (name,)) - tmp = [self.get_last_insert_id(c)] - return tmp[0] + result = self.get_last_insert_id(c) + else: + result = tmp[1] + return result def insertGameTypes(self, row): c = self.get_cursor() diff --git a/pyfpdb/SQL.py b/pyfpdb/SQL.py index 73d380c0..c0319dfe 100644 --- a/pyfpdb/SQL.py +++ b/pyfpdb/SQL.py @@ -2789,8 +2789,6 @@ class Sql: ,hp.tourneyTypeId ,date_format(h.handStart, 'd%y%m%d') """ -#>>>>>>> 28ca49d592c8e706ad6ee58dd26655bcc33fc5fb:pyfpdb/SQL.py -#""" elif db_server == 'postgresql': self.query['rebuildHudCache'] = """ INSERT INTO HudCache