Make flop_mucked windows follow the table on Windows.

This commit is contained in:
Ray 2009-03-25 15:42:16 -04:00
parent a404f0f3ee
commit 9146758c5e
2 changed files with 16 additions and 3 deletions

View File

@ -204,6 +204,7 @@ class Hud:
def reposition_windows(self, *args): def reposition_windows(self, *args):
if self.stat_windows != {} and len(self.stat_windows) > 0: 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) (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 return True
def debug_stat_windows(self, *args): def debug_stat_windows(self, *args):

View File

@ -39,15 +39,19 @@ import Database
class Aux_Window: class Aux_Window:
def __init__(self, hud, params, config): def __init__(self, hud, params, config):
self.hud = hud self.hud = hud
self.params = params
self.config = config self.config = config
def update_data(self, *parms): def update_data(self, *args):
pass pass
def update_gui(self, *parms): def update_gui(self, *args):
pass pass
def create(self, *parms): def create(self, *args):
pass
def relocate(self, *args):
pass pass
def save_layout(self, *args): 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.config = config # configuration object for this aux window to use
self.params = params # dict aux params from config self.params = params # dict aux params from config
self.positions = {} # dict of window positions self.positions = {} # dict of window positions
self.rel_positions = {} # dict of window positions, relative to the table origin
self.displayed_cards = False self.displayed_cards = False
self.timer_on = False # bool = Ture if the timeout for removing the cards is on self.timer_on = False # bool = Ture if the timeout for removing the cards is on
self.card_images = self.get_card_images() 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.seen_cards[i] = gtk.image_new_from_pixbuf(self.card_images[('B', 'H')])
self.eb[i].add(self.seen_cards[i]) self.eb[i].add(self.seen_cards[i])
self.positions[i] = (int(x) + self.hud.table.x, int(y) + self.hud.table.y) 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].move(self.positions[i][0], self.positions[i][1])
self.m_windows[i].set_opacity(float(self.params['opacity'])) self.m_windows[i].set_opacity(float(self.params['opacity']))
self.m_windows[i].show_all() self.m_windows[i].show_all()
@ -434,6 +440,12 @@ class Flop_Mucked(Aux_Window):
def configure_event_cb(self, widget, event, i, *args): def configure_event_cb(self, widget, event, i, *args):
self.positions[i] = widget.get_position() 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): def expose_all(self):
for (i, cards) in self.hud.cards.iteritems(): for (i, cards) in self.hud.cards.iteritems():