From 9146758c5ef4680231841c8ce144c132a6d88348 Mon Sep 17 00:00:00 2001 From: Ray Date: Wed, 25 Mar 2009 15:42:16 -0400 Subject: [PATCH] Make flop_mucked windows follow the table on Windows. --- pyfpdb/Hud.py | 1 + pyfpdb/Mucked.py | 18 +++++++++++++++--- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/pyfpdb/Hud.py b/pyfpdb/Hud.py index 3fa677b6..db665d57 100644 --- a/pyfpdb/Hud.py +++ b/pyfpdb/Hud.py @@ -204,6 +204,7 @@ class Hud: def reposition_windows(self, *args): if self.stat_windows != {} and len(self.stat_windows) > 0: (x.window.move(x.x, x.y) for x in self.stat_windows.itervalues() if type(x) != int) + [aw.relocate(self.hud.x, self.hud.y) for aw in self.aux_windows] return True def debug_stat_windows(self, *args): diff --git a/pyfpdb/Mucked.py b/pyfpdb/Mucked.py index 9f8d6244..7df73e2b 100755 --- a/pyfpdb/Mucked.py +++ b/pyfpdb/Mucked.py @@ -39,15 +39,19 @@ import Database class Aux_Window: def __init__(self, hud, params, config): self.hud = hud + self.params = params self.config = config - def update_data(self, *parms): + def update_data(self, *args): pass - def update_gui(self, *parms): + def update_gui(self, *args): pass - def create(self, *parms): + def create(self, *args): + pass + + def relocate(self, *args): pass def save_layout(self, *args): @@ -321,6 +325,7 @@ class Flop_Mucked(Aux_Window): self.config = config # configuration object for this aux window to use self.params = params # dict aux params from config self.positions = {} # dict of window positions + self.rel_positions = {} # dict of window positions, relative to the table origin self.displayed_cards = False self.timer_on = False # bool = Ture if the timeout for removing the cards is on self.card_images = self.get_card_images() @@ -350,6 +355,7 @@ class Flop_Mucked(Aux_Window): self.seen_cards[i] = gtk.image_new_from_pixbuf(self.card_images[('B', 'H')]) self.eb[i].add(self.seen_cards[i]) self.positions[i] = (int(x) + self.hud.table.x, int(y) + self.hud.table.y) + self.rel_positions[i] = (int(x), int(y)) self.m_windows[i].move(self.positions[i][0], self.positions[i][1]) self.m_windows[i].set_opacity(float(self.params['opacity'])) self.m_windows[i].show_all() @@ -434,6 +440,12 @@ class Flop_Mucked(Aux_Window): def configure_event_cb(self, widget, event, i, *args): self.positions[i] = widget.get_position() + self.rel_positions[i] = (self.positions[i][0] - hud.table.x, self.positions[i][1] - hud.table.y) + + def relocate(self, x, y): + for i, w in self.m_windows.iteritems(): + self.positons[i] = (x + self.rel_positions[i][0], y + self.rel_positions[i][1]) + self.m_windows.move(self.positions[i]) def expose_all(self): for (i, cards) in self.hud.cards.iteritems():