diff --git a/pyfpdb/Database.py b/pyfpdb/Database.py index 60951098..981c686c 100755 --- a/pyfpdb/Database.py +++ b/pyfpdb/Database.py @@ -417,7 +417,7 @@ class Database: err = traceback.extract_tb(sys.exc_info()[2])[-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} , hero_id = -1 ): @@ -2542,12 +2542,12 @@ if __name__=="__main__": if 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(): print p, " ", stat_dict[p] #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(): # print p, " ", stat_dict[p] diff --git a/pyfpdb/HUD_main.py b/pyfpdb/HUD_main.py index 0f332b5e..23c1ef03 100755 --- a/pyfpdb/HUD_main.py +++ b/pyfpdb/HUD_main.py @@ -123,7 +123,8 @@ class HUD_main(object): del(self.hud_dict[table]) 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(): @@ -149,6 +150,18 @@ class HUD_main(object): self.hud_dict[table_name].table_name = table_name self.hud_dict[table_name].stat_dict = stat_dict 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] gobject.idle_add(idle_func) @@ -228,7 +241,7 @@ class HUD_main(object): # get stats using hud's specific params 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']) - 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: 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]) @@ -245,7 +258,7 @@ class HUD_main(object): try: # get stats using default params 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: 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]) @@ -262,7 +275,7 @@ class HUD_main(object): table_name = "%s %s" % (tour_number, tab_number) sys.stderr.write("table name "+table_name+" not found, skipping.\n") 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() except: err = traceback.extract_tb(sys.exc_info()[2])[-1] diff --git a/pyfpdb/Hud.py b/pyfpdb/Hud.py index 7e161f4a..cc8994b5 100644 --- a/pyfpdb/Hud.py +++ b/pyfpdb/Hud.py @@ -74,6 +74,7 @@ class Hud: self.site = table.site self.mw_created = False self.hud_params = parent.hud_params + self.stat_windows = {} self.popup_windows = {} @@ -150,7 +151,7 @@ class Hud: self.aggMenu = gtk.Menu() aggitem.set_submenu(self.aggMenu) # 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 self.aggMenu.append(item) item.connect("activate", self.set_aggregation) @@ -160,25 +161,25 @@ class Hud: self.aggMenu.append(item) setattr(self, 'showStatsMenuItem2', item) # - item = gtk.MenuItem(' 0.5 to 2.0 x Current Blinds') - item.ms = 2.01 + item = gtk.CheckMenuItem(' 0.5 to 2.0 x Current Blinds') + item.ms = 2 self.aggMenu.append(item) item.connect("activate", self.set_aggregation) setattr(self, 'showStatsMenuItem3', item) # - item = gtk.MenuItem(' 0.33 to 3.0 x Current Blinds') - item.ms = 3.01 + item = gtk.CheckMenuItem(' 0.33 to 3.0 x Current Blinds') + item.ms = 3 self.aggMenu.append(item) item.connect("activate", self.set_aggregation) setattr(self, 'showStatsMenuItem4', item) # - item = gtk.MenuItem(' 0.1 to 10 x Current Blinds') - item.ms = 10.01 + item = gtk.CheckMenuItem(' 0.1 to 10 x Current Blinds') + item.ms = 10 self.aggMenu.append(item) item.connect("activate", self.set_aggregation) setattr(self, 'showStatsMenuItem5', item) # - item = gtk.MenuItem(' All Levels') + item = gtk.CheckMenuItem(' All Levels') item.ms = 10000 self.aggMenu.append(item) item.connect("activate", self.set_aggregation) @@ -188,23 +189,26 @@ class Hud: self.aggMenu.append(item) setattr(self, 'showStatsMenuItem7', item) # - item = gtk.MenuItem(' All Time') - item.ms = 'HA' + item = gtk.CheckMenuItem(' All Time') self.aggMenu.append(item) - item.connect("activate", self.set_hud_style) - setattr(self, 'showStatsMenuItem8', item) + item.connect("activate", self.set_hud_style, 'HA') + setattr(self, 'HAStyleOption', item) # - item = gtk.MenuItem(' Session') - item.ms = 'HS' + item = gtk.CheckMenuItem(' Session') self.aggMenu.append(item) - item.connect("activate", self.set_hud_style) - setattr(self, 'showStatsMenuItem9', item) + item.connect("activate", self.set_hud_style, 'HS') + setattr(self, 'HSStyleOption', item) # - item = gtk.MenuItem(' %s Days' % (self.hud_params['h_hud_days'])) - item.ms = 'HT' + item = gtk.CheckMenuItem(' %s Days' % (self.hud_params['h_hud_days'])) self.aggMenu.append(item) - item.connect("activate", self.set_hud_style) - setattr(self, 'showStatsMenuItem11', item) + item.connect("activate", self.set_hud_style, 'HT') + 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) @@ -252,14 +256,26 @@ class Hud: print 'set_aggregation', 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: - if widget.ms[0] == 'H': + if val[0] == 'H': param = 'h_hud_style' else: 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): if os.name == 'nt':