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?
|
# 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()):
|
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)
|
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
|
# While we're at it, fix the positions of mucked cards too
|
||||||
for aux in self.aux_windows:
|
for aux in self.aux_windows:
|
||||||
|
@ -507,9 +509,11 @@ class Hud:
|
||||||
|
|
||||||
def save_layout(self, *args):
|
def save_layout(self, *args):
|
||||||
new_layout = [(0, 0)] * self.max
|
new_layout = [(0, 0)] * self.max
|
||||||
|
width = self.table.width
|
||||||
|
height = self.table.height
|
||||||
for sw in self.stat_windows:
|
for sw in self.stat_windows:
|
||||||
loc = self.stat_windows[sw].window.get_position()
|
(x,y) = self.stat_windows[sw].window.get_position()
|
||||||
new_loc = (loc[0] - self.table.x, loc[1] - self.table.y)
|
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
|
new_layout[self.stat_windows[sw].adj - 1] = new_loc
|
||||||
self.config.edit_layout(self.table.site, self.max, locations = new_layout)
|
self.config.edit_layout(self.table.site, self.max, locations = new_layout)
|
||||||
# ask each aux to save its layout back to the config object
|
# 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)
|
loc = self.config.get_locations(self.table.site, 9)
|
||||||
|
|
||||||
# create the stat windows
|
# 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):
|
for i in xrange(1, self.max + 1):
|
||||||
(x, y) = loc[adj[i]]
|
(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:
|
if i in self.stat_windows:
|
||||||
self.stat_windows[i].relocate(x, y)
|
self.stat_windows[i].relocate(px, py)
|
||||||
else:
|
else:
|
||||||
self.stat_windows[i] = Stat_Window(game = config.supported_games[self.poker_game],
|
self.stat_windows[i] = Stat_Window(game = config.supported_games[self.poker_game],
|
||||||
parent = self,
|
parent = self,
|
||||||
table = self.table,
|
table = self.table,
|
||||||
x = x,
|
x = px,
|
||||||
y = y,
|
y = py,
|
||||||
seat = i,
|
seat = i,
|
||||||
adj = adj[i],
|
adj = adj[i],
|
||||||
player_id = 'fake',
|
player_id = 'fake',
|
||||||
|
|
|
@ -357,21 +357,24 @@ class Aux_Seats(Aux_Window):
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
return
|
return
|
||||||
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))
|
||||||
|
width = self.hud.table.width
|
||||||
|
height = self.hud.table.height
|
||||||
|
|
||||||
for i in (range(1, self.hud.max + 1) + ['common']):
|
for i in (range(1, self.hud.max + 1) + ['common']):
|
||||||
if i == 'common':
|
if i == 'common':
|
||||||
(x, y) = self.params['layout'][self.hud.max].common
|
(x, y) = self.params['layout'][self.hud.max].common
|
||||||
else:
|
else:
|
||||||
(x, y) = loc[adj[i]]
|
(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])
|
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))
|
||||||
|
|
||||||
self.m_windows = {} # windows to put the card images in
|
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']):
|
for i in (range(1, self.hud.max + 1) + ['common']):
|
||||||
if i == 'common':
|
if i == 'common':
|
||||||
(x, y) = self.params['layout'][self.hud.max].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_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] = 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])
|
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']))
|
||||||
|
@ -425,11 +428,13 @@ class Aux_Seats(Aux_Window):
|
||||||
"""Save new layout back to the aux element in the config file."""
|
"""Save new layout back to the aux element in the config file."""
|
||||||
new_locs = {}
|
new_locs = {}
|
||||||
# print "adj =", self.adj
|
# print "adj =", self.adj
|
||||||
|
witdh = self.hud.table.width
|
||||||
|
height = self.hud.table.height
|
||||||
for (i, pos) in self.positions.iteritems():
|
for (i, pos) in self.positions.iteritems():
|
||||||
if i != 'common':
|
if i != 'common':
|
||||||
new_locs[self.adj[int(i)]] = (pos[0] - self.hud.table.x, pos[1] - self.hud.table.y)
|
new_locs[self.adj[int(i)]] = ((pos[0] - self.hud.table.x) * 1000 / witdh, (pos[1] - self.hud.table.y) * 1000 / height)
|
||||||
else:
|
else:
|
||||||
new_locs[i] = (pos[0] - self.hud.table.x, pos[1] - self.hud.table.y)
|
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)
|
self.config.edit_aux_layout(self.params['name'], self.hud.max, locations = new_locs)
|
||||||
|
|
||||||
def configure_event_cb(self, widget, event, i, *args):
|
def configure_event_cb(self, widget, event, i, *args):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user