diff --git a/pyfpdb/HUD_main.py b/pyfpdb/HUD_main.py index 996a92ac..8b7c8700 100755 --- a/pyfpdb/HUD_main.py +++ b/pyfpdb/HUD_main.py @@ -70,24 +70,24 @@ def create_HUD(new_hand_id, table, db_name, table_name, max, poker_game, db_conn try: hud_dict[table_name] = Hud.Hud(table, max, poker_game, config, db_name) hud_dict[table_name].create(new_hand_id, config) - hud_dict[table_name].update(new_hand_id, db_connection, config, stat_dict) + hud_dict[table_name].update(new_hand_id, config, stat_dict) return False finally: gtk.gdk.threads_leave gobject.idle_add(idle_func) -def update_HUD(new_hand_id, table_name, db_connection, config, stat_dict): +def update_HUD(new_hand_id, config, stat_dict): global hud_dict def idle_func(): gtk.threads_enter() try: - hud_dict[table_name].update(new_hand_id, db_connection, config, stat_dict) + hud_dict[table_name].update(new_hand_id, config, stat_dict) return False finally: gtk.threads_leave gobject.idle_add(idle_func) -def producer(): # This is the thread function +def read_stdin(): # This is the thread function global hud_dict while True: # wait for a new hand number on stdin @@ -109,7 +109,7 @@ def producer(): # This is the thread function # if a hud for this table exists, just update it if hud_dict.has_key(table_name): - update_HUD(new_hand_id, table_name, db_connection, config, stat_dict) + update_HUD(new_hand_id, config, stat_dict) # otherwise create a new hud else: table_windows = Tables.discover(config) @@ -130,7 +130,7 @@ if __name__== "__main__": config = Configuration.Config() gobject.threads_init() # this is required - thread.start_new_thread(producer, ()) # starts the thread + thread.start_new_thread(read_stdin, ()) # starts the thread main_window = gtk.Window() main_window.connect("destroy", destroy) diff --git a/pyfpdb/Hud.py b/pyfpdb/Hud.py index 611fd338..ddbffed4 100644 --- a/pyfpdb/Hud.py +++ b/pyfpdb/Hud.py @@ -99,12 +99,13 @@ class Hud: def on_window_event(self, widget, event): - if event.new_window_state & gtk.gdk.WINDOW_STATE_ICONIFIED: - for sw in self.stat_windows.keys(): - self.stat_windows[sw].window.iconify() - else: - for sw in self.stat_windows: - self.stat_windows[sw].window.deiconify() + if self.stacked: + if event.new_window_state & gtk.gdk.WINDOW_STATE_ICONIFIED: + for sw in self.stat_windows.keys(): + self.stat_windows[sw].window.iconify() + else: + for sw in self.stat_windows: + self.stat_windows[sw].window.deiconify() def kill_hud(self, args): for k in self.stat_windows.keys(): @@ -173,9 +174,8 @@ class Hud: # self.m = Mucked.Mucked(self.mucked_window, self.db_connection) # self.mucked_window.show_all() - def update(self, hand, db, config, stat_dict): + def update(self, hand, config, stat_dict): self.hand = hand # this is the last hand, so it is available later -# stat_dict = db.get_stats_from_hand(hand) for s in stat_dict.keys(): self.stat_windows[stat_dict[s]['seat']].player_id = stat_dict[s]['player_id'] for r in range(0, config.supported_games[self.poker_game].rows):