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.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))

View File

@ -44,6 +44,7 @@ except ImportError, inst:
import fpdb_import
import Database
import Filters
import Charset
class GuiGraphViewer (threading.Thread):
@ -137,6 +138,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 +175,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 +216,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 +228,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("<game_test>", 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']

View File

@ -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("<game_test>", gametest)
if seats:

View File

@ -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
#####
@ -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)
@ -681,7 +683,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:
@ -912,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)
@ -1106,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)

View File

@ -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)

View File

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

View File

@ -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