add xshift/yshift config to move menu window on hud

This commit is contained in:
sqlcoder 2010-06-11 21:03:53 +01:00
parent fbefe1e611
commit bf5f24fb6b
3 changed files with 22 additions and 1 deletions

View File

@ -249,6 +249,8 @@ class Site:
self.enabled = string_to_bool(node.getAttribute("enabled"), default=True) self.enabled = string_to_bool(node.getAttribute("enabled"), default=True)
self.xpad = node.getAttribute("xpad") self.xpad = node.getAttribute("xpad")
self.ypad = node.getAttribute("ypad") self.ypad = node.getAttribute("ypad")
self.xshift = node.getAttribute("xshift")
self.yshift = node.getAttribute("yshift")
self.layout = {} self.layout = {}
print "Loading site", self.site_name print "Loading site", self.site_name
@ -260,6 +262,8 @@ class Site:
# Site defaults # Site defaults
self.xpad = 1 if self.xpad == "" else int(self.xpad) self.xpad = 1 if self.xpad == "" else int(self.xpad)
self.ypad = 0 if self.ypad == "" else int(self.ypad) self.ypad = 0 if self.ypad == "" else int(self.ypad)
self.xshift = 1 if self.xshift == "" else int(self.xshift)
self.yshift = 0 if self.yshift == "" else int(self.yshift)
self.font_size = 7 if self.font_size == "" else int(self.font_size) self.font_size = 7 if self.font_size == "" else int(self.font_size)
self.hudopacity = 1.0 if self.hudopacity == "" else float(self.hudopacity) self.hudopacity = 1.0 if self.hudopacity == "" else float(self.hudopacity)
@ -297,12 +301,18 @@ class Game:
self.cols = int( node.getAttribute("cols") ) self.cols = int( node.getAttribute("cols") )
self.xpad = node.getAttribute("xpad") self.xpad = node.getAttribute("xpad")
self.ypad = node.getAttribute("ypad") self.ypad = node.getAttribute("ypad")
self.xshift = node.getAttribute("xshift")
self.yshift = node.getAttribute("yshift")
# Defaults # Defaults
if self.xpad == "": self.xpad = 1 if self.xpad == "": self.xpad = 1
else: self.xpad = int(self.xpad) else: self.xpad = int(self.xpad)
if self.ypad == "": self.ypad = 0 if self.ypad == "": self.ypad = 0
else: self.ypad = int(self.ypad) else: self.ypad = int(self.ypad)
if self.xshift == "": self.xshift = 1
else: self.xshift = int(self.xshift)
if self.yshift == "": self.yshift = 0
else: self.yshift = int(self.yshift)
aux_text = node.getAttribute("aux") aux_text = node.getAttribute("aux")
aux_list = aux_text.split(',') aux_list = aux_text.split(',')
@ -335,6 +345,8 @@ class Game:
temp = temp + " cols = %d\n" % self.cols temp = temp + " cols = %d\n" % self.cols
temp = temp + " xpad = %d\n" % self.xpad temp = temp + " xpad = %d\n" % self.xpad
temp = temp + " ypad = %d\n" % self.ypad temp = temp + " ypad = %d\n" % self.ypad
temp = temp + " xshift = %d\n" % self.xshift
temp = temp + " yshift = %d\n" % self.yshift
temp = temp + " aux = %s\n" % self.aux temp = temp + " aux = %s\n" % self.aux
for stat in self.stats.keys(): for stat in self.stats.keys():
@ -979,6 +991,8 @@ class Config:
parms["enabled"] = self.supported_sites[site].enabled parms["enabled"] = self.supported_sites[site].enabled
parms["xpad"] = self.supported_sites[site].xpad parms["xpad"] = self.supported_sites[site].xpad
parms["ypad"] = self.supported_sites[site].ypad parms["ypad"] = self.supported_sites[site].ypad
parms["xshift"] = self.supported_sites[site].xshift
parms["yshift"] = self.supported_sites[site].yshift
return parms return parms
def set_site_parameters(self, site_name, converter = None, decoder = None, def set_site_parameters(self, site_name, converter = None, decoder = None,
@ -1030,6 +1044,8 @@ class Config:
param['cols'] = self.supported_games[name].cols param['cols'] = self.supported_games[name].cols
param['xpad'] = self.supported_games[name].xpad param['xpad'] = self.supported_games[name].xpad
param['ypad'] = self.supported_games[name].ypad param['ypad'] = self.supported_games[name].ypad
param['xshift'] = self.supported_games[name].xshift
param['yshift'] = self.supported_games[name].yshift
param['aux'] = self.supported_games[name].aux param['aux'] = self.supported_games[name].aux
return param return param

View File

@ -119,6 +119,10 @@ Left-Drag to Move"
hudopacity="1.0" hudopacity="1.0"
font="Sans" font="Sans"
font_size="8" font_size="8"
xpad="1"
ypad="0"
xshift="0"
yshift="0"
supported_games="holdem,razz,omahahi,omahahilo,studhi,studhilo"> supported_games="holdem,razz,omahahi,omahahilo,studhi,studhilo">
<layout max="8" width="792" height="546" fav_seat="0"> <layout max="8" width="792" height="546" fav_seat="0">
<location seat="1" x="684" y="61"> </location> <location seat="1" x="684" y="61"> </location>

View File

@ -87,6 +87,7 @@ class Hud:
(font, font_size) = config.get_default_font(self.table.site) (font, font_size) = config.get_default_font(self.table.site)
self.colors = config.get_default_colors(self.table.site) self.colors = config.get_default_colors(self.table.site)
self.hud_ui = config.get_hud_ui_parameters() self.hud_ui = config.get_hud_ui_parameters()
self.site_params = config.get_site_parameters()
self.backgroundcolor = gtk.gdk.color_parse(self.colors['hudbgcolor']) self.backgroundcolor = gtk.gdk.color_parse(self.colors['hudbgcolor'])
self.foregroundcolor = gtk.gdk.color_parse(self.colors['hudfgcolor']) self.foregroundcolor = gtk.gdk.color_parse(self.colors['hudfgcolor'])
@ -457,7 +458,7 @@ class Hud:
if self.table.x != x or self.table.y != y: if self.table.x != x or self.table.y != y:
self.table.x = x self.table.x = x
self.table.y = y self.table.y = y
self.main_window.move(x, y) self.main_window.move(x + self.site_params['xshift'], y + self.site_params['yshift'])
adj = self.adj_seats(self.hand, self.config) adj = self.adj_seats(self.hand, self.config)
loc = self.config.get_locations(self.table.site, self.max) loc = self.config.get_locations(self.table.site, self.max)
# 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?