p66 - mostly HUD improvements from ray

HUD now doesnt display a taskbar window for each stat window
HUD w$wsf works
more HUD improvements
made windows not call fpdb hud
moved conf file out of profiles folder
This commit is contained in:
steffen123 2008-08-22 21:10:32 +01:00
parent 76448ce06f
commit 07f8220808
6 changed files with 129 additions and 82 deletions

View File

@ -4,23 +4,19 @@ Please also see db-todo.txt
alpha2 (release 22Aug)
======
make windows not call fpdb hud
W$wsF doesnt work in HUD (p64 may have made this worse)
auto import only runs on one file per start
set hud stats default row1: hands, VPIP, PFR, PF3B/4B, ST row2: Aggr% (postflop), Fold% (postflop), W$sF, WtSD, W$@SD
make windows use correct language version of Appdata, e.g. Anwendungdaten
stop bulk importer from executing HUD hook
seperate and improve instructions for update
update status or make a support matrix table for website
add instructions for mailing list to contacts
ebuild: symlink doesnt work, USE gtk, more automation, update install-in-gentoo.txt, set permissions in it, copy docs to correct place, use games eclass or whatever to get games group notice, print notice about install-in-gentoo.txt and mysql --config
re-run existing regression tests
move conf file out of profiles folder
update website for dropping profile subfolder
alpha3 (release by 31Aug)
======
store raw hand in db
write reimport function using the raw hand field
ebuild: symlink doesnt work, USE gtk, more automation, update install-in-gentoo.txt, set permissions in it, copy docs to correct place, use games eclass or whatever to get games group notice, print notice about install-in-gentoo.txt and mysql --config
update status or make a support matrix table for website
add instructions for mailing list to contacts
auto import only runs on one file per start
make windows use correct language version of Appdata, e.g. Anwendungdaten
make 3 default HUD configs (easy (4-5 fields), advanced (10ish fields), crazy (20 or so))
store raw hand in db and write reimport function using the raw hand field
make it work with postgres
expand instructions for profile file
ftp: read maxSeats

View File

@ -147,7 +147,9 @@ class Stat_Window:
self.window = gtk.Window()
self.window.set_decorated(0)
self.window.set_gravity(gtk.gdk.GRAVITY_STATIC)
self.window.set_keep_above(1)
self.window.set_title("%s" % seat)
self.window.set_property("skip-taskbar-hint", True)
self.grid = gtk.Table(rows = self.game.rows, columns = self.game.cols, homogeneous = False)
self.window.add(self.grid)
@ -169,7 +171,6 @@ class Stat_Window:
self.label[r][c].modify_font(font)
self.window.realize
self.window.move(self.x, self.y)
self.window.set_keep_above(1)
self.window.show_all()
def destroy(*args): # call back for terminating the main eventloop
@ -184,7 +185,16 @@ if __name__== "__main__":
c = Configuration.Config()
tables = Tables.discover(c)
db = Database.Database(c, 'PTrackSv2', 'razz')
db = Database.Database(c, 'fpdb', 'holdem')
for attr in dir(Stats):
if attr.startswith('__'): continue
if attr == 'Configuration' or attr == 'Database': continue
if attr == 'GInitiallyUnowned': continue
# print Stats.attr.__doc__
print Stats.vpip.__doc__
for t in tables:
win = Hud(t, 8, c, db)

View File

@ -32,6 +32,11 @@ class Sql:
def __init__(self, game = 'holdem', type = 'PT3'):
self.query = {}
############################################################################
#
# Support for the ptracks database, a cut down PT2 stud database.
# You can safely ignore this unless you are me.
#
if game == 'razz' and type == 'ptracks':
self.query['get_table_name'] = "select table_name from game where game_id = %s"
@ -151,7 +156,10 @@ class Sql:
FROM game_players INNER JOIN players ON (game_players.player_id = players.player_id)
WHERE game_id = %s
"""
###############################################################################3
# Support for the Free Poker DataBase = fpdb http://fpdb.sourceforge.net/
#
if type == 'fpdb':
self.query['get_last_hand'] = "select max(id) from Hands"
@ -164,47 +172,67 @@ class Sql:
"""
self.query['get_stats_from_hand'] = """
SELECT HudCache.playerId AS player_id,
sum(HDs) AS n,
sum(street0Aggr) AS pfr,
sum(street0VPI) AS vpip,
sum(sawShowdown) AS sd,
sum(wonAtSD) AS wmsd,
sum(street1Seen) AS saw_f,
sum(stealAttemptChance) AS steal_opp,
sum(stealAttempted) AS steal,
sum(foldedSbToSteal) AS SBnotDef,
sum(foldedBbToSteal) AS BBnotDef,
sum(foldBbToStealChance) AS SBstolen,
sum(foldBbToStealChance) AS BBstolen,
sum(street0_3B4BChance) AS TB_opp_0,
sum(street0_3B4BDone) AS TB_0,
sum(street1Seen) AS saw_1,
sum(street2Seen) AS saw_2,
sum(street3Seen) AS saw_3,
sum(street4Seen) AS saw_4,
sum(street1Aggr) AS aggr_1,
sum(street2Aggr) AS aggr_2,
sum(street3Aggr) AS aggr_3,
sum(street4Aggr) AS aggr_4,
sum(otherRaisedStreet1) AS was_raised_1,
sum(otherRaisedStreet2) AS was_raised_2,
sum(otherRaisedStreet3) AS was_raised_3,
sum(otherRaisedStreet4) AS was_raised_4,
sum(foldToOtherRaisedStreet1) AS f_freq_1,
sum(foldToOtherRaisedStreet2) AS f_freq_2,
sum(foldToOtherRaisedStreet3) AS f_freq_3,
sum(foldToOtherRaisedStreet4) AS f_freq_4,
sum(wonWhenSeenStreet1) AS w_w_s_1,
sum(street1CBChance) AS CB_opp_1,
sum(street2CBChance) AS CB_opp_2,
sum(street3CBChance) AS CB_opp_3,
sum(street4CBChance) AS CB_opp_4,
sum(street1CBDone) AS CB_1,
sum(street2CBDone) AS CB_2,
sum(street3CBDone) AS CB_3,
sum(street4CBDone) AS CB_4,
sum(totalProfit) AS net
SELECT HudCache.playerId AS player_id,
HudCache.gametypeId AS gametypeId,
activeSeats AS n_active,
position AS position,
HudCache.tourneyTypeId AS tourneyTypeId,
sum(HDs) AS n,
sum(street0VPI) AS vpip,
sum(street0Aggr) AS pfr,
sum(street0_3B4BChance) AS TB_opp_0,
sum(street0_3B4BDone) AS TB_0,
sum(street1Seen) AS saw_f,
sum(street1Seen) AS saw_1,
sum(street2Seen) AS saw_2,
sum(street3Seen) AS saw_3,
sum(street4Seen) AS saw_4,
sum(sawShowdown) AS sd,
sum(street1Aggr) AS aggr_1,
sum(street2Aggr) AS aggr_2,
sum(street3Aggr) AS aggr_3,
sum(street4Aggr) AS aggr_4,
sum(otherRaisedStreet1) AS was_raised_1,
sum(otherRaisedStreet2) AS was_raised_2,
sum(otherRaisedStreet3) AS was_raised_3,
sum(otherRaisedStreet4) AS was_raised_4,
sum(foldToOtherRaisedStreet1) AS f_freq_1,
sum(foldToOtherRaisedStreet2) AS f_freq_2,
sum(foldToOtherRaisedStreet3) AS f_freq_3,
sum(foldToOtherRaisedStreet4) AS f_freq_4,
sum(wonWhenSeenStreet1) AS w_w_s_1,
sum(wonAtSD) AS wmsd,
sum(stealAttemptChance) AS steal_opp,
sum(stealAttempted) AS steal,
sum(foldBbToStealChance) AS SBstolen,
sum(foldedBbToSteal) AS BBnotDef,
sum(foldBbToStealChance) AS BBstolen,
sum(foldedSbToSteal) AS SBnotDef,
sum(street1CBChance) AS CB_opp_1,
sum(street1CBDone) AS CB_1,
sum(street2CBChance) AS CB_opp_2,
sum(street2CBDone) AS CB_2,
sum(street3CBChance) AS CB_opp_3,
sum(street3CBDone) AS CB_3,
sum(street4CBChance) AS CB_opp_4,
sum(street4CBDone) AS CB_4,
sum(foldToStreet1CBChance) AS f_cb_opp_1,
sum(foldToStreet1CBDone) AS f_cb_1,
sum(foldToStreet2CBChance) AS f_cb_opp_2,
sum(foldToStreet2CBDone) AS f_cb_2,
sum(foldToStreet3CBChance) AS f_cb_opp_3,
sum(foldToStreet3CBDone) AS f_cb_3,
sum(foldToStreet4CBChance) AS f_cb_opp_4,
sum(foldToStreet4CBDone) AS f_cb_4,
sum(totalProfit) AS net,
sum(street1CheckCallRaiseChance) AS ccr_opp_1,
sum(street1CheckCallRaiseDone) AS ccr_1,
sum(street2CheckCallRaiseChance) AS ccr_opp_2,
sum(street2CheckCallRaiseDone) AS ccr_2,
sum(street3CheckCallRaiseChance) AS ccr_opp_3,
sum(street3CheckCallRaiseDone) AS ccr_3,
sum(street4CheckCallRaiseChance) AS ccr_opp_4,
sum(street4CheckCallRaiseDone) AS ccr_4
FROM HudCache, Hands
WHERE HudCache.PlayerId in
(SELECT PlayerId FROM HandsPlayers

View File

@ -55,6 +55,10 @@ import Database
def do_tip(widget, tip):
widget.set_tooltip_text(tip)
def list_stats():
for key in dir():
print key
def do_stat(stat_dict, player = 24, stat = 'vpip'):
return eval("%(stat)s(stat_dict, %(player)d)" % {'stat': stat, 'player': player})
# OK, for reference the tuple returned by the stat is:
@ -68,6 +72,9 @@ def do_stat(stat_dict, player = 24, stat = 'vpip'):
###########################################
# functions that return individual stats
def vpip(stat_dict, player):
"""
Voluntarily put $ in the pot
"""
stat = 0.0
try:
stat = float(stat_dict[player]['vpip'])/float(stat_dict[player]['n'])
@ -146,8 +153,6 @@ def wmsd(stat_dict, player):
'% won money at showdown'
)
def saw_f(stat_dict, player):
try:
num = float(stat_dict[player]['saw_f'])
@ -193,7 +198,7 @@ def n(stat_dict, player):
def fold_f(stat_dict, player):
stat = 0.0
try:
stat = stat_dict[player]['fold_2']/stat_dict[player]['saw_f']
stat = float(stat_dict[player]['fold_2'])/fold(stat_dict[player]['saw_f'])
return (stat,
'%3.1f' % (100*stat) + '%',
'ff=%3.1f' % (100*stat) + '%',
@ -213,7 +218,7 @@ def fold_f(stat_dict, player):
def steal(stat_dict, player):
stat = 0.0
try:
stat = stat_dict[player]['steal']/stat_dict[player]['steal_opp']
stat = float(stat_dict[player]['steal'])/float(stat_dict[player]['steal_opp'])
return (stat,
'%3.1f' % (100*stat) + '%',
'st=%3.1f' % (100*stat) + '%',
@ -233,7 +238,7 @@ def steal(stat_dict, player):
def f_SB_steal(stat_dict, player):
stat = 0.0
try:
stat = stat_dict[player]['SBnotDef']/stat_dict[player]['SBstolen']
stat = float(stat_dict[player]['SBnotDef'])/float(stat_dict[player]['SBstolen'])
return (stat,
'%3.1f' % (100*stat) + '%',
'fSB=%3.1f' % (100*stat) + '%',
@ -253,7 +258,7 @@ def f_SB_steal(stat_dict, player):
def f_BB_steal(stat_dict, player):
stat = 0.0
try:
stat = stat_dict[player]['BBnotDef']/stat_dict[player]['BBstolen']
stat = float(stat_dict[player]['BBnotDef'])/float(stat_dict[player]['BBstolen'])
return (stat,
'%3.1f' % (100*stat) + '%',
'fBB=%3.1f' % (100*stat) + '%',
@ -273,7 +278,7 @@ def f_BB_steal(stat_dict, player):
def three_B_0(stat_dict, player):
stat = 0.0
try:
stat = stat_dict[player]['TB_0']/stat_dict[player]['TB_opp_0']
stat = float(stat_dict[player]['TB_0'])/float(stat_dict[player]['TB_opp_0'])
return (stat,
'%3.1f' % (100*stat) + '%',
'3B=%3.1f' % (100*stat) + '%',
@ -293,12 +298,12 @@ def three_B_0(stat_dict, player):
def WMsF(stat_dict, player):
stat = 0.0
try:
stat = stat_dict[player]['w_w_s_1']/stat_dict[player]['saw_1']
stat = float(stat_dict[player]['w_w_s_1'])/float(stat_dict[player]['saw_1'])
return (stat,
'%3.1f' % (100*stat) + '%',
'wf=%3.1f' % (100*stat) + '%',
'w_w_f=%3.1f' % (100*stat) + '%',
'(%d/%d)' % (stat_dict[player]['w_w_s_1'], stat_dict[player]['saw_1']),
'(%d/%d)' % (stat_dict[player]['w_w_s_1'], stat_dict[player]['saw_f']),
'% won$/saw flop/4th'
)
except:
@ -313,7 +318,7 @@ def WMsF(stat_dict, player):
def a_freq_1(stat_dict, player):
stat = 0.0
try:
stat = stat_dict[player]['aggr_1']/stat_dict[player]['saw_f']
stat = float(stat_dict[player]['aggr_1'])/float(stat_dict[player]['saw_f'])
return (stat,
'%3.1f' % (100*stat) + '%',
'a1=%3.1f' % (100*stat) + '%',
@ -333,7 +338,7 @@ def a_freq_1(stat_dict, player):
def a_freq_2(stat_dict, player):
stat = 0.0
try:
stat = stat_dict[player]['aggr_2']/stat_dict[player]['saw_2']
stat = float(stat_dict[player]['aggr_2'])/float(stat_dict[player]['saw_2'])
return (stat,
'%3.1f' % (100*stat) + '%',
'a2=%3.1f' % (100*stat) + '%',
@ -353,12 +358,12 @@ def a_freq_2(stat_dict, player):
def a_freq_3(stat_dict, player):
stat = 0.0
try:
stat = stat_dict[player]['aggr_3']/stat_dict[player]['saw_3']
stat = float(stat_dict[player]['aggr_3'])/float(stat_dict[player]['saw_3'])
return (stat,
'%3.1f' % (100*stat) + '%',
'a3=%3.1f' % (100*stat) + '%',
'a_fq_3=%3.1f' % (100*stat) + '%',
'(%d/%d)' % (stat_dict[player]['aggr_3'], stat_dict[player]['saw_3']),
'(%d/%d)' % (stat_dict[player]['aggr_1'], stat_dict[player]['saw_1']),
'Aggression Freq river/6th'
)
except:
@ -373,7 +378,7 @@ def a_freq_3(stat_dict, player):
def a_freq_4(stat_dict, player):
stat = 0.0
try:
stat = stat_dict[player]['aggr_4']/stat_dict[player]['saw_4']
stat = float(stat_dict[player]['aggr_4'])/float(stat_dict[player]['saw_4'])
return (stat,
'%3.1f' % (100*stat) + '%',
'a4=%3.1f' % (100*stat) + '%',
@ -393,7 +398,7 @@ def a_freq_4(stat_dict, player):
def cb_1(stat_dict, player):
stat = 0.0
try:
stat = stat_dict[player]['CB_1']/stat_dict[player]['CB_opp_1']
stat = float(stat_dict[player]['CB_1'])/float(stat_dict[player]['CB_opp_1'])
return (stat,
'%3.1f' % (100*stat) + '%',
'cb1=%3.1f' % (100*stat) + '%',
@ -413,7 +418,7 @@ def cb_1(stat_dict, player):
def cb_2(stat_dict, player):
stat = 0.0
try:
stat = stat_dict[player]['CB_2']/stat_dict[player]['CB_opp_2']
stat = float(stat_dict[player]['CB_2'])/float(stat_dict[player]['CB_opp_2'])
return (stat,
'%3.1f' % (100*stat) + '%',
'cb2=%3.1f' % (100*stat) + '%',
@ -433,7 +438,7 @@ def cb_2(stat_dict, player):
def cb_3(stat_dict, player):
stat = 0.0
try:
stat = stat_dict[player]['CB_3']/stat_dict[player]['CB_opp_3']
stat = float(stat_dict[player]['CB_3'])/float(stat_dict[player]['CB_opp_3'])
return (stat,
'%3.1f' % (100*stat) + '%',
'cb3=%3.1f' % (100*stat) + '%',
@ -453,7 +458,7 @@ def cb_3(stat_dict, player):
def cb_4(stat_dict, player):
stat = 0.0
try:
stat = stat_dict[player]['CB_4']/stat_dict[player]['CB_opp_4']
stat = float(stat_dict[player]['CB_4'])/float(stat_dict[player]['CB_opp_4'])
return (stat,
'%3.1f' % (100*stat) + '%',
'cb4=%3.1f' % (100*stat) + '%',
@ -473,7 +478,7 @@ def cb_4(stat_dict, player):
def ffreq_1(stat_dict, player):
stat = 0.0
try:
stat = stat_dict[player]['f_freq_1']/stat_dict[player]['was_raised_1']
stat = float(stat_dict[player]['f_freq_1'])/float(stat_dict[player]['was_raised_1'])
return (stat,
'%3.1f' % (100*stat) + '%',
'ff1=%3.1f' % (100*stat) + '%',
@ -493,7 +498,7 @@ def ffreq_1(stat_dict, player):
def ffreq_2(stat_dict, player):
stat = 0.0
try:
stat = stat_dict[player]['f_freq_2']/stat_dict[player]['was_raised_2']
stat = float(stat_dict[player]['f_freq_2'])/float(stat_dict[player]['was_raised_2'])
return (stat,
'%3.1f' % (100*stat) + '%',
'ff2=%3.1f' % (100*stat) + '%',
@ -513,7 +518,7 @@ def ffreq_2(stat_dict, player):
def ffreq_3(stat_dict, player):
stat = 0.0
try:
stat = stat_dict[player]['f_freq_3']/stat_dict[player]['was_raised_3']
stat = float(stat_dict[player]['f_freq_3'])/float(stat_dict[player]['was_raised_3'])
return (stat,
'%3.1f' % (100*stat) + '%',
'ff3=%3.1f' % (100*stat) + '%',
@ -533,7 +538,7 @@ def ffreq_3(stat_dict, player):
def ffreq_4(stat_dict, player):
stat = 0.0
try:
stat = stat_dict[player]['f_freq_4']/stat_dict[player]['was_raised_4']
stat = float(stat_dict[player]['f_freq_4'])/float(stat_dict[player]['was_raised_4'])
return (stat,
'%3.1f' % (100*stat) + '%',
'ff4=%3.1f' % (100*stat) + '%',
@ -582,5 +587,13 @@ if __name__== "__main__":
print "player = ", player, do_stat(stat_dict, player = player, stat = 'ffreq_3')
print "player = ", player, do_stat(stat_dict, player = player, stat = 'ffreq_4')
# print "\n\nLegal stats:"
# for attr in dir():
# if attr.startswith('__'): continue
# if attr == 'Configuration' or attr == 'Database': continue
# if attr == 'GInitiallyUnowned': continue
# print attr.__doc__
#
# print vpip.__doc__
db_connection.close

View File

@ -225,7 +225,7 @@ class fpdb:
defaultpath+=("Application Data"+os.sep)
else:#ie. if real OS prefix fpdb with a . as it is convention
defaultpath+="."
defaultpath+=("fpdb"+os.sep+"profiles"+os.sep+"default.conf")
defaultpath+=("fpdb"+os.sep+os.sep+"default.conf")
if os.path.exists(defaultpath):
self.load_profile(defaultpath)
@ -376,7 +376,7 @@ This program is licensed under the AGPL3, see docs"""+os.sep+"agpl-3.0.txt")
self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
self.window.connect("delete_event", self.delete_event)
self.window.connect("destroy", self.destroy)
self.window.set_title("Free Poker DB - version: alpha1+, p65")
self.window.set_title("Free Poker DB - version: alpha1+, p66")
self.window.set_border_width(1)
self.window.set_size_request(1020,400)
self.window.set_resizable(True)

View File

@ -106,8 +106,8 @@ def import_file_dict(options, settings, callHud=True):
db.commit()
stored+=1
if settings['imp-callFpdbHud'] and callHud:
print "call to HUD here. handsId:",handsId
if settings['imp-callFpdbHud'] and callHud and os.sep=='/':
#print "call to HUD here. handsId:",handsId
# pipe the Hands.id out to the HUD
options.pipe_to_hud.stdin.write("%s\n" % (handsId))
db.commit()