From 683190a2616942877eae94c03c62c908bf43d39d Mon Sep 17 00:00:00 2001 From: Ray Date: Mon, 6 Apr 2009 10:34:14 -0400 Subject: [PATCH 1/8] Updated example config to work with recent code changes. --- pyfpdb/HUD_config.xml.example | 117 +++++++++++++++++++++++++++++----- 1 file changed, 102 insertions(+), 15 deletions(-) diff --git a/pyfpdb/HUD_config.xml.example b/pyfpdb/HUD_config.xml.example index e300e67b..96a1931d 100644 --- a/pyfpdb/HUD_config.xml.example +++ b/pyfpdb/HUD_config.xml.example @@ -1,8 +1,25 @@ + + + - + + @@ -49,7 +66,21 @@ - + + @@ -84,7 +115,16 @@ - + + @@ -120,8 +160,10 @@ + - + + @@ -129,7 +171,8 @@ - + + @@ -137,7 +180,8 @@ - + + @@ -145,7 +189,8 @@ - + + @@ -153,7 +198,8 @@ - + + @@ -161,7 +207,8 @@ - + + @@ -170,6 +217,7 @@ + @@ -196,15 +244,54 @@ - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - + From cd2b2aaf42057bfba781568d95b636d10cd9df45 Mon Sep 17 00:00:00 2001 From: Ray Date: Mon, 6 Apr 2009 11:03:51 -0400 Subject: [PATCH 2/8] Comment out some intermediate print. --- pyfpdb/Hud.py | 6 +++--- pyfpdb/Mucked.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pyfpdb/Hud.py b/pyfpdb/Hud.py index 15145095..3646c6c9 100644 --- a/pyfpdb/Hud.py +++ b/pyfpdb/Hud.py @@ -204,14 +204,14 @@ class Hud: def reposition_windows(self, *args): for w in self.stat_windows.itervalues(): if type(w) == int: - print "in reposition, w =", w +# print "in reposition, w =", w continue - print "in reposition, w =", w, w.x, w.y +# print "in reposition, w =", w, w.x, w.y w.window.move(w.x, w.y) return True def debug_stat_windows(self, *args): - print self.table, "\n", self.main_window.window.get_transient_for() +# print self.table, "\n", self.main_window.window.get_transient_for() for w in self.stat_windows: print self.stat_windows[w].window.window.get_transient_for() diff --git a/pyfpdb/Mucked.py b/pyfpdb/Mucked.py index 9d70f8e3..93f6d102 100755 --- a/pyfpdb/Mucked.py +++ b/pyfpdb/Mucked.py @@ -451,7 +451,7 @@ class Flop_Mucked(Aux_Window): def save_layout(self, *args): """Save new layout back to the aux element in the config file.""" new_locs = {} - print "adj =", self.adj +# print "adj =", self.adj for (i, pos) in self.positions.iteritems(): if i != 'common': new_locs[self.adj[int(i)]] = (pos[0] - self.hud.table.x, pos[1] - self.hud.table.y) From 87efd2cc8d57d89074b6f4d6e9cc42e8dcf430b6 Mon Sep 17 00:00:00 2001 From: Ray Date: Mon, 6 Apr 2009 23:40:06 -0400 Subject: [PATCH 3/8] Minor edits in HUD_config.xml.example. --- pyfpdb/HUD_config.xml.example | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyfpdb/HUD_config.xml.example b/pyfpdb/HUD_config.xml.example index 96a1931d..e21f342a 100644 --- a/pyfpdb/HUD_config.xml.example +++ b/pyfpdb/HUD_config.xml.example @@ -69,10 +69,10 @@ Date: Mon, 6 Apr 2009 23:42:36 -0400 Subject: [PATCH 4/8] Fix regression in naming HUDs that caused inconsistent killing. --- pyfpdb/HUD_main.py | 3 +-- pyfpdb/Hud.py | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/pyfpdb/HUD_main.py b/pyfpdb/HUD_main.py index 332e33c8..39d190a8 100755 --- a/pyfpdb/HUD_main.py +++ b/pyfpdb/HUD_main.py @@ -108,9 +108,9 @@ class HUD_main(object): gtk.gdk.threads_leave() self.hud_dict[table_name] = Hud.Hud(self, table, max, poker_game, self.config, self.db_connection) + self.hud_dict[table_name].table_name = table_name self.hud_dict[table_name].stat_dict = stat_dict self.hud_dict[table_name].cards = cards - [aw.update_data(new_hand_id, self.db_connection) for aw in self.hud_dict[table_name].aux_windows] gobject.idle_add(idle_func) @@ -184,7 +184,6 @@ class HUD_main(object): tablewindow = Tables.discover_tournament_table(self.config, tour_number, tab_number) else: tablewindow = Tables.discover_table_by_name(self.config, table_name) - if tablewindow == None: # If no client window is found on the screen, complain and continue if is_tournament: diff --git a/pyfpdb/Hud.py b/pyfpdb/Hud.py index 3646c6c9..363175a1 100644 --- a/pyfpdb/Hud.py +++ b/pyfpdb/Hud.py @@ -125,7 +125,7 @@ class Hud: self.menu = gtk.Menu() self.item1 = gtk.MenuItem('Kill this HUD') self.menu.append(self.item1) - self.item1.connect("activate", self.parent.kill_hud, self.table.name) + self.item1.connect("activate", self.parent.kill_hud, self.table_name) self.item1.show() self.item2 = gtk.MenuItem('Save Layout') From a2862c9712ddbd1d84b4541608841952790e4950 Mon Sep 17 00:00:00 2001 From: Ray Date: Mon, 6 Apr 2009 23:45:56 -0400 Subject: [PATCH 5/8] Minor change to allow proper detection of FTP tables. --- pyfpdb/Tables.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyfpdb/Tables.py b/pyfpdb/Tables.py index ffc50b01..58da2690 100755 --- a/pyfpdb/Tables.py +++ b/pyfpdb/Tables.py @@ -135,7 +135,7 @@ def discover_posix(c): if re.search(params['table_finder'], listing): if 'Lobby' in listing: continue if 'Instant Hand History' in listing: continue - if '\"Full Tilt Poker\"' in listing: continue +# if '\"Full Tilt Poker\"' in listing: continue if 'History for table:' in listing: continue if 'has no name' in listing: continue info = decode_xwininfo(c, listing) @@ -387,7 +387,7 @@ def discover_mac_by_name(c, tablename): if __name__=="__main__": c = Configuration.Config() - print discover_table_by_name(c, "Ringe") + print discover_table_by_name(c, "Torino") # print discover_tournament_table(c, "118942908", "3") tables = discover(c) From 460102c3f512259db3c81eee412ca5f451147b33 Mon Sep 17 00:00:00 2001 From: Ray Date: Tue, 7 Apr 2009 10:44:06 -0400 Subject: [PATCH 6/8] Version 0.11 --- pyfpdb/fpdb.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyfpdb/fpdb.py b/pyfpdb/fpdb.py index 0f0f3bf3..49b3ad82 100755 --- a/pyfpdb/fpdb.py +++ b/pyfpdb/fpdb.py @@ -47,7 +47,7 @@ import GuiGraphViewer import FpdbSQLQueries import Configuration -VERSION = "0.10" +VERSION = "0.11" class fpdb: def tab_clicked(self, widget, tab_name): From fdabe29ea23659258f7ad091478e6b92eeb3ceb9 Mon Sep 17 00:00:00 2001 From: Ray Date: Wed, 8 Apr 2009 16:43:40 -0400 Subject: [PATCH 7/8] Fix stats aggregation and simplify HUD_main.py. --- pyfpdb/HUD_main.py | 32 ++++++++++++++++++-------------- pyfpdb/SQL.py | 2 +- 2 files changed, 19 insertions(+), 15 deletions(-) diff --git a/pyfpdb/HUD_main.py b/pyfpdb/HUD_main.py index 39d190a8..4501821a 100755 --- a/pyfpdb/HUD_main.py +++ b/pyfpdb/HUD_main.py @@ -51,6 +51,8 @@ import Database import Tables import Hud +aggregate_stats = {"ring": False, "tour": False} # config file! + class HUD_main(object): """A main() object to own both the read_stdin thread and the gui.""" # This class mainly provides state for controlling the multiple HUDs. @@ -85,7 +87,7 @@ class HUD_main(object): del(self.hud_dict[table]) self.main_window.resize(1,1) - def create_HUD(self, new_hand_id, table, table_name, max, poker_game, is_tournament, stat_dict, cards): + def create_HUD(self, new_hand_id, table, table_name, max, poker_game, stat_dict, cards): def idle_func(): @@ -149,8 +151,8 @@ class HUD_main(object): # get basic info about the new hand from the db # if there is a db error, complain, skip hand, and proceed try: - (table_name, max, poker_game) = self.db_connection.get_table_name(new_hand_id) - stat_dict = self.db_connection.get_stats_from_hand(new_hand_id) + (table_name, max, poker_game, type) = self.db_connection.get_table_name(new_hand_id) + stat_dict = self.db_connection.get_stats_from_hand(new_hand_id, aggregate = aggregate_stats[type]) cards = self.db_connection.get_cards(new_hand_id) comm_cards = self.db_connection.get_common_cards(new_hand_id) if comm_cards != {}: # stud! @@ -160,15 +162,17 @@ class HUD_main(object): sys.stderr.write("Database error %s in hand %d. Skipping.\n" % (err, int(new_hand_id))) continue -# find out if this hand is from a tournament - mat_obj = tourny_finder.search(table_name) - if mat_obj: - is_tournament = True - (tour_number, tab_number) = mat_obj.group(1, 2) - temp_key = tour_number + if type == "tour": # hand is from a tournament + mat_obj = tourny_finder.search(table_name) + if mat_obj: + (tour_number, tab_number) = mat_obj.group(1, 2) + temp_key = tour_number + else: # tourney, but can't get number and table + print "could not find tournamtne: skipping " + sys.stderr.write("Could not find tournament %d in hand %d. Skipping.\n" % (int(tour_number), int(new_hand_id))) + continue + else: - is_tournament = False - (tour_number, tab_number) = (0, 0) temp_key = table_name # Update an existing HUD @@ -180,17 +184,17 @@ class HUD_main(object): # Or create a new HUD else: - if is_tournament: + if type == "tour": tablewindow = Tables.discover_tournament_table(self.config, tour_number, tab_number) else: tablewindow = Tables.discover_table_by_name(self.config, table_name) if tablewindow == None: # If no client window is found on the screen, complain and continue - if is_tournament: + if type == "tour": table_name = "%s %s" % (tour_number, tab_number) sys.stderr.write("table name "+table_name+" not found, skipping.\n") else: - self.create_HUD(new_hand_id, tablewindow, temp_key, max, poker_game, is_tournament, stat_dict, cards) + self.create_HUD(new_hand_id, tablewindow, temp_key, max, poker_game, stat_dict, cards) if __name__== "__main__": sys.stderr.write("HUD_main starting\n") diff --git a/pyfpdb/SQL.py b/pyfpdb/SQL.py index 2c67cb0a..c9314305 100644 --- a/pyfpdb/SQL.py +++ b/pyfpdb/SQL.py @@ -331,7 +331,7 @@ class Sql: """ self.query['get_table_name'] = """ - select tableName, maxSeats, category + select tableName, maxSeats, category, type from Hands,Gametypes where Hands.id = %s and Gametypes.id = Hands.gametypeId From 6866f409ce4f6afa331730bb223e0a28eaf5f191 Mon Sep 17 00:00:00 2001 From: Ray Date: Thu, 9 Apr 2009 09:21:52 -0400 Subject: [PATCH 8/8] Fix regression importing some Stars tournaments. --- pyfpdb/fpdb_simple.py | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/pyfpdb/fpdb_simple.py b/pyfpdb/fpdb_simple.py index 609e3b4c..b2ef9d59 100644 --- a/pyfpdb/fpdb_simple.py +++ b/pyfpdb/fpdb_simple.py @@ -869,11 +869,19 @@ def goesAllInOnThisLine(line): #end def goesAllInOnThisLine #returns the action type code (see table design) of the given action line -ActionTypes = { 'calls':"call", 'brings in for':"blind", 'completes it to':"bet", ' posts $':"blind", - ' posts a dead ' : "blind", ' posts the small blind of $':"blind", ': posts big blind ':"blind", - ' posts the big blind of $':"blind", ': posts small & big blinds $':"blind", - ': posts small blind $':"blind", - ' bets' : "bet", ' raises' : "bet" +ActionTypes = { 'brings in for' :"blind", + ' posts $' :"blind", + ' posts a dead ' :"blind", + ' posts the small blind of $' :"blind", + ': posts big blind ' :"blind", + ': posts small blind ' :"blind", + ' posts the big blind of $' :"blind", + ': posts small & big blinds $' :"blind", + ': posts small blind $' :"blind", + 'calls' :"call", + 'completes it to' :"bet", + ' bets' :"bet", + ' raises' :"bet" } def parseActionType(line): if (line.startswith("Uncalled bet")):