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

This commit is contained in:
eblade 2009-01-28 04:31:19 -05:00
commit 96ac38a83b
4 changed files with 46 additions and 4 deletions

View File

@ -20,7 +20,7 @@ import pygtk
pygtk.require('2.0') pygtk.require('2.0')
import gtk import gtk
import os import os
from time import time from time import *
#import pokereval #import pokereval
try: try:
@ -366,3 +366,31 @@ class GuiGraphViewer (threading.Thread):
self.leftPanelBox.show() self.leftPanelBox.show()
self.graphBox.show() self.graphBox.show()
#################################
self.db.cursor.execute("""select UNIX_TIMESTAMP(handStart) as time, id from Hands ORDER BY time""")
THRESHOLD = 1800
hands = self.db.cursor.fetchall()
times = map(lambda x:long(x[0]), hands)
handids = map(lambda x:int(x[1]), hands)
print "DEBUG: len(times) %s" %(len(times))
diffs = diff(times)
print "DEBUG: len(diffs) %s" %(len(diffs))
index = nonzero(diff(times) > THRESHOLD)
print "DEBUG: len(index[0]) %s" %(len(index[0]))
print "DEBUG: index %s" %(index)
print "DEBUG: index[0][0] %s" %(index[0][0])
total = 0
last_idx = 0
for i in range(len(index[0])):
print "Hands in session %4s: %4s Start: %s End: %s Total: %s" %(i, index[0][i] - last_idx, strftime("%d/%m/%Y %H:%M", localtime(times[last_idx])), strftime("%d/%m/%Y %H:%M", localtime(times[index[0][i]])), times[index[0][i]] - times[last_idx])
total = total + (index[0][i] - last_idx)
last_idx = index[0][i] + 1
print "Total: ", total
#################################

View File

@ -67,7 +67,7 @@ class GuiPlayerStats (threading.Thread):
for t in titles: for t in titles:
l = gtk.Label(titles[col]) l = gtk.Label(titles[col])
l.show() l.show()
self.stats_table.attach(l, col, col+1, row, row+1) self.stats_table.attach(l, col, col+1, row, row+1, yoptions=gtk.SHRINK)
col +=1 col +=1
for row in range(rows-1): for row in range(rows-1):
@ -87,7 +87,7 @@ class GuiPlayerStats (threading.Thread):
else: else:
l.set_alignment(xalign=1.0, yalign=0.5) l.set_alignment(xalign=1.0, yalign=0.5)
eb.add(l) eb.add(l)
self.stats_table.attach(eb, col, col+1, row+1, row+2) self.stats_table.attach(eb, col, col+1, row+1, row+2, yoptions=gtk.SHRINK)
l.show() l.show()
eb.show() eb.show()
self.fdb.db.commit() self.fdb.db.commit()

View File

@ -167,6 +167,11 @@ class Hud:
return # no killing self twice. return # no killing self twice.
for k in self.stat_windows: for k in self.stat_windows:
self.stat_windows[k].window.destroy() self.stat_windows[k].window.destroy()
# also kill any aux windows
for m in self.aux_windows:
m.destroy()
self.aux_windows.remove(m)
self.deleted = True self.deleted = True
self.main_window.disconnect(self.main_window.destroyhandler) # so we don't potentially infiniteloop in here, right self.main_window.disconnect(self.main_window.destroyhandler) # so we don't potentially infiniteloop in here, right
self.main_window.destroy() self.main_window.destroy()
@ -360,23 +365,29 @@ class Stat_Window:
self.grid = gtk.Table(rows = self.game.rows, columns = self.game.cols, homogeneous = False) self.grid = gtk.Table(rows = self.game.rows, columns = self.game.cols, homogeneous = False)
self.window.add(self.grid) self.window.add(self.grid)
self.window.modify_bg(gtk.STATE_NORMAL, parent.backgroundcolor)
self.e_box = [] self.e_box = []
self.frame = [] self.frame = []
self.label = [] self.label = []
for r in range(self.game.rows): for r in range(self.game.rows):
self.frame.append([])
self.e_box.append([]) self.e_box.append([])
self.label.append([]) self.label.append([])
for c in range(self.game.cols): for c in range(self.game.cols):
self.frame[r].append( gtk.Frame() )
self.e_box[r].append( gtk.EventBox() ) self.e_box[r].append( gtk.EventBox() )
self.e_box[r][c].modify_bg(gtk.STATE_NORMAL, parent.backgroundcolor) self.e_box[r][c].modify_bg(gtk.STATE_NORMAL, parent.backgroundcolor)
self.e_box[r][c].modify_fg(gtk.STATE_NORMAL, parent.foregroundcolor) self.e_box[r][c].modify_fg(gtk.STATE_NORMAL, parent.foregroundcolor)
Stats.do_tip(self.e_box[r][c], 'stuff') Stats.do_tip(self.e_box[r][c], 'stuff')
self.grid.attach(self.e_box[r][c], c, c+1, r, r+1, xpadding = 0, ypadding = 0) # self.grid.attach(self.e_box[r][c], c, c+1, r, r+1, xpadding = 0, ypadding = 0)
self.grid.attach(self.frame[r][c], c, c+1, r, r+1, xpadding = 0, ypadding = 0)
self.frame[r][c].add(self.e_box[r][c])
self.label[r].append( gtk.Label('xxx') ) self.label[r].append( gtk.Label('xxx') )
self.frame[r][c].modify_bg(gtk.STATE_NORMAL, parent.backgroundcolor)
self.label[r][c].modify_bg(gtk.STATE_NORMAL, parent.backgroundcolor) self.label[r][c].modify_bg(gtk.STATE_NORMAL, parent.backgroundcolor)
self.label[r][c].modify_fg(gtk.STATE_NORMAL, parent.foregroundcolor) self.label[r][c].modify_fg(gtk.STATE_NORMAL, parent.foregroundcolor)

View File

@ -50,6 +50,9 @@ class Aux_Window:
def update_gui(self): def update_gui(self):
pass pass
def destroy(self):
self.container.destroy()
class Stud_mucked(Aux_Window): class Stud_mucked(Aux_Window):
def __init__(self, container, hud, config, params): def __init__(self, container, hud, config, params):