From d3f17f3fb7031b5fc28b85a6ab231575a26f94f1 Mon Sep 17 00:00:00 2001 From: Gerko de Roo Date: Fri, 22 Jan 2010 18:36:21 +0100 Subject: [PATCH 1/8] game selector for graphs added. exception caught for games selector for player stats --- pyfpdb/GuiGraphViewer.py | 22 ++++++++++++++++++++-- pyfpdb/GuiPlayerStats.py | 13 ++++++++----- pyfpdb/SQL.py | 1 + 3 files changed, 29 insertions(+), 7 deletions(-) diff --git a/pyfpdb/GuiGraphViewer.py b/pyfpdb/GuiGraphViewer.py index 4534920a..56e41bdd 100644 --- a/pyfpdb/GuiGraphViewer.py +++ b/pyfpdb/GuiGraphViewer.py @@ -137,6 +137,8 @@ class GuiGraphViewer (threading.Thread): heroes = self.filters.getHeroes() siteids = self.filters.getSiteIds() limits = self.filters.getLimits() + games = self.filters.getGames() + for i in ('show', 'none'): if i in limits: limits.remove(i) @@ -172,7 +174,7 @@ class GuiGraphViewer (threading.Thread): #Get graph data from DB starttime = time() - (green, blue, red) = self.getRingProfitGraph(playerids, sitenos, limits) + (green, blue, red) = self.getRingProfitGraph(playerids, sitenos, limits, games) print "Graph generated in: %s" %(time() - starttime) self.ax.set_title("Profit graph for ring games") @@ -213,7 +215,7 @@ class GuiGraphViewer (threading.Thread): #end of def showClicked - def getRingProfitGraph(self, names, sites, limits): + def getRingProfitGraph(self, names, sites, limits, games): tmp = self.sql.query['getRingProfitAllHandsPlayerIdSite'] # print "DEBUG: getRingProfitGraph" start_date, end_date = self.filters.getDates() @@ -225,6 +227,22 @@ class GuiGraphViewer (threading.Thread): sitetest = str(tuple(sites)) #nametest = nametest.replace("L", "") + q = [] + for m in self.filters.display.items(): + if m[0] == 'Games' and m[1]: + for n in games: + if games[n]: + q.append(n) + if len(q) > 0: + gametest = str(tuple(q)) + gametest = gametest.replace("L", "") + gametest = gametest.replace(",)",")") + gametest = gametest.replace("u'","'") + gametest = "and gt.category in %s" % gametest + else: + gametest = "and gt.category IS NULL" + tmp = tmp.replace("", gametest) + lims = [int(x) for x in limits if x.isdigit()] potlims = [int(x[0:-2]) for x in limits if len(x) > 2 and x[-2:] == 'pl'] nolims = [int(x[0:-2]) for x in limits if len(x) > 2 and x[-2:] == 'nl'] diff --git a/pyfpdb/GuiPlayerStats.py b/pyfpdb/GuiPlayerStats.py index 8aeff03d..7a3213e8 100644 --- a/pyfpdb/GuiPlayerStats.py +++ b/pyfpdb/GuiPlayerStats.py @@ -476,11 +476,14 @@ class GuiPlayerStats (threading.Thread): for n in games: if games[n]: q.append(n) - gametest = str(tuple(q)) - gametest = gametest.replace("L", "") - gametest = gametest.replace(",)",")") - gametest = gametest.replace("u'","'") - gametest = "and gt.category in %s" % gametest + if len(q) > 0: + gametest = str(tuple(q)) + gametest = gametest.replace("L", "") + gametest = gametest.replace(",)",")") + gametest = gametest.replace("u'","'") + gametest = "and gt.category in %s" % gametest + else: + gametest = "and gt.category IS NULL" query = query.replace("", gametest) if seats: diff --git a/pyfpdb/SQL.py b/pyfpdb/SQL.py index c377c7b6..5913c624 100644 --- a/pyfpdb/SQL.py +++ b/pyfpdb/SQL.py @@ -2576,6 +2576,7 @@ class Sql: AND h.handStart > '' AND h.handStart < '' + AND hp.tourneysPlayersId IS NULL GROUP BY h.handStart, hp.handId, hp.sawShowdown, hp.totalProfit ORDER BY h.handStart""" From 6b38976edc0a67d792e428c90211b7d0ff70584d Mon Sep 17 00:00:00 2001 From: Worros Date: Sat, 23 Jan 2010 14:38:53 +0800 Subject: [PATCH 2/8] Add left-2click option to hide stat windows. Gerko, so I assume others don't have a middle mouse button. --- pyfpdb/Hud.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pyfpdb/Hud.py b/pyfpdb/Hud.py index 1a27b682..3ae2f661 100644 --- a/pyfpdb/Hud.py +++ b/pyfpdb/Hud.py @@ -676,6 +676,11 @@ class Stat_Window: return True if event.button == 1: # left button event + # close on double click for a stat window + # for those that don't have a mouse with middle button + if event.type == gtk.gdk._2BUTTON_PRESS: + self.window.hide() + return True # TODO: make position saving save sizes as well? if event.state & gtk.gdk.SHIFT_MASK: self.window.begin_resize_drag(gtk.gdk.WINDOW_EDGE_SOUTH_EAST, event.button, int(event.x_root), int(event.y_root), event.time) From 74115dcd47c140096b996cff5211be084b4480c5 Mon Sep 17 00:00:00 2001 From: Worros Date: Sat, 23 Jan 2010 15:20:17 +0800 Subject: [PATCH 3/8] Fix comment layout - had a \t --- pyfpdb/Hand.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyfpdb/Hand.py b/pyfpdb/Hand.py index a660b56d..0a0c7ead 100644 --- a/pyfpdb/Hand.py +++ b/pyfpdb/Hand.py @@ -192,7 +192,7 @@ dealt whether they were seen in a 'dealt to' line self.holecards[street][player] = [open, closed] def prepInsert(self, db): - ##### + ##### # Players, Gametypes, TourneyTypes are all shared functions that are needed for additional tables # These functions are intended for prep insert eventually ##### From 2538f61906a817093cde4e37b75582448bde5805 Mon Sep 17 00:00:00 2001 From: Worros Date: Sat, 23 Jan 2010 15:22:22 +0800 Subject: [PATCH 4/8] Remove erronous comment --- pyfpdb/Hand.py | 1 - 1 file changed, 1 deletion(-) diff --git a/pyfpdb/Hand.py b/pyfpdb/Hand.py index 0a0c7ead..4bf3da8b 100644 --- a/pyfpdb/Hand.py +++ b/pyfpdb/Hand.py @@ -681,7 +681,6 @@ class HoldemOmahaHand(Hand): def join_holecards(self, player, asList=False): """With asList = True it returns the set cards for a player including down cards if they aren't know""" - # FIXME: This should actually return hcs = [u'0x', u'0x', u'0x', u'0x'] for street in self.holeStreets: From 9d6707f18f6a6b9aa721e4d6c1b898013111d629 Mon Sep 17 00:00:00 2001 From: Worros Date: Sat, 23 Jan 2010 15:30:48 +0800 Subject: [PATCH 5/8] Fix Charset import got Grapher --- pyfpdb/GuiGraphViewer.py | 1 + 1 file changed, 1 insertion(+) diff --git a/pyfpdb/GuiGraphViewer.py b/pyfpdb/GuiGraphViewer.py index 56e41bdd..3351b70f 100644 --- a/pyfpdb/GuiGraphViewer.py +++ b/pyfpdb/GuiGraphViewer.py @@ -44,6 +44,7 @@ except ImportError, inst: import fpdb_import import Database import Filters +import Charset class GuiGraphViewer (threading.Thread): From b888f82a53dcf40df2d1afb0bab2a85047424db9 Mon Sep 17 00:00:00 2001 From: Gerko de Roo Date: Sat, 23 Jan 2010 10:01:36 +0100 Subject: [PATCH 6/8] All game selection boxes default enabled --- pyfpdb/Filters.py | 1 + 1 file changed, 1 insertion(+) diff --git a/pyfpdb/Filters.py b/pyfpdb/Filters.py index c2778789..b0da336b 100644 --- a/pyfpdb/Filters.py +++ b/pyfpdb/Filters.py @@ -290,6 +290,7 @@ class Filters(threading.Thread): cb = gtk.CheckButton(game) cb.connect('clicked', self.__set_game_select, game) hbox.pack_start(cb, False, False, 0) + cb.set_active(True) def createLimitLine(self, hbox, limit, ltext): cb = gtk.CheckButton(str(ltext)) From 81b9b5170726f0fac1bb6f5f79c65b1d5785deb2 Mon Sep 17 00:00:00 2001 From: Gerko de Roo Date: Sat, 23 Jan 2010 11:17:14 +0100 Subject: [PATCH 7/8] HUD fix for tournaments. Table name storage. --- pyfpdb/Hand.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pyfpdb/Hand.py b/pyfpdb/Hand.py index 4bf3da8b..d2b795e6 100644 --- a/pyfpdb/Hand.py +++ b/pyfpdb/Hand.py @@ -617,6 +617,8 @@ class HoldemOmahaHand(Hand): # which then invokes a 'addXXX' callback if builtFrom == "HHC": hhc.readHandInfo(self) + if self.gametype['type'] == 'tour': + self.tablename = "%s %s" % (self.tourNo, self.tablename) hhc.readPlayerStacks(self) hhc.compilePlayerRegexs(self) hhc.markStreets(self) @@ -911,6 +913,8 @@ class DrawHand(Hand): # Populate the draw hand. if builtFrom == "HHC": hhc.readHandInfo(self) + if self.gametype['type'] == 'tour': + self.tablename = "%s %s" % (self.tourNo, self.tablename) hhc.readPlayerStacks(self) hhc.compilePlayerRegexs(self) hhc.markStreets(self) @@ -1105,6 +1109,8 @@ class StudHand(Hand): # which then invokes a 'addXXX' callback if builtFrom == "HHC": hhc.readHandInfo(self) + if self.gametype['type'] == 'tour': + self.tablename = "%s %s" % (self.tourNo, self.tablename) hhc.readPlayerStacks(self) hhc.compilePlayerRegexs(self) hhc.markStreets(self) From 896de37d0d9b91aae200537dc2902e236ed83669 Mon Sep 17 00:00:00 2001 From: Worros Date: Tue, 26 Jan 2010 01:00:22 +0800 Subject: [PATCH 8/8] Fix hudCache update semantics --- pyfpdb/fpdb_import.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pyfpdb/fpdb_import.py b/pyfpdb/fpdb_import.py index ec480831..76705839 100644 --- a/pyfpdb/fpdb_import.py +++ b/pyfpdb/fpdb_import.py @@ -449,7 +449,9 @@ class Importer: # Call hudcache update if not in bulk import mode # FIXME: Need to test for bulk import that isn't rebuilding the cache if self.callHud: - hand.updateHudCache(self.database) + for hand in handlist: + if hand is not None: + hand.updateHudCache(self.database) self.database.commit() #pipe the Hands.id out to the HUD