Reenable following of dragged client window.

This commit is contained in:
Eratosthenes 2010-11-17 23:36:59 -05:00
parent bb4b61a3d9
commit 3670050abe
3 changed files with 20 additions and 7 deletions

9
pyfpdb/HUD_main.pyw Executable file → Normal file
View File

@ -130,7 +130,7 @@ class HUD_main(object):
else:
self.main_window.set_icon_stock(gtk.STOCK_HOME)
self.main_window.show_all()
# gobject.timeout_add(100, self.check_tables)
gobject.timeout_add(100, self.check_tables)
except:
log.error("*** Exception in HUD_main.init() *** ")
@ -138,15 +138,12 @@ class HUD_main(object):
log.error(e)
def client_moved(self, widget, hud):
print "hud_main: client moved"
print hud, hud.table.name, "moved", hud.table.x, hud.table.y
hud.up_update_table_position()
def client_resized(self, widget, hud):
print _("hud_main: Client resized")
print hud, hud.table.name, hud.table.x, hud.table.y
pass
def client_destroyed(self, widget, hud): # call back for terminating the main eventloop
print _("hud_main: Client destroyed")
self.kill_hud(None, hud.table.name)
def game_changed(self, widget, hud):

View File

@ -495,6 +495,22 @@ class Hud:
return True
def up_update_table_position(self):
# callback for table moved
# move the stat windows
adj = self.adj_seats(self.hand, self.config)
loc = self.config.get_locations(self.table.site, self.max)
for i, w in enumerate(self.stat_windows.itervalues()):
(x, y) = loc[adj[i+1]]
w.relocate(x, y)
# move the main window
self.main_window.move(self.table.x + self.site_params['xshift'], self.table.y + self.site_params['yshift'])
# and move any auxs
for aux in self.aux_windows:
aux.update_card_positions()
return True
def on_button_press(self, widget, event):
if event.button == 1: # if primary button, start movement
self.main_window.begin_move_drag(event.button, int(event.x_root), int(event.y_root), event.time)

View File

@ -245,7 +245,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']
# print self.x, self.y, new_geo['x'], new_geo['y']
self.x = new_geo['x']
self.y = new_geo['y']
return "client_moved"