Add tooltips explaining stats

This commit is contained in:
lastpoet 2010-10-08 14:15:29 +01:00
parent 8b25c67ba9
commit 9d827ee3fd

View File

@ -34,10 +34,72 @@ import Filters
import Charset import Charset
import GuiPlayerStats import GuiPlayerStats
from TreeViewTooltips import TreeViewTooltips
#colalias,colshowsumm,colshowposn,colheading,colxalign,colformat,coltype = 0,1,2,3,4,5,6 #colalias,colshowsumm,colshowposn,colheading,colxalign,colformat,coltype = 0,1,2,3,4,5,6
#new order in config file: #new order in config file:
colalias,colheading,colshowsumm,colshowposn,colformat,coltype,colxalign = 0,1,2,3,4,5,6 colalias,colheading,colshowsumm,colshowposn,colformat,coltype,colxalign = 0,1,2,3,4,5,6
ranks = {'x':0, '2':2, '3':3, '4':4, '5':5, '6':6, '7':7, '8':8, '9':9, 'T':10, 'J':11, 'Q':12, 'K':13, 'A':14} ranks = {'x':0, '2':2, '3':3, '4':4, '5':5, '6':6, '7':7, '8':8, '9':9, 'T':10, 'J':11, 'Q':12, 'K':13, 'A':14}
onlinehelp = {'Game':'Type of Game',
'Hand':'Hole cards',
'Posn':'Position',
'Name':'Name of the player',
'Hds':'Number of hands played',
'Seats':'Number of Seats',
'VPIP':'Voluntarily Putting In the pot\n(blinds excluded)',
'PFR':'% Pre Flop Raise',
'PF3':'% Pre Flop Re-Raise / 3Bet',
'AggFac':'Aggression Factor\n',
'AggFreq':'Aggression Frequency\nBet or Raise vs Fold',
'ContBet':'Continuation Bet on the flop',
'RFI':'% Raise First In\% Raise when first to bet',
'Steals':'% First to raise pre-flop\nand steal blinds',
'Saw_F':'% Saw Flop vs hands dealt',
'SawSD':'Saw Show Down / River',
'WtSDwsF':'Went To Show Down When Saw Flop',
'W$SD':'Amount Won when Show Down seen',
'FlAFq':'Flop Aggression\n% Bet or Raise after seeing Flop',
'TuAFq':'Turn Aggression\n% Bet or Raise after seeing Turn',
'RvAFq':'River Aggression\n% Bet or Raise after seeing River',
'PoFAFq':'Coming Soon\nTotal % agression',
'Net($)':'Amount won',
'bb/100':'Number of Big Blinds won\nor lost per 100 hands',
'Rake($)':'Amount of rake paid',
'bbxr/100':'Number of Big Blinds won\nor lost per 100 hands\nwhen excluding rake',
'Variance':'Measure of uncertainty\nThe lower, the more stable the amounts won'
}
class DemoTips(TreeViewTooltips):
def __init__(self, customer_column):
# customer_column is an instance of gtk.TreeViewColumn and
# is being used in the gtk.TreeView to show customer names.
# self.cust_col = customer_column
# call base class init
TreeViewTooltips.__init__(self)
def get_tooltip(self, view, column, path):
model = view.get_model()
cards = model[path][0]
title=column.get_title()
display='<big>%s</big>\n<i>%s</i>' % (title,onlinehelp[title])
return (display)
def location(self, x, y, w, h):
# rename me to "location" so I override the base class
# method. This will demonstrate being able to change
# where the tooltip window popups, relative to the
# pointer.
# this will place the tooltip above and to the right
return x + 30, y - (h + 10)
class GuiRingPlayerStats (GuiPlayerStats.GuiPlayerStats): class GuiRingPlayerStats (GuiPlayerStats.GuiPlayerStats):
@ -354,6 +416,7 @@ class GuiRingPlayerStats (GuiPlayerStats.GuiPlayerStats):
print _("***sortcols error: ") + str(sys.exc_info()[1]) print _("***sortcols error: ") + str(sys.exc_info()[1])
print "\n".join( [e[0]+':'+str(e[1])+" "+e[2] for e in err] ) print "\n".join( [e[0]+':'+str(e[1])+" "+e[2] for e in err] )
#end def sortcols #end def sortcols
def addGrid(self, vbox, query, flags, playerids, sitenos, limits, type, seats, groups, dates, games): def addGrid(self, vbox, query, flags, playerids, sitenos, limits, type, seats, groups, dates, games):
counter = 0 counter = 0
@ -466,6 +529,9 @@ class GuiRingPlayerStats (GuiPlayerStats.GuiPlayerStats):
#print treerow #print treerow
sqlrow += 1 sqlrow += 1
row += 1 row += 1
tips = DemoTips(column[colformat])
tips.add_view(view)
vbox.show_all() vbox.show_all()
view.show() view.show()
if len(self.liststore) == 1: if len(self.liststore) == 1: