add 3bet to stats pages and make column and heading choices configurable by editing lists in the init code
This commit is contained in:
parent
f0a7775591
commit
87f2dde961
|
@ -641,6 +641,7 @@ class FpdbSQLQueries:
|
||||||
,stats.n
|
,stats.n
|
||||||
,stats.vpip
|
,stats.vpip
|
||||||
,stats.pfr
|
,stats.pfr
|
||||||
|
,stats.pf3
|
||||||
,stats.steals
|
,stats.steals
|
||||||
,stats.saw_f
|
,stats.saw_f
|
||||||
,stats.sawsd
|
,stats.sawsd
|
||||||
|
@ -672,7 +673,11 @@ class FpdbSQLQueries:
|
||||||
,sum(HDs) AS n
|
,sum(HDs) AS n
|
||||||
,format(100.0*sum(street0VPI)/sum(HDs),1) AS vpip
|
,format(100.0*sum(street0VPI)/sum(HDs),1) AS vpip
|
||||||
,format(100.0*sum(street0Aggr)/sum(HDs),1) AS pfr
|
,format(100.0*sum(street0Aggr)/sum(HDs),1) AS pfr
|
||||||
,case when sum(stealattemptchance) = 0 then '0'
|
,case when sum(street0_3b4bchance) = 0 then '0'
|
||||||
|
else format(100.0*sum(street0_3b4bdone)/sum(street0_3b4bchance),1)
|
||||||
|
end AS pf3
|
||||||
|
,case when sum(stealattemptchance) = 0 then '-'
|
||||||
|
|
||||||
else format(100.0*sum(stealattempted)/sum(stealattemptchance),1)
|
else format(100.0*sum(stealattempted)/sum(stealattemptchance),1)
|
||||||
end AS steals
|
end AS steals
|
||||||
,format(100.0*sum(street1Seen)/sum(HDs),1) AS saw_f
|
,format(100.0*sum(street1Seen)/sum(HDs),1) AS saw_f
|
||||||
|
@ -744,6 +749,7 @@ class FpdbSQLQueries:
|
||||||
,stats.n
|
,stats.n
|
||||||
,stats.vpip
|
,stats.vpip
|
||||||
,stats.pfr
|
,stats.pfr
|
||||||
|
,stats.pf3
|
||||||
,stats.steals
|
,stats.steals
|
||||||
,stats.saw_f
|
,stats.saw_f
|
||||||
,stats.sawsd
|
,stats.sawsd
|
||||||
|
@ -772,13 +778,16 @@ class FpdbSQLQueries:
|
||||||
,gt.bigBlind
|
,gt.bigBlind
|
||||||
,hc.gametypeId
|
,hc.gametypeId
|
||||||
,sum(HDs) as n
|
,sum(HDs) as n
|
||||||
,to_char(100.0*sum(street0VPI)/sum(HDs),'90D0') AS vpip
|
,to_char(100.0*sum(street0VPI)/sum(HDs),'90D0') AS vpip
|
||||||
,to_char(100.0*sum(street0Aggr)/sum(HDs),'90D0') AS pfr
|
,to_char(100.0*sum(street0Aggr)/sum(HDs),'90D0') AS pfr
|
||||||
|
,case when sum(street0_3b4bchance) = 0 then '0'
|
||||||
|
else to_char(100.0*sum(street0_3b4bdone)/sum(street0_3b4bchance),'90D0')
|
||||||
|
end AS pf3
|
||||||
,case when sum(stealattemptchance) = 0 then '0'
|
,case when sum(stealattemptchance) = 0 then '0'
|
||||||
else to_char(100.0*sum(stealattempted)/sum(stealattemptchance),'90D0')
|
else to_char(100.0*sum(stealattempted)/sum(stealattemptchance),'90D0')
|
||||||
end AS steals
|
end AS steals
|
||||||
,to_char(100.0*sum(street1Seen)/sum(HDs),'90D0') AS saw_f
|
,to_char(100.0*sum(street1Seen)/sum(HDs),'90D0') AS saw_f
|
||||||
,to_char(100.0*sum(sawShowdown)/sum(HDs),'90D0') AS sawsd
|
,to_char(100.0*sum(sawShowdown)/sum(HDs),'90D0') AS sawsd
|
||||||
,case when sum(street1Seen) = 0 then 'oo'
|
,case when sum(street1Seen) = 0 then 'oo'
|
||||||
else to_char(100.0*sum(sawShowdown)/sum(street1Seen),'90D0')
|
else to_char(100.0*sum(sawShowdown)/sum(street1Seen),'90D0')
|
||||||
end AS wtsdwsf
|
end AS wtsdwsf
|
||||||
|
@ -860,6 +869,7 @@ class FpdbSQLQueries:
|
||||||
,stats.n
|
,stats.n
|
||||||
,stats.vpip
|
,stats.vpip
|
||||||
,stats.pfr
|
,stats.pfr
|
||||||
|
,stats.pf3
|
||||||
,stats.steals
|
,stats.steals
|
||||||
,stats.saw_f
|
,stats.saw_f
|
||||||
,stats.sawsd
|
,stats.sawsd
|
||||||
|
@ -899,6 +909,9 @@ class FpdbSQLQueries:
|
||||||
,sum(HDs) AS n
|
,sum(HDs) AS n
|
||||||
,format(100.0*sum(street0VPI)/sum(HDs),1) AS vpip
|
,format(100.0*sum(street0VPI)/sum(HDs),1) AS vpip
|
||||||
,format(100.0*sum(street0Aggr)/sum(HDs),1) AS pfr
|
,format(100.0*sum(street0Aggr)/sum(HDs),1) AS pfr
|
||||||
|
,case when sum(street0_3b4bchance) = 0 then '0'
|
||||||
|
else format(100.0*sum(street0_3b4bdone)/sum(street0_3b4bchance),1)
|
||||||
|
end AS pf3
|
||||||
,case when sum(stealattemptchance) = 0 then '0'
|
,case when sum(stealattemptchance) = 0 then '0'
|
||||||
else format(100.0*sum(stealattempted)/sum(stealattemptchance),1)
|
else format(100.0*sum(stealattempted)/sum(stealattemptchance),1)
|
||||||
end AS steals
|
end AS steals
|
||||||
|
@ -991,6 +1004,7 @@ class FpdbSQLQueries:
|
||||||
,stats.n
|
,stats.n
|
||||||
,stats.vpip
|
,stats.vpip
|
||||||
,stats.pfr
|
,stats.pfr
|
||||||
|
,stats.pf3
|
||||||
,stats.steals
|
,stats.steals
|
||||||
,stats.saw_f
|
,stats.saw_f
|
||||||
,stats.sawsd
|
,stats.sawsd
|
||||||
|
@ -1031,6 +1045,9 @@ class FpdbSQLQueries:
|
||||||
|
|
||||||
,to_char(round(100.0*sum(street0VPI)/sum(HDs)),'90D0') AS vpip
|
,to_char(round(100.0*sum(street0VPI)/sum(HDs)),'90D0') AS vpip
|
||||||
,to_char(round(100.0*sum(street0Aggr)/sum(HDs)),'90D0') AS pfr
|
,to_char(round(100.0*sum(street0Aggr)/sum(HDs)),'90D0') AS pfr
|
||||||
|
,case when sum(street0_3b4bchance) = 0 then '0'
|
||||||
|
else to_char(100.0*sum(street0_3b4bdone)/sum(street0_3b4bchance),'90D0')
|
||||||
|
end AS pf3
|
||||||
,case when sum(stealattemptchance) = 0 then '0'
|
,case when sum(stealattemptchance) = 0 then '0'
|
||||||
else to_char(100.0*sum(stealattempted)/sum(stealattemptchance),'90D0')
|
else to_char(100.0*sum(stealattempted)/sum(stealattemptchance),'90D0')
|
||||||
end AS steals
|
end AS steals
|
||||||
|
|
|
@ -118,7 +118,7 @@ class GuiPlayerStats (threading.Thread):
|
||||||
|
|
||||||
self.cursor.execute(tmp)
|
self.cursor.execute(tmp)
|
||||||
result = self.cursor.fetchall()
|
result = self.cursor.fetchall()
|
||||||
cols = 17
|
cols = 18
|
||||||
rows = len(result)+1 # +1 for title row
|
rows = len(result)+1 # +1 for title row
|
||||||
self.stats_table = gtk.Table(rows, cols, False)
|
self.stats_table = gtk.Table(rows, cols, False)
|
||||||
self.stats_table.set_col_spacings(4)
|
self.stats_table.set_col_spacings(4)
|
||||||
|
@ -126,7 +126,7 @@ class GuiPlayerStats (threading.Thread):
|
||||||
vbox.add(self.stats_table)
|
vbox.add(self.stats_table)
|
||||||
|
|
||||||
# Create header row
|
# Create header row
|
||||||
titles = ("Game", "Hands", "VPIP", "PFR", "Steals", "Saw_F", "SawSD", "WtSDwsF", "W$SD", "FlAFq", "TuAFq", "RvAFq", "PoFAFq", "Net($)", "BB/100", "$/hand", "Variance")
|
titles = ("Game", "Hands", "VPIP", "PFR", "PF3", "Steals", "Saw_F", "SawSD", "WtSDwsF", "W$SD", "FlAFq", "TuAFq", "RvAFq", "PoFAFq", "Net($)", "BB/100", "$/hand", "Variance")
|
||||||
|
|
||||||
col = 0
|
col = 0
|
||||||
row = 0
|
row = 0
|
||||||
|
|
|
@ -68,12 +68,27 @@ class GuiPositionalStats (threading.Thread):
|
||||||
self.stats_frame = gtk.VBox(False, 0)
|
self.stats_frame = gtk.VBox(False, 0)
|
||||||
self.stats_frame.show()
|
self.stats_frame.show()
|
||||||
|
|
||||||
|
# This could be stored in config eventually, or maybe configured in this window somehow.
|
||||||
|
# Each posncols element is the name of a column returned by the sql
|
||||||
|
# query (in lower case) and each posnheads element is the text to use as
|
||||||
|
# the heading in the GUI. Both sequences should be the same length.
|
||||||
|
# To miss columns out remove them from both tuples (the 1st 2 elements should always be included).
|
||||||
|
# To change the heading just edit the second list element as required
|
||||||
|
# If the first list element does not match a query column that pair is ignored
|
||||||
|
self.posncols = ( "game", "plposition", "vpip", "pfr", "pf3", "steals"
|
||||||
|
, "saw_f", "sawsd", "wtsdwsf", "wmsd", "flafq", "tuafq", "rvafq"
|
||||||
|
, "pofafq", "net", "bbper100", "profitperhand", "variance", "n" )
|
||||||
|
self.posnheads = ( "Game", "Posn", "VPIP", "PFR", "PF3", "Steals"
|
||||||
|
, "Saw_F", "SawSD", "WtSDwsF", "W$SD", "FlAFq", "TuAFq", "RvAFq"
|
||||||
|
, "PoFAFq", "Net($)", "BB/100", "$/hand", "Variance", "Hds" )
|
||||||
|
|
||||||
self.fillStatsFrame(self.stats_frame)
|
self.fillStatsFrame(self.stats_frame)
|
||||||
statsFrame.add(self.stats_frame)
|
statsFrame.add(self.stats_frame)
|
||||||
|
|
||||||
self.main_hbox.pack_start(self.filters.get_vbox())
|
self.main_hbox.pack_start(self.filters.get_vbox())
|
||||||
self.main_hbox.pack_start(statsFrame)
|
self.main_hbox.pack_start(statsFrame)
|
||||||
|
|
||||||
|
|
||||||
def get_vbox(self):
|
def get_vbox(self):
|
||||||
"""returns the vbox of this thread"""
|
"""returns the vbox of this thread"""
|
||||||
return self.main_hbox
|
return self.main_hbox
|
||||||
|
@ -126,20 +141,18 @@ class GuiPositionalStats (threading.Thread):
|
||||||
|
|
||||||
self.cursor.execute(tmp)
|
self.cursor.execute(tmp)
|
||||||
result = self.cursor.fetchall()
|
result = self.cursor.fetchall()
|
||||||
cols = 18
|
self.stats_table = gtk.Table(1, 1, False) # gtk table expands as required
|
||||||
rows = len(result) # gtk table expands as required
|
|
||||||
self.stats_table = gtk.Table(1, cols, False)
|
|
||||||
self.stats_table.set_col_spacings(4)
|
self.stats_table.set_col_spacings(4)
|
||||||
self.stats_table.show()
|
self.stats_table.show()
|
||||||
vbox.add(self.stats_table)
|
vbox.add(self.stats_table)
|
||||||
|
|
||||||
# Create header row
|
colnames = [desc[0].lower() for desc in self.cursor.description]
|
||||||
titles = ("Game", "Position", "#", "VPIP", "PFR", "Steals", "Saw_F", "SawSD", "WtSDwsF", "W$SD", "FlAFq", "TuAFq", "RvAFq", "PoFAFq", "Net($)", "BB/100", "$/hand", "Variance")
|
rows = len(result)
|
||||||
|
|
||||||
col = 0
|
col = 0
|
||||||
row = 0
|
row = 0
|
||||||
for t in titles:
|
for t in self.posnheads:
|
||||||
l = gtk.Label(titles[col])
|
l = gtk.Label(self.posnheads[col])
|
||||||
l.show()
|
l.show()
|
||||||
self.stats_table.attach(l, col, col+1, row, row+1, yoptions=gtk.SHRINK)
|
self.stats_table.attach(l, col, col+1, row, row+1, yoptions=gtk.SHRINK)
|
||||||
col +=1
|
col +=1
|
||||||
|
@ -152,12 +165,16 @@ class GuiPositionalStats (threading.Thread):
|
||||||
else:
|
else:
|
||||||
bgcolor = "lightgrey"
|
bgcolor = "lightgrey"
|
||||||
rowprinted=0
|
rowprinted=0
|
||||||
for col in range(cols):
|
for col,colname in enumerate(self.posncols):
|
||||||
|
if colname in colnames:
|
||||||
|
sqlcol = colnames.index(colname)
|
||||||
|
else:
|
||||||
|
continue
|
||||||
eb = gtk.EventBox()
|
eb = gtk.EventBox()
|
||||||
eb.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse(bgcolor))
|
eb.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse(bgcolor))
|
||||||
# print blank row between levels:
|
# print blank row between levels:
|
||||||
if result[sqlrow][col] and (sqlrow == 0 or result[sqlrow][0] == last_game):
|
if result[sqlrow][sqlcol] and (sqlrow == 0 or result[sqlrow][0] == last_game):
|
||||||
l = gtk.Label(result[sqlrow][col])
|
l = gtk.Label(result[sqlrow][sqlcol])
|
||||||
rowprinted=1
|
rowprinted=1
|
||||||
else:
|
else:
|
||||||
l = gtk.Label(' ')
|
l = gtk.Label(' ')
|
||||||
|
@ -182,6 +199,7 @@ class GuiPositionalStats (threading.Thread):
|
||||||
self.cursor.execute(tmp)
|
self.cursor.execute(tmp)
|
||||||
result = self.cursor.fetchall()
|
result = self.cursor.fetchall()
|
||||||
rows = len(result)
|
rows = len(result)
|
||||||
|
colnames = [desc[0].lower() for desc in self.cursor.description]
|
||||||
|
|
||||||
# blank row
|
# blank row
|
||||||
col = 0
|
col = 0
|
||||||
|
@ -203,15 +221,17 @@ class GuiPositionalStats (threading.Thread):
|
||||||
bgcolor = "white"
|
bgcolor = "white"
|
||||||
else:
|
else:
|
||||||
bgcolor = "lightgrey"
|
bgcolor = "lightgrey"
|
||||||
inc = 0
|
for col,colname in enumerate(self.posncols):
|
||||||
for col in range(cols):
|
if colname in colnames:
|
||||||
|
sqlcol = colnames.index(colname)
|
||||||
|
elif colname != "plposition":
|
||||||
|
continue
|
||||||
eb = gtk.EventBox()
|
eb = gtk.EventBox()
|
||||||
eb.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse(bgcolor))
|
eb.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse(bgcolor))
|
||||||
if col == 1:
|
if colname == 'plposition':
|
||||||
l = gtk.Label('Totals')
|
l = gtk.Label('Totals')
|
||||||
inc = 1
|
elif result[sqlrow][sqlcol]:
|
||||||
elif result[sqlrow][col-inc]:
|
l = gtk.Label(result[sqlrow][sqlcol])
|
||||||
l = gtk.Label(result[sqlrow][col-inc])
|
|
||||||
else:
|
else:
|
||||||
l = gtk.Label(' ')
|
l = gtk.Label(' ')
|
||||||
if col == 0:
|
if col == 0:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user