Merge branch 'master' of git://repo.or.cz/fpbd-bostik

This commit is contained in:
grindi 2009-08-16 02:07:54 +04:00
commit 6133d0f9bb
2 changed files with 30 additions and 1 deletions

View File

@ -211,6 +211,11 @@ class Hud:
for i, w in enumerate(self.stat_windows.itervalues()): for i, w in enumerate(self.stat_windows.itervalues()):
(x, y) = loc[adj[i+1]] (x, y) = loc[adj[i+1]]
w.relocate(x, y) w.relocate(x, y)
# While we're at it, fix the positions of mucked cards too
for aux in self.aux_windows:
aux.update_card_positions()
return True return True
def on_button_press(self, widget, event): def on_button_press(self, widget, event):
@ -235,6 +240,7 @@ class Hud:
self.aux_windows = [] self.aux_windows = []
def reposition_windows(self, *args): def reposition_windows(self, *args):
self.update_table_position()
for w in self.stat_windows.itervalues(): for w in self.stat_windows.itervalues():
if type(w) == int: if type(w) == int:
# print "in reposition, w =", w # print "in reposition, w =", w

View File

@ -345,6 +345,22 @@ class Aux_Seats(Aux_Window):
def create_contents(self): pass def create_contents(self): pass
def update_contents(self): pass def update_contents(self): pass
def update_card_positions(self):
# self.adj does not exist until .create() has been run
try:
adj = self.adj
except AttributeError:
return
loc = self.config.get_aux_locations(self.params['name'], int(self.hud.max))
for i in (range(1, self.hud.max + 1) + ['common']):
if i == 'common':
(x, y) = self.params['layout'][self.hud.max].common
else:
(x, y) = loc[adj[i]]
self.positions[i] = self.card_positions(x, self.hud.table.x, y, self.hud.table.y)
self.m_windows[i].move(self.positions[i][0], self.positions[i][1])
def create(self): def create(self):
self.adj = self.hud.adj_seats(0, self.config) # move adj_seats to aux and get rid of it in Hud.py self.adj = self.hud.adj_seats(0, self.config) # move adj_seats to aux and get rid of it in Hud.py
loc = self.config.get_aux_locations(self.params['name'], int(self.hud.max)) loc = self.config.get_aux_locations(self.params['name'], int(self.hud.max))
@ -362,7 +378,7 @@ class Aux_Seats(Aux_Window):
self.m_windows[i].set_transient_for(self.hud.main_window) self.m_windows[i].set_transient_for(self.hud.main_window)
self.m_windows[i].set_focus_on_map(False) self.m_windows[i].set_focus_on_map(False)
self.m_windows[i].connect("configure_event", self.configure_event_cb, i) self.m_windows[i].connect("configure_event", self.configure_event_cb, i)
self.positions[i] = (int(x) + self.hud.table.x, int(y) + self.hud.table.y) self.positions[i] = self.card_positions(x, self.hud.table.x, y, self.hud.table.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])
if self.params.has_key('opacity'): if self.params.has_key('opacity'):
self.m_windows[i].set_opacity(float(self.params['opacity'])) self.m_windows[i].set_opacity(float(self.params['opacity']))
@ -374,6 +390,13 @@ class Aux_Seats(Aux_Window):
if self.uses_timer: if self.uses_timer:
self.m_windows[i].hide() self.m_windows[i].hide()
def card_positions(self, x, table_x, y, table_y):
_x = int(x) + int(table_x)
_y = int(y) + int(table_y)
return (_x, _y)
def update_gui(self, new_hand_id): def update_gui(self, new_hand_id):
"""Update the gui, LDO.""" """Update the gui, LDO."""
for i in self.m_windows.keys(): for i in self.m_windows.keys():