From bf5f24fb6b2df1e113ab2e0c4275cc03d0efc27b Mon Sep 17 00:00:00 2001 From: sqlcoder Date: Fri, 11 Jun 2010 21:03:53 +0100 Subject: [PATCH] add xshift/yshift config to move menu window on hud --- pyfpdb/Configuration.py | 16 ++++++++++++++++ pyfpdb/HUD_config.xml.example | 4 ++++ pyfpdb/Hud.py | 3 ++- 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/pyfpdb/Configuration.py b/pyfpdb/Configuration.py index 4b5134af..3c55e97e 100755 --- a/pyfpdb/Configuration.py +++ b/pyfpdb/Configuration.py @@ -249,6 +249,8 @@ class Site: self.enabled = string_to_bool(node.getAttribute("enabled"), default=True) self.xpad = node.getAttribute("xpad") self.ypad = node.getAttribute("ypad") + self.xshift = node.getAttribute("xshift") + self.yshift = node.getAttribute("yshift") self.layout = {} print "Loading site", self.site_name @@ -260,6 +262,8 @@ class Site: # Site defaults self.xpad = 1 if self.xpad == "" else int(self.xpad) 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.hudopacity = 1.0 if self.hudopacity == "" else float(self.hudopacity) @@ -297,12 +301,18 @@ class Game: self.cols = int( node.getAttribute("cols") ) self.xpad = node.getAttribute("xpad") self.ypad = node.getAttribute("ypad") + self.xshift = node.getAttribute("xshift") + self.yshift = node.getAttribute("yshift") # Defaults if self.xpad == "": self.xpad = 1 else: self.xpad = int(self.xpad) if self.ypad == "": self.ypad = 0 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_list = aux_text.split(',') @@ -335,6 +345,8 @@ class Game: temp = temp + " cols = %d\n" % self.cols temp = temp + " xpad = %d\n" % self.xpad 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 for stat in self.stats.keys(): @@ -979,6 +991,8 @@ class Config: parms["enabled"] = self.supported_sites[site].enabled parms["xpad"] = self.supported_sites[site].xpad parms["ypad"] = self.supported_sites[site].ypad + parms["xshift"] = self.supported_sites[site].xshift + parms["yshift"] = self.supported_sites[site].yshift return parms 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['xpad'] = self.supported_games[name].xpad 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 return param diff --git a/pyfpdb/HUD_config.xml.example b/pyfpdb/HUD_config.xml.example index 617a34d3..880bd652 100644 --- a/pyfpdb/HUD_config.xml.example +++ b/pyfpdb/HUD_config.xml.example @@ -119,6 +119,10 @@ Left-Drag to Move" hudopacity="1.0" font="Sans" font_size="8" + xpad="1" + ypad="0" + xshift="0" + yshift="0" supported_games="holdem,razz,omahahi,omahahilo,studhi,studhilo"> diff --git a/pyfpdb/Hud.py b/pyfpdb/Hud.py index 5dcccf3c..9b9ebb9c 100644 --- a/pyfpdb/Hud.py +++ b/pyfpdb/Hud.py @@ -87,6 +87,7 @@ class Hud: (font, font_size) = config.get_default_font(self.table.site) self.colors = config.get_default_colors(self.table.site) 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.foregroundcolor = gtk.gdk.color_parse(self.colors['hudfgcolor']) @@ -457,7 +458,7 @@ class Hud: if self.table.x != x or self.table.y != y: self.table.x = x 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) 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?