Merge branch 'master' of git://git.assembla.com/fpdboz

This commit is contained in:
Mika Bostrom 2010-01-25 19:03:21 +02:00
commit 12367d6f37
7 changed files with 46 additions and 10 deletions

View File

@ -290,6 +290,7 @@ class Filters(threading.Thread):
cb = gtk.CheckButton(game) cb = gtk.CheckButton(game)
cb.connect('clicked', self.__set_game_select, game) cb.connect('clicked', self.__set_game_select, game)
hbox.pack_start(cb, False, False, 0) hbox.pack_start(cb, False, False, 0)
cb.set_active(True)
def createLimitLine(self, hbox, limit, ltext): def createLimitLine(self, hbox, limit, ltext):
cb = gtk.CheckButton(str(ltext)) cb = gtk.CheckButton(str(ltext))

View File

@ -44,6 +44,7 @@ except ImportError, inst:
import fpdb_import import fpdb_import
import Database import Database
import Filters import Filters
import Charset
class GuiGraphViewer (threading.Thread): class GuiGraphViewer (threading.Thread):
@ -137,6 +138,8 @@ class GuiGraphViewer (threading.Thread):
heroes = self.filters.getHeroes() heroes = self.filters.getHeroes()
siteids = self.filters.getSiteIds() siteids = self.filters.getSiteIds()
limits = self.filters.getLimits() limits = self.filters.getLimits()
games = self.filters.getGames()
for i in ('show', 'none'): for i in ('show', 'none'):
if i in limits: if i in limits:
limits.remove(i) limits.remove(i)
@ -172,7 +175,7 @@ class GuiGraphViewer (threading.Thread):
#Get graph data from DB #Get graph data from DB
starttime = time() 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) print "Graph generated in: %s" %(time() - starttime)
self.ax.set_title("Profit graph for ring games") self.ax.set_title("Profit graph for ring games")
@ -213,7 +216,7 @@ class GuiGraphViewer (threading.Thread):
#end of def showClicked #end of def showClicked
def getRingProfitGraph(self, names, sites, limits): def getRingProfitGraph(self, names, sites, limits, games):
tmp = self.sql.query['getRingProfitAllHandsPlayerIdSite'] tmp = self.sql.query['getRingProfitAllHandsPlayerIdSite']
# print "DEBUG: getRingProfitGraph" # print "DEBUG: getRingProfitGraph"
start_date, end_date = self.filters.getDates() start_date, end_date = self.filters.getDates()
@ -225,6 +228,22 @@ class GuiGraphViewer (threading.Thread):
sitetest = str(tuple(sites)) sitetest = str(tuple(sites))
#nametest = nametest.replace("L", "") #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("<game_test>", gametest)
lims = [int(x) for x in limits if x.isdigit()] 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'] 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'] nolims = [int(x[0:-2]) for x in limits if len(x) > 2 and x[-2:] == 'nl']

View File

@ -476,11 +476,14 @@ class GuiPlayerStats (threading.Thread):
for n in games: for n in games:
if games[n]: if games[n]:
q.append(n) q.append(n)
if len(q) > 0:
gametest = str(tuple(q)) gametest = str(tuple(q))
gametest = gametest.replace("L", "") gametest = gametest.replace("L", "")
gametest = gametest.replace(",)",")") gametest = gametest.replace(",)",")")
gametest = gametest.replace("u'","'") gametest = gametest.replace("u'","'")
gametest = "and gt.category in %s" % gametest gametest = "and gt.category in %s" % gametest
else:
gametest = "and gt.category IS NULL"
query = query.replace("<game_test>", gametest) query = query.replace("<game_test>", gametest)
if seats: if seats:

View File

@ -617,6 +617,8 @@ class HoldemOmahaHand(Hand):
# which then invokes a 'addXXX' callback # which then invokes a 'addXXX' callback
if builtFrom == "HHC": if builtFrom == "HHC":
hhc.readHandInfo(self) hhc.readHandInfo(self)
if self.gametype['type'] == 'tour':
self.tablename = "%s %s" % (self.tourNo, self.tablename)
hhc.readPlayerStacks(self) hhc.readPlayerStacks(self)
hhc.compilePlayerRegexs(self) hhc.compilePlayerRegexs(self)
hhc.markStreets(self) hhc.markStreets(self)
@ -681,7 +683,6 @@ class HoldemOmahaHand(Hand):
def join_holecards(self, player, asList=False): 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""" """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'] hcs = [u'0x', u'0x', u'0x', u'0x']
for street in self.holeStreets: for street in self.holeStreets:
@ -912,6 +913,8 @@ class DrawHand(Hand):
# Populate the draw hand. # Populate the draw hand.
if builtFrom == "HHC": if builtFrom == "HHC":
hhc.readHandInfo(self) hhc.readHandInfo(self)
if self.gametype['type'] == 'tour':
self.tablename = "%s %s" % (self.tourNo, self.tablename)
hhc.readPlayerStacks(self) hhc.readPlayerStacks(self)
hhc.compilePlayerRegexs(self) hhc.compilePlayerRegexs(self)
hhc.markStreets(self) hhc.markStreets(self)
@ -1106,6 +1109,8 @@ class StudHand(Hand):
# which then invokes a 'addXXX' callback # which then invokes a 'addXXX' callback
if builtFrom == "HHC": if builtFrom == "HHC":
hhc.readHandInfo(self) hhc.readHandInfo(self)
if self.gametype['type'] == 'tour':
self.tablename = "%s %s" % (self.tourNo, self.tablename)
hhc.readPlayerStacks(self) hhc.readPlayerStacks(self)
hhc.compilePlayerRegexs(self) hhc.compilePlayerRegexs(self)
hhc.markStreets(self) hhc.markStreets(self)

View File

@ -676,6 +676,11 @@ class Stat_Window:
return True return True
if event.button == 1: # left button event 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? # TODO: make position saving save sizes as well?
if event.state & gtk.gdk.SHIFT_MASK: 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) self.window.begin_resize_drag(gtk.gdk.WINDOW_EDGE_SOUTH_EAST, event.button, int(event.x_root), int(event.y_root), event.time)

View File

@ -2576,6 +2576,7 @@ class Sql:
AND h.handStart > '<startdate_test>' AND h.handStart > '<startdate_test>'
AND h.handStart < '<enddate_test>' AND h.handStart < '<enddate_test>'
<limit_test> <limit_test>
<game_test>
AND hp.tourneysPlayersId IS NULL AND hp.tourneysPlayersId IS NULL
GROUP BY h.handStart, hp.handId, hp.sawShowdown, hp.totalProfit GROUP BY h.handStart, hp.handId, hp.sawShowdown, hp.totalProfit
ORDER BY h.handStart""" ORDER BY h.handStart"""

View File

@ -449,6 +449,8 @@ class Importer:
# Call hudcache update if not in bulk import mode # Call hudcache update if not in bulk import mode
# FIXME: Need to test for bulk import that isn't rebuilding the cache # FIXME: Need to test for bulk import that isn't rebuilding the cache
if self.callHud: if self.callHud:
for hand in handlist:
if hand is not None:
hand.updateHudCache(self.database) hand.updateHudCache(self.database)
self.database.commit() self.database.commit()