fix bug for tourneys in new code, modify part of hud menu to use checkmenuitems
This commit is contained in:
parent
16f8fffd68
commit
2b7a42bf1d
|
@ -417,7 +417,7 @@ class Database:
|
||||||
err = traceback.extract_tb(sys.exc_info()[2])[-1]
|
err = traceback.extract_tb(sys.exc_info()[2])[-1]
|
||||||
print "***Error: "+err[2]+"("+str(err[1])+"): "+str(sys.exc_info()[1])
|
print "***Error: "+err[2]+"("+str(err[1])+"): "+str(sys.exc_info()[1])
|
||||||
|
|
||||||
def get_stats_from_hand( self, hand
|
def get_stats_from_hand( self, hand, type # type is "ring" or "tour"
|
||||||
, hud_params = {'aggregate_tour':False, 'aggregate_ring':False, 'hud_style':'A', 'agg_bb_mult':100}
|
, hud_params = {'aggregate_tour':False, 'aggregate_ring':False, 'hud_style':'A', 'agg_bb_mult':100}
|
||||||
, hero_id = -1
|
, hero_id = -1
|
||||||
):
|
):
|
||||||
|
@ -2542,12 +2542,12 @@ if __name__=="__main__":
|
||||||
if hero:
|
if hero:
|
||||||
print "nutOmatic is id_player = %d" % hero
|
print "nutOmatic is id_player = %d" % hero
|
||||||
|
|
||||||
stat_dict = db_connection.get_stats_from_hand(h)
|
stat_dict = db_connection.get_stats_from_hand(h, "ring")
|
||||||
for p in stat_dict.keys():
|
for p in stat_dict.keys():
|
||||||
print p, " ", stat_dict[p]
|
print p, " ", stat_dict[p]
|
||||||
|
|
||||||
#print "nutOmatics stats:"
|
#print "nutOmatics stats:"
|
||||||
#stat_dict = db_connection.get_stats_from_hand(h, hero)
|
#stat_dict = db_connection.get_stats_from_hand(h, "ring")
|
||||||
#for p in stat_dict.keys():
|
#for p in stat_dict.keys():
|
||||||
# print p, " ", stat_dict[p]
|
# print p, " ", stat_dict[p]
|
||||||
|
|
||||||
|
|
|
@ -123,7 +123,8 @@ class HUD_main(object):
|
||||||
del(self.hud_dict[table])
|
del(self.hud_dict[table])
|
||||||
self.main_window.resize(1,1)
|
self.main_window.resize(1,1)
|
||||||
|
|
||||||
def create_HUD(self, new_hand_id, table, table_name, max, poker_game, stat_dict, cards):
|
def create_HUD(self, new_hand_id, table, table_name, max, poker_game, type, stat_dict, cards):
|
||||||
|
"""type is "ring" or "tour" used to set hud_params"""
|
||||||
|
|
||||||
def idle_func():
|
def idle_func():
|
||||||
|
|
||||||
|
@ -149,6 +150,18 @@ class HUD_main(object):
|
||||||
self.hud_dict[table_name].table_name = table_name
|
self.hud_dict[table_name].table_name = table_name
|
||||||
self.hud_dict[table_name].stat_dict = stat_dict
|
self.hud_dict[table_name].stat_dict = stat_dict
|
||||||
self.hud_dict[table_name].cards = cards
|
self.hud_dict[table_name].cards = cards
|
||||||
|
|
||||||
|
if type == "tour" and self.hud_params['aggregate_tour'] == False:
|
||||||
|
self.hud_dict[table_name].hud_params['agg_bb_mult'] = 1
|
||||||
|
elif type == "ring" and self.hud_params['aggregate_ring'] == False:
|
||||||
|
self.hud_dict[table_name].hud_params['agg_bb_mult'] = 1
|
||||||
|
if type == "tour" and self.hud_params['h_aggregate_tour'] == False:
|
||||||
|
self.hud_dict[table_name].hud_params['h_agg_bb_mult'] = 1
|
||||||
|
elif type == "ring" and self.hud_params['h_aggregate_ring'] == False:
|
||||||
|
self.hud_dict[table_name].hud_params['h_agg_bb_mult'] = 1
|
||||||
|
self.hud_params['aggregate_ring'] == True
|
||||||
|
self.hud_params['h_aggregate_ring'] == True
|
||||||
|
|
||||||
[aw.update_data(new_hand_id, self.db_connection) for aw in self.hud_dict[table_name].aux_windows]
|
[aw.update_data(new_hand_id, self.db_connection) for aw in self.hud_dict[table_name].aux_windows]
|
||||||
gobject.idle_add(idle_func)
|
gobject.idle_add(idle_func)
|
||||||
|
|
||||||
|
@ -228,7 +241,7 @@ class HUD_main(object):
|
||||||
# get stats using hud's specific params
|
# get stats using hud's specific params
|
||||||
self.db_connection.init_hud_stat_vars( self.hud_dict[temp_key].hud_params['hud_days']
|
self.db_connection.init_hud_stat_vars( self.hud_dict[temp_key].hud_params['hud_days']
|
||||||
, self.hud_dict[temp_key].hud_params['h_hud_days'])
|
, self.hud_dict[temp_key].hud_params['h_hud_days'])
|
||||||
stat_dict = self.db_connection.get_stats_from_hand(new_hand_id, self.hud_dict[temp_key].hud_params, self.hero_ids[site_id])
|
stat_dict = self.db_connection.get_stats_from_hand(new_hand_id, type, self.hud_dict[temp_key].hud_params, self.hero_ids[site_id])
|
||||||
except:
|
except:
|
||||||
err = traceback.extract_tb(sys.exc_info()[2])[-1]
|
err = traceback.extract_tb(sys.exc_info()[2])[-1]
|
||||||
print "db get_stats error: skipping "+str(new_hand_id)+" "+err[2]+"("+str(err[1])+"): "+str(sys.exc_info()[1])
|
print "db get_stats error: skipping "+str(new_hand_id)+" "+err[2]+"("+str(err[1])+"): "+str(sys.exc_info()[1])
|
||||||
|
@ -245,7 +258,7 @@ class HUD_main(object):
|
||||||
try:
|
try:
|
||||||
# get stats using default params
|
# get stats using default params
|
||||||
self.db_connection.init_hud_stat_vars( self.hud_params['hud_days'], self.hud_params['h_hud_days'] )
|
self.db_connection.init_hud_stat_vars( self.hud_params['hud_days'], self.hud_params['h_hud_days'] )
|
||||||
stat_dict = self.db_connection.get_stats_from_hand(new_hand_id, self.hud_params, self.hero_ids[site_id])
|
stat_dict = self.db_connection.get_stats_from_hand(new_hand_id, type, self.hud_params, self.hero_ids[site_id])
|
||||||
except:
|
except:
|
||||||
err = traceback.extract_tb(sys.exc_info()[2])[-1]
|
err = traceback.extract_tb(sys.exc_info()[2])[-1]
|
||||||
print "db get_stats error: skipping "+str(new_hand_id)+" "+err[2]+"("+str(err[1])+"): "+str(sys.exc_info()[1])
|
print "db get_stats error: skipping "+str(new_hand_id)+" "+err[2]+"("+str(err[1])+"): "+str(sys.exc_info()[1])
|
||||||
|
@ -262,7 +275,7 @@ class HUD_main(object):
|
||||||
table_name = "%s %s" % (tour_number, tab_number)
|
table_name = "%s %s" % (tour_number, tab_number)
|
||||||
sys.stderr.write("table name "+table_name+" not found, skipping.\n")
|
sys.stderr.write("table name "+table_name+" not found, skipping.\n")
|
||||||
else:
|
else:
|
||||||
self.create_HUD(new_hand_id, tablewindow, temp_key, max, poker_game, stat_dict, cards)
|
self.create_HUD(new_hand_id, tablewindow, temp_key, max, poker_game, type, stat_dict, cards)
|
||||||
self.db_connection.connection.rollback()
|
self.db_connection.connection.rollback()
|
||||||
except:
|
except:
|
||||||
err = traceback.extract_tb(sys.exc_info()[2])[-1]
|
err = traceback.extract_tb(sys.exc_info()[2])[-1]
|
||||||
|
|
|
@ -74,6 +74,7 @@ class Hud:
|
||||||
self.site = table.site
|
self.site = table.site
|
||||||
self.mw_created = False
|
self.mw_created = False
|
||||||
self.hud_params = parent.hud_params
|
self.hud_params = parent.hud_params
|
||||||
|
|
||||||
|
|
||||||
self.stat_windows = {}
|
self.stat_windows = {}
|
||||||
self.popup_windows = {}
|
self.popup_windows = {}
|
||||||
|
@ -150,7 +151,7 @@ class Hud:
|
||||||
self.aggMenu = gtk.Menu()
|
self.aggMenu = gtk.Menu()
|
||||||
aggitem.set_submenu(self.aggMenu)
|
aggitem.set_submenu(self.aggMenu)
|
||||||
# set agg_bb_mult to 1 to stop aggregation
|
# set agg_bb_mult to 1 to stop aggregation
|
||||||
item = gtk.MenuItem('For This Blind Level')
|
item = gtk.CheckMenuItem('For This Blind Level Only')
|
||||||
item.ms = 1
|
item.ms = 1
|
||||||
self.aggMenu.append(item)
|
self.aggMenu.append(item)
|
||||||
item.connect("activate", self.set_aggregation)
|
item.connect("activate", self.set_aggregation)
|
||||||
|
@ -160,25 +161,25 @@ class Hud:
|
||||||
self.aggMenu.append(item)
|
self.aggMenu.append(item)
|
||||||
setattr(self, 'showStatsMenuItem2', item)
|
setattr(self, 'showStatsMenuItem2', item)
|
||||||
#
|
#
|
||||||
item = gtk.MenuItem(' 0.5 to 2.0 x Current Blinds')
|
item = gtk.CheckMenuItem(' 0.5 to 2.0 x Current Blinds')
|
||||||
item.ms = 2.01
|
item.ms = 2
|
||||||
self.aggMenu.append(item)
|
self.aggMenu.append(item)
|
||||||
item.connect("activate", self.set_aggregation)
|
item.connect("activate", self.set_aggregation)
|
||||||
setattr(self, 'showStatsMenuItem3', item)
|
setattr(self, 'showStatsMenuItem3', item)
|
||||||
#
|
#
|
||||||
item = gtk.MenuItem(' 0.33 to 3.0 x Current Blinds')
|
item = gtk.CheckMenuItem(' 0.33 to 3.0 x Current Blinds')
|
||||||
item.ms = 3.01
|
item.ms = 3
|
||||||
self.aggMenu.append(item)
|
self.aggMenu.append(item)
|
||||||
item.connect("activate", self.set_aggregation)
|
item.connect("activate", self.set_aggregation)
|
||||||
setattr(self, 'showStatsMenuItem4', item)
|
setattr(self, 'showStatsMenuItem4', item)
|
||||||
#
|
#
|
||||||
item = gtk.MenuItem(' 0.1 to 10 x Current Blinds')
|
item = gtk.CheckMenuItem(' 0.1 to 10 x Current Blinds')
|
||||||
item.ms = 10.01
|
item.ms = 10
|
||||||
self.aggMenu.append(item)
|
self.aggMenu.append(item)
|
||||||
item.connect("activate", self.set_aggregation)
|
item.connect("activate", self.set_aggregation)
|
||||||
setattr(self, 'showStatsMenuItem5', item)
|
setattr(self, 'showStatsMenuItem5', item)
|
||||||
#
|
#
|
||||||
item = gtk.MenuItem(' All Levels')
|
item = gtk.CheckMenuItem(' All Levels')
|
||||||
item.ms = 10000
|
item.ms = 10000
|
||||||
self.aggMenu.append(item)
|
self.aggMenu.append(item)
|
||||||
item.connect("activate", self.set_aggregation)
|
item.connect("activate", self.set_aggregation)
|
||||||
|
@ -188,23 +189,26 @@ class Hud:
|
||||||
self.aggMenu.append(item)
|
self.aggMenu.append(item)
|
||||||
setattr(self, 'showStatsMenuItem7', item)
|
setattr(self, 'showStatsMenuItem7', item)
|
||||||
#
|
#
|
||||||
item = gtk.MenuItem(' All Time')
|
item = gtk.CheckMenuItem(' All Time')
|
||||||
item.ms = 'HA'
|
|
||||||
self.aggMenu.append(item)
|
self.aggMenu.append(item)
|
||||||
item.connect("activate", self.set_hud_style)
|
item.connect("activate", self.set_hud_style, 'HA')
|
||||||
setattr(self, 'showStatsMenuItem8', item)
|
setattr(self, 'HAStyleOption', item)
|
||||||
#
|
#
|
||||||
item = gtk.MenuItem(' Session')
|
item = gtk.CheckMenuItem(' Session')
|
||||||
item.ms = 'HS'
|
|
||||||
self.aggMenu.append(item)
|
self.aggMenu.append(item)
|
||||||
item.connect("activate", self.set_hud_style)
|
item.connect("activate", self.set_hud_style, 'HS')
|
||||||
setattr(self, 'showStatsMenuItem9', item)
|
setattr(self, 'HSStyleOption', item)
|
||||||
#
|
#
|
||||||
item = gtk.MenuItem(' %s Days' % (self.hud_params['h_hud_days']))
|
item = gtk.CheckMenuItem(' %s Days' % (self.hud_params['h_hud_days']))
|
||||||
item.ms = 'HT'
|
|
||||||
self.aggMenu.append(item)
|
self.aggMenu.append(item)
|
||||||
item.connect("activate", self.set_hud_style)
|
item.connect("activate", self.set_hud_style, 'HT')
|
||||||
setattr(self, 'showStatsMenuItem11', item)
|
setattr(self, 'HTStyleOption', item)
|
||||||
|
if self.hud_params['h_hud_style'] == 'A':
|
||||||
|
item.set_active(True)
|
||||||
|
if self.hud_params['h_hud_style'] == 'S':
|
||||||
|
item.set_active(True)
|
||||||
|
if self.hud_params['h_hud_style'] == 'T':
|
||||||
|
item.set_active(True)
|
||||||
|
|
||||||
eventbox.connect_object("button-press-event", self.on_button_press, menu)
|
eventbox.connect_object("button-press-event", self.on_button_press, menu)
|
||||||
|
|
||||||
|
@ -252,14 +256,26 @@ class Hud:
|
||||||
print 'set_aggregation', widget.ms
|
print 'set_aggregation', widget.ms
|
||||||
self.hud_params['agg_bb_mult'] = widget.ms
|
self.hud_params['agg_bb_mult'] = widget.ms
|
||||||
|
|
||||||
def set_hud_style(self, widget):
|
def set_hud_style(self, widget, val):
|
||||||
# try setting these to true all the time, and set the multiplier to 1 to turn agg off:
|
# try setting these to true all the time, and set the multiplier to 1 to turn agg off:
|
||||||
if widget.ms[0] == 'H':
|
if val[0] == 'H':
|
||||||
param = 'h_hud_style'
|
param = 'h_hud_style'
|
||||||
else:
|
else:
|
||||||
param = 'hud_style'
|
param = 'hud_style'
|
||||||
self.hud_params[param] = widget.ms[1]
|
|
||||||
print "setting self.hud_params[%s] = %s" % (param,widget.ms[1])
|
if val[1] == 'A' and getattr(self, 'HAStyleOption').get_active():
|
||||||
|
self.hud_params[param] = 'A'
|
||||||
|
getattr(self, 'HSStyleOption').set_active(False)
|
||||||
|
getattr(self, 'HTStyleOption').set_active(False)
|
||||||
|
elif val[1] == 'S' and getattr(self, 'HSStyleOption').get_active():
|
||||||
|
self.hud_params[param] = 'S'
|
||||||
|
getattr(self, 'HAStyleOption').set_active(False)
|
||||||
|
getattr(self, 'HTStyleOption').set_active(False)
|
||||||
|
elif val[1] == 'T' and self.HTStyleOption.get_active():
|
||||||
|
self.hud_params[param] = 'T'
|
||||||
|
getattr(self, 'HAStyleOption').set_active(False)
|
||||||
|
getattr(self, 'HSStyleOption').set_active(False)
|
||||||
|
print "setting self.hud_params[%s] = %s" % (param, val[1])
|
||||||
|
|
||||||
def update_table_position(self):
|
def update_table_position(self):
|
||||||
if os.name == 'nt':
|
if os.name == 'nt':
|
||||||
|
|
Loading…
Reference in New Issue
Block a user