From 4b3fe3dfa2fb35d3f2194d611b3385390fc43c6f Mon Sep 17 00:00:00 2001 From: Eric Blade Date: Mon, 27 Sep 2010 04:04:56 -0400 Subject: [PATCH] fix conflicts between ray's new window move code and my old window move code Ray: when you finish implementing yours, please adapt and/or disable Hud::update_table_position --- pyfpdb/Hud.py | 16 +++++++++------- pyfpdb/TableWindow.py | 3 +++ pyfpdb/WinTables.py | 1 + 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/pyfpdb/Hud.py b/pyfpdb/Hud.py index 011b329c..6b4737e5 100644 --- a/pyfpdb/Hud.py +++ b/pyfpdb/Hud.py @@ -472,17 +472,19 @@ class Hud: return False # anyone know how to do this in unix, or better yet, trap the X11 error that is triggered when executing the get_origin() for a closed window? if self.table.gdkhandle is not None: - (x, y) = self.table.gdkhandle.get_origin() # In Windows, this call returns (0,0) if it's an invalid window. In X, the X server is immediately killed. - if self.table.x != x or self.table.y != y: # If the current position does not equal the stored position, save the new position, and then move all the sub windows. - self.table.x = x - self.table.y = y - self.main_window.move(x + self.site_params['xshift'], y + self.site_params['yshift']) + (oldx, oldy) = self.table.gdkhandle.get_origin() # In Windows, this call returns (0,0) if it's an invalid window. In X, the X server is immediately killed. + #(x, y, width, height) = self.table.get_geometry() + #print "self.table.get_geometry=",x,y,width,height + if self.table.oldx != oldx or self.table.oldy != oldy: # If the current position does not equal the stored position, save the new position, and then move all the sub windows. + self.table.oldx = oldx + self.table.oldy = oldy + self.main_window.move(oldx + self.site_params['xshift'], oldy + self.site_params['yshift']) adj = self.adj_seats(self.hand, self.config) loc = self.config.get_locations(self.table.site, self.max) # TODO: is stat_windows getting converted somewhere from a list to a dict, for no good reason? for i, w in enumerate(self.stat_windows.itervalues()): - (x, y) = loc[adj[i+1]] - w.relocate(x, y) + (oldx, oldy) = loc[adj[i+1]] + w.relocate(oldx, oldy) # While we're at it, fix the positions of mucked cards too for aux in self.aux_windows: diff --git a/pyfpdb/TableWindow.py b/pyfpdb/TableWindow.py index 0750ad75..761be73b 100644 --- a/pyfpdb/TableWindow.py +++ b/pyfpdb/TableWindow.py @@ -141,6 +141,8 @@ class Table_Window(object): self.height = geo['height'] self.x = geo['x'] self.y = geo['y'] + self.oldx = self.x # attn ray: remove these two lines and update Hud.py::update_table_position() + self.oldy = self.y self.game = self.get_game() @@ -238,6 +240,7 @@ class Table_Window(object): return "client_destroyed" if self.x != new_geo['x'] or self.y != new_geo['y']: # window moved + print self.x, self.y, new_geo['x'], new_geo['y'] self.x = new_geo['x'] self.y = new_geo['y'] return "client_moved" diff --git a/pyfpdb/WinTables.py b/pyfpdb/WinTables.py index 331714bb..442aeaa2 100644 --- a/pyfpdb/WinTables.py +++ b/pyfpdb/WinTables.py @@ -80,6 +80,7 @@ class Table(Table_Window): try: (x, y, width, height) = win32gui.GetWindowRect(self.number) + #print "x=",x,"y=",y,"width=",width,"height=",height width = width - x height = height - y return {'x' : int(x) + b_width,