update_table_position will kill huds that are closed, timer will not be called when under unix, currently, as this function only works in windows.

checkPositions() accepts position 9 again.
This commit is contained in:
eblade 2008-12-15 02:04:35 -05:00
parent 65e43a34e6
commit 691608b6ca
2 changed files with 12 additions and 3 deletions

View File

@ -123,6 +123,15 @@ class Hud:
self.main_window.set_destroy_with_parent(True)
def update_table_position(self):
# self.main_window.parentgdkhandle = gtk.gdk.window_foreign_new(self.table.number)
# if self.main_window.parentgdkhandle == None:
if os.name == 'nt':
if not win32gui.IsWindow(self.table.number):
self.kill_hud()
return False
else:
return False # kill the timer under Unix, and ignore it until we have a way to check the validity of the window.
(x, y) = self.main_window.parentgdkhandle.get_origin()
if self.table.x != x or self.table.y != y:
self.table.x = x
@ -134,7 +143,7 @@ class Hud:
(x, y) = loc[adj[i]]
if self.stat_windows.has_key(i):
self.stat_windows[i].relocate(x, y)
return True
def on_button_press(self, widget, event):
@ -229,7 +238,7 @@ class Hud:
aux_params = config.get_aux_parameters(game_params['aux'])
self.aux_windows.append(eval("%s.%s(gtk.Window(), self, config, 'fpdb')" % (aux_params['module'], aux_params['class'])))
# gobject.timeout_add(500, self.update_table_position)
gobject.timeout_add(500, self.update_table_position)
def update(self, hand, config, stat_dict):
self.hand = hand # this is the last hand, so it is available later

View File

@ -90,7 +90,7 @@ def checkPositions(positions):
pass
### RHH modified to allow for "position 9" here (pos==9 is when you're a dead hand before the BB
if (pos!="B" and pos!="S" and pos!=0 and pos!=1 and pos!=2 and pos!=3 and pos!=4 and pos!=5 and pos!=6 and pos!=7 and pos!=9):
if (pos!="B" and pos!="S" and pos!=0 and pos!=1 and pos!=2 and pos!=3 and pos!=4 and pos!=5 and pos!=6 and pos!=7 and pos != 8 and pos!=9):
raise FpdbError("invalid position found in checkPositions. i: "+str(i)+" position: "+str(pos))
#end def fpdb_simple.checkPositions