font and font_size added to config and used in HUD.
This commit is contained in:
parent
e0105c5ed1
commit
bb9f85233e
|
@ -60,6 +60,8 @@ class Site:
|
||||||
self.converter = node.getAttribute("converter")
|
self.converter = node.getAttribute("converter")
|
||||||
self.enabled = node.getAttribute("enabled")
|
self.enabled = node.getAttribute("enabled")
|
||||||
self.aux_window = node.getAttribute("aux_window")
|
self.aux_window = node.getAttribute("aux_window")
|
||||||
|
self.font = node.getAttribute("font")
|
||||||
|
self.font_size = node.getAttribute("font_size")
|
||||||
self.layout = {}
|
self.layout = {}
|
||||||
|
|
||||||
for layout_node in node.getElementsByTagName('layout'):
|
for layout_node in node.getElementsByTagName('layout'):
|
||||||
|
@ -480,6 +482,19 @@ class Config:
|
||||||
colors['hudfgcolor'] = self.supported_sites[site].hudfgcolor
|
colors['hudfgcolor'] = self.supported_sites[site].hudfgcolor
|
||||||
return colors
|
return colors
|
||||||
|
|
||||||
|
def get_default_font(self, site = 'PokerStars'):
|
||||||
|
(font, font_size) = ("Sans", "8")
|
||||||
|
if self.supported_sites[site].font == "":
|
||||||
|
font = "Sans"
|
||||||
|
else:
|
||||||
|
font = self.supported_sites[site].font
|
||||||
|
|
||||||
|
if self.supported_sites[site].font_size == "":
|
||||||
|
font_size = "8"
|
||||||
|
else:
|
||||||
|
font_size = self.supported_sites[site].font_size
|
||||||
|
return (font, font_size)
|
||||||
|
|
||||||
def get_locations(self, site = "PokerStars", max = "8"):
|
def get_locations(self, site = "PokerStars", max = "8"):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -511,13 +526,16 @@ class Config:
|
||||||
parms["site_name"] = self.supported_sites[site].site_name
|
parms["site_name"] = self.supported_sites[site].site_name
|
||||||
parms["enabled"] = self.supported_sites[site].enabled
|
parms["enabled"] = self.supported_sites[site].enabled
|
||||||
parms["aux_window"] = self.supported_sites[site].aux_window
|
parms["aux_window"] = self.supported_sites[site].aux_window
|
||||||
|
parms["font"] = self.supported_sites[site].font
|
||||||
|
parms["font_size"] = self.supported_sites[site].font_size
|
||||||
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,
|
||||||
hudbgcolor = None, hudfgcolor = None,
|
hudbgcolor = None, hudfgcolor = None,
|
||||||
hudopacity = None, screen_name = None,
|
hudopacity = None, screen_name = None,
|
||||||
site_path = None, table_finder = None,
|
site_path = None, table_finder = None,
|
||||||
HH_path = None, enabled = None):
|
HH_path = None, enabled = None,
|
||||||
|
font = None, font_size = None):
|
||||||
"""Sets the specified site parameters for the specified site."""
|
"""Sets the specified site parameters for the specified site."""
|
||||||
site_node = self.get_site_node(site_name)
|
site_node = self.get_site_node(site_name)
|
||||||
if not db_node == None:
|
if not db_node == None:
|
||||||
|
@ -531,18 +549,20 @@ class Config:
|
||||||
if not table_finder == None: site_node.setAttribute("table_finder", table_finder)
|
if not table_finder == None: site_node.setAttribute("table_finder", table_finder)
|
||||||
if not HH_path == None: site_node.setAttribute("HH_path", HH_path)
|
if not HH_path == None: site_node.setAttribute("HH_path", HH_path)
|
||||||
if not enabled == None: site_node.setAttribute("enabled", enabled)
|
if not enabled == None: site_node.setAttribute("enabled", enabled)
|
||||||
|
if not font == None: site_node.setAttribute("font", font)
|
||||||
|
if not font_size == None: site_node.setAttribute("font_size", font_size)
|
||||||
|
|
||||||
if self.supported_databases.has_key(db_name):
|
# if self.supported_databases.has_key(db_name):
|
||||||
if not converter == None: self.supported_sites[site].converter = converter
|
# if not converter == None: self.supported_sites[site].converter = converter
|
||||||
if not decoder == None: self.supported_sites[site].decoder = decoder
|
# if not decoder == None: self.supported_sites[site].decoder = decoder
|
||||||
if not hudbgcolor == None: self.supported_sites[site].hudbgcolor = hudbgcolor
|
# if not hudbgcolor == None: self.supported_sites[site].hudbgcolor = hudbgcolor
|
||||||
if not hudfgcolor == None: self.supported_sites[site].hudfgcolor = hudfgcolor
|
# if not hudfgcolor == None: self.supported_sites[site].hudfgcolor = hudfgcolor
|
||||||
if not hudopacity == None: self.supported_sites[site].hudopacity = hudopacity
|
# if not hudopacity == None: self.supported_sites[site].hudopacity = hudopacity
|
||||||
if not screen_name == None: self.supported_sites[site].screen_name = screen_name
|
# if not screen_name == None: self.supported_sites[site].screen_name = screen_name
|
||||||
if not site_path == None: self.supported_sites[site].site_path = site_path
|
# if not site_path == None: self.supported_sites[site].site_path = site_path
|
||||||
if not table_finder == None: self.supported_sites[site].table_finder = table_finder
|
# if not table_finder == None: self.supported_sites[site].table_finder = table_finder
|
||||||
if not HH_path == None: self.supported_sites[site].HH_path = HH_path
|
# if not HH_path == None: self.supported_sites[site].HH_path = HH_path
|
||||||
if not enabled == None: self.supported_sites[site].enabled = enabled
|
# if not enabled == None: self.supported_sites[site].enabled = enabled
|
||||||
return
|
return
|
||||||
|
|
||||||
def get_aux_windows(self):
|
def get_aux_windows(self):
|
||||||
|
@ -640,6 +660,7 @@ if __name__== "__main__":
|
||||||
for site in c.supported_sites.keys():
|
for site in c.supported_sites.keys():
|
||||||
print "site = ", site,
|
print "site = ", site,
|
||||||
print c.get_site_parameters(site)
|
print c.get_site_parameters(site)
|
||||||
|
print c.get_default_font(site)
|
||||||
|
|
||||||
for game in c.get_supported_games():
|
for game in c.get_supported_games():
|
||||||
print c.get_game_parameters(game)
|
print c.get_game_parameters(game)
|
||||||
|
|
|
@ -61,7 +61,13 @@ class Hud:
|
||||||
self.stat_windows = {}
|
self.stat_windows = {}
|
||||||
self.popup_windows = {}
|
self.popup_windows = {}
|
||||||
self.aux_windows = []
|
self.aux_windows = []
|
||||||
|
(font, font_size) = config.get_default_font(self.table.site)
|
||||||
|
print "font = ", font, "size = ", font_size
|
||||||
|
if font == None or font_size == None:
|
||||||
self.font = pango.FontDescription("Sans 7")
|
self.font = pango.FontDescription("Sans 7")
|
||||||
|
else:
|
||||||
|
print "Setting font to ", font + " " + font_size
|
||||||
|
self.font = pango.FontDescription(font + " " + font_size)
|
||||||
|
|
||||||
# Set up a main window for this this instance of the HUD
|
# Set up a main window for this this instance of the HUD
|
||||||
self.main_window = gtk.Window()
|
self.main_window = gtk.Window()
|
||||||
|
@ -401,7 +407,7 @@ class Stat_Window:
|
||||||
|
|
||||||
self.e_box[r][c].add(self.label[r][c])
|
self.e_box[r][c].add(self.label[r][c])
|
||||||
self.e_box[r][c].connect("button_press_event", self.button_press_cb)
|
self.e_box[r][c].connect("button_press_event", self.button_press_cb)
|
||||||
font = pango.FontDescription("Sans 7")
|
# font = pango.FontDescription(self.font)
|
||||||
self.label[r][c].modify_font(font)
|
self.label[r][c].modify_font(font)
|
||||||
|
|
||||||
self.window.set_opacity(parent.colors['hudopacity'])
|
self.window.set_opacity(parent.colors['hudopacity'])
|
||||||
|
|
Loading…
Reference in New Issue
Block a user