re-enable exception handling in idle_func() now that i know what we could expect to trap reasonably. Deal in update() with what might happen if update_table_position() fails
This commit is contained in:
		
							parent
							
								
									a735ab67b2
								
							
						
					
					
						commit
						9bf5017ff1
					
				| 
						 | 
					@ -159,10 +159,14 @@ class HUD_main(object):
 | 
				
			||||||
#    function idle_func() to be run by the gui thread, at its leisure.
 | 
					#    function idle_func() to be run by the gui thread, at its leisure.
 | 
				
			||||||
        def idle_func():
 | 
					        def idle_func():
 | 
				
			||||||
            gtk.gdk.threads_enter()
 | 
					            gtk.gdk.threads_enter()
 | 
				
			||||||
#            try:
 | 
					 | 
				
			||||||
            self.hud_dict[table_name].update(new_hand_id, config)
 | 
					            self.hud_dict[table_name].update(new_hand_id, config)
 | 
				
			||||||
 | 
					            # The HUD could get destroyed in the above call ^^, which leaves us with a KeyError here vv
 | 
				
			||||||
 | 
					            # if we ever get an error we need to expect ^^ then we need to handle it vv - Eric
 | 
				
			||||||
 | 
					            try:
 | 
				
			||||||
                [aw.update_gui(new_hand_id) for aw in self.hud_dict[table_name].aux_windows]
 | 
					                [aw.update_gui(new_hand_id) for aw in self.hud_dict[table_name].aux_windows]
 | 
				
			||||||
#            finally:
 | 
					            except KeyError:
 | 
				
			||||||
 | 
					                pass
 | 
				
			||||||
 | 
					            finally:
 | 
				
			||||||
                gtk.gdk.threads_leave()
 | 
					                gtk.gdk.threads_leave()
 | 
				
			||||||
            return False
 | 
					            return False
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -198,7 +202,7 @@ class HUD_main(object):
 | 
				
			||||||
            try:
 | 
					            try:
 | 
				
			||||||
                (table_name, max, poker_game, type, site_id, site_name, tour_number, tab_number) = \
 | 
					                (table_name, max, poker_game, type, site_id, site_name, tour_number, tab_number) = \
 | 
				
			||||||
                                self.db_connection.get_table_info(new_hand_id)
 | 
					                                self.db_connection.get_table_info(new_hand_id)
 | 
				
			||||||
            except Exception, err:
 | 
					            except Exception, err: # TODO: we need to make this a much less generic Exception lulz
 | 
				
			||||||
                print "db error: skipping %s" % new_hand_id
 | 
					                print "db error: skipping %s" % new_hand_id
 | 
				
			||||||
                sys.stderr.write("Database error: could not find hand %s.\n" % new_hand_id)
 | 
					                sys.stderr.write("Database error: could not find hand %s.\n" % new_hand_id)
 | 
				
			||||||
                continue
 | 
					                continue
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -530,7 +530,8 @@ class Hud:
 | 
				
			||||||
    def update(self, hand, config):
 | 
					    def update(self, hand, config):
 | 
				
			||||||
        self.hand = hand   # this is the last hand, so it is available later
 | 
					        self.hand = hand   # this is the last hand, so it is available later
 | 
				
			||||||
        if os.name == 'nt':
 | 
					        if os.name == 'nt':
 | 
				
			||||||
            self.update_table_position()
 | 
					            if self.update_table_position() == False: # we got killed by finding our table was gone
 | 
				
			||||||
 | 
					                return
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        for s in self.stat_dict:
 | 
					        for s in self.stat_dict:
 | 
				
			||||||
            try:
 | 
					            try:
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user