Merge branch 'master' of git@github.com:kangaderoo/fpdb-kangaderoo.git
This commit is contained in:
commit
9d1ae8cfea
|
@ -457,7 +457,9 @@ class Hud:
|
|||
# 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)
|
||||
px = int(x * self.table.width / 1000)
|
||||
py = int(y * self.table.height / 1000)
|
||||
w.relocate(px, py)
|
||||
|
||||
# While we're at it, fix the positions of mucked cards too
|
||||
for aux in self.aux_windows:
|
||||
|
@ -507,9 +509,11 @@ class Hud:
|
|||
|
||||
def save_layout(self, *args):
|
||||
new_layout = [(0, 0)] * self.max
|
||||
width = self.table.width
|
||||
height = self.table.height
|
||||
for sw in self.stat_windows:
|
||||
loc = self.stat_windows[sw].window.get_position()
|
||||
new_loc = (loc[0] - self.table.x, loc[1] - self.table.y)
|
||||
(x,y) = self.stat_windows[sw].window.get_position()
|
||||
new_loc = (int((x - self.table.x)*1000/width), int((y - self.table.y)*1000/height))
|
||||
new_layout[self.stat_windows[sw].adj - 1] = new_loc
|
||||
self.config.edit_layout(self.table.site, self.max, locations = new_layout)
|
||||
# ask each aux to save its layout back to the config object
|
||||
|
@ -571,16 +575,21 @@ class Hud:
|
|||
loc = self.config.get_locations(self.table.site, 9)
|
||||
|
||||
# create the stat windows
|
||||
# get the width and height of the client window
|
||||
# The x and Y positions are now made relative.
|
||||
|
||||
for i in xrange(1, self.max + 1):
|
||||
(x, y) = loc[adj[i]]
|
||||
px = int(x * self.table.width / 1000)
|
||||
py = int(y * self.table.height / 1000)
|
||||
if i in self.stat_windows:
|
||||
self.stat_windows[i].relocate(x, y)
|
||||
self.stat_windows[i].relocate(px, py)
|
||||
else:
|
||||
self.stat_windows[i] = Stat_Window(game = config.supported_games[self.poker_game],
|
||||
parent = self,
|
||||
table = self.table,
|
||||
x = x,
|
||||
y = y,
|
||||
x = px,
|
||||
y = py,
|
||||
seat = i,
|
||||
adj = adj[i],
|
||||
player_id = 'fake',
|
||||
|
|
|
@ -357,21 +357,24 @@ class Aux_Seats(Aux_Window):
|
|||
except AttributeError:
|
||||
return
|
||||
loc = self.config.get_aux_locations(self.params['name'], int(self.hud.max))
|
||||
width = self.hud.table.width
|
||||
height = self.hud.table.height
|
||||
|
||||
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.positions[i] = self.card_positions((x * width) / 1000, self.hud.table.x, (y * height) /1000, self.hud.table.y)
|
||||
self.m_windows[i].move(self.positions[i][0], self.positions[i][1])
|
||||
|
||||
|
||||
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
|
||||
loc = self.config.get_aux_locations(self.params['name'], int(self.hud.max))
|
||||
|
||||
self.m_windows = {} # windows to put the card images in
|
||||
|
||||
width = self.hud.table.width
|
||||
height = self.hud.table.height
|
||||
for i in (range(1, self.hud.max + 1) + ['common']):
|
||||
if i == 'common':
|
||||
(x, y) = self.params['layout'][self.hud.max].common
|
||||
|
@ -383,7 +386,7 @@ class Aux_Seats(Aux_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].connect("configure_event", self.configure_event_cb, i)
|
||||
self.positions[i] = self.card_positions(x, self.hud.table.x, y, self.hud.table.y)
|
||||
self.positions[i] = self.card_positions((x * width) / 1000, self.hud.table.x, (y * height) /1000, self.hud.table.y)
|
||||
self.m_windows[i].move(self.positions[i][0], self.positions[i][1])
|
||||
if self.params.has_key('opacity'):
|
||||
self.m_windows[i].set_opacity(float(self.params['opacity']))
|
||||
|
@ -425,11 +428,13 @@ class Aux_Seats(Aux_Window):
|
|||
"""Save new layout back to the aux element in the config file."""
|
||||
new_locs = {}
|
||||
# print "adj =", self.adj
|
||||
witdh = self.hud.table.width
|
||||
height = self.hud.table.height
|
||||
for (i, pos) in self.positions.iteritems():
|
||||
if i != 'common':
|
||||
new_locs[self.adj[int(i)]] = (pos[0] - self.hud.table.x, pos[1] - self.hud.table.y)
|
||||
else:
|
||||
new_locs[i] = (pos[0] - self.hud.table.x, pos[1] - self.hud.table.y)
|
||||
if i != 'common':
|
||||
new_locs[self.adj[int(i)]] = ((pos[0] - self.hud.table.x) * 1000 / witdh, (pos[1] - self.hud.table.y) * 1000 / height)
|
||||
else:
|
||||
new_locs[i] = ((pos[0] - self.hud.table.x) * 1000 / witdh, (pos[1] - self.hud.table.y) * 1000 / height)
|
||||
self.config.edit_aux_layout(self.params['name'], self.hud.max, locations = new_locs)
|
||||
|
||||
def configure_event_cb(self, widget, event, i, *args):
|
||||
|
|
Loading…
Reference in New Issue
Block a user