Make hud's menu-area text configurable

By default the hud positions a little box on top-left corner of each
table. Make the text in this box user-modifiable without touching the
source.

Most likely useful for active users and those who play with smaller
tables. On shrunk table the default box may cover some of the players'
cards.
This commit is contained in:
Mika Bostrom 2009-10-03 21:05:41 +03:00
parent 7eb368f221
commit 18cc51ba7a
2 changed files with 28 additions and 1 deletions

View File

@ -278,6 +278,15 @@ class Import:
return " interval = %s\n callFpdbHud = %s\n hhArchiveBase = %s\n saveActions = %s\n fastStoreHudCache = %s\n" \ return " interval = %s\n callFpdbHud = %s\n hhArchiveBase = %s\n saveActions = %s\n fastStoreHudCache = %s\n" \
% (self.interval, self.callFpdbHud, self.hhArchiveBase, self.saveActions, self.fastStoreHudCache) % (self.interval, self.callFpdbHud, self.hhArchiveBase, self.saveActions, self.fastStoreHudCache)
class HudUI:
def __init__(self, node):
self.node = node
self.label = node.getAttribute('label')
def __str__(self):
return " label = %s\n" % self.label
class Tv: class Tv:
def __init__(self, node): def __init__(self, node):
self.combinedStealFold = node.getAttribute("combinedStealFold") self.combinedStealFold = node.getAttribute("combinedStealFold")
@ -389,6 +398,10 @@ class Config:
imp = Import(node = imp_node) imp = Import(node = imp_node)
self.imp = imp self.imp = imp
for hui_node in doc.getElementsByTagName('hud_ui'):
hui = HudUI(node = hui_node)
self.ui = hui
for tv_node in doc.getElementsByTagName("tv"): for tv_node in doc.getElementsByTagName("tv"):
tv = Tv(node = tv_node) tv = Tv(node = tv_node)
self.tv = tv self.tv = tv
@ -598,6 +611,19 @@ class Config:
try: tv['combinedPostflop'] = self.tv.combinedPostflop try: tv['combinedPostflop'] = self.tv.combinedPostflop
except: tv['combinedPostflop'] = True except: tv['combinedPostflop'] = True
return tv return tv
# Allow to change the menu appearance
def get_hud_ui_parameters(self):
hui = {}
default_text = 'FPDB Menu - Right click\nLeft-Drag to Move'
try:
hui['label'] = self.ui.label
if self.ui.label == '': # Empty menu label is a big no-no
hui['label'] = default_text
except:
hui['label'] = default_text
return hui
def get_import_parameters(self): def get_import_parameters(self):
imp = {} imp = {}

View File

@ -82,6 +82,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.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'])
@ -116,7 +117,7 @@ class Hud:
win.set_opacity(self.colors["hudopacity"]) win.set_opacity(self.colors["hudopacity"])
eventbox = gtk.EventBox() eventbox = gtk.EventBox()
label = gtk.Label("FPDB Menu - Right click\nLeft-Drag to Move") label = gtk.Label(self.hud_ui['label'])
win.add(eventbox) win.add(eventbox)
eventbox.add(label) eventbox.add(label)