From 4d45bd39d3b18c83b55637f38ee6ec6f8cbc6e83 Mon Sep 17 00:00:00 2001 From: sqlcoder Date: Thu, 4 Feb 2010 23:08:09 +0000 Subject: [PATCH 1/2] make enabled sites come first in drop-down (i.e. more chance of the default being the one you want) --- pyfpdb/GuiBulkImport.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/pyfpdb/GuiBulkImport.py b/pyfpdb/GuiBulkImport.py index 96842134..84828493 100755 --- a/pyfpdb/GuiBulkImport.py +++ b/pyfpdb/GuiBulkImport.py @@ -243,7 +243,17 @@ class GuiBulkImport(): # ComboBox - filter self.cbfilter = gtk.combo_box_new_text() + disabled_sites = [] # move disabled sites to bottom of list for w in self.config.hhcs: + try: + if self.config.supported_sites[w].enabled: # include enabled ones first + print w + self.cbfilter.append_text(w) + else: + disabled_sites.append(w) + except: # self.supported_sites[w] may not exist if hud_config is bad + disabled_sites.append(w) + for w in disabled_sites: # then disabled ones print w self.cbfilter.append_text(w) self.cbfilter.set_active(0) From ef2a8aca14f5c6862f17b725a2fdfec1a3dd69f9 Mon Sep 17 00:00:00 2001 From: sqlcoder Date: Thu, 4 Feb 2010 23:37:45 +0000 Subject: [PATCH 2/2] remove duplicate db calls which were slowing the hud down --- pyfpdb/HUD_main.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/pyfpdb/HUD_main.py b/pyfpdb/HUD_main.py index bae58825..7e809332 100755 --- a/pyfpdb/HUD_main.py +++ b/pyfpdb/HUD_main.py @@ -245,10 +245,6 @@ class HUD_main(object): ,self.hero_ids[site_id], num_seats) t3 = time.time() try: - 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']) - t4 = time.time() - 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]) self.hud_dict[temp_key].stat_dict = stat_dict except KeyError: # HUD instance has been killed off, key is stale sys.stderr.write('hud_dict[%s] was not found\n' % temp_key) @@ -256,9 +252,10 @@ class HUD_main(object): # Unlocks table, copied from end of function self.db_connection.connection.rollback() return - t5 = time.time() cards = self.db_connection.get_cards(new_hand_id) + t4 = time.time() comm_cards = self.db_connection.get_common_cards(new_hand_id) + t5 = time.time() if comm_cards != {}: # stud! cards['common'] = comm_cards['common'] self.hud_dict[temp_key].cards = cards