From eb226c002678d2e63bd6f3d568386605c55e5af0 Mon Sep 17 00:00:00 2001 From: Gerko de Roo Date: Wed, 23 Dec 2009 21:15:55 +0100 Subject: [PATCH] Added color highlight for stats window. high and low threshold and color can be set in the xml file --- pyfpdb/Configuration.py | 4 ++ pyfpdb/HUD_config.xml.example | 97 ++++++++++++++++++----------------- pyfpdb/Hud.py | 10 ++++ 3 files changed, 63 insertions(+), 48 deletions(-) diff --git a/pyfpdb/Configuration.py b/pyfpdb/Configuration.py index 174d0673..39bf5921 100755 --- a/pyfpdb/Configuration.py +++ b/pyfpdb/Configuration.py @@ -269,6 +269,10 @@ class Game: stat.hudprefix = stat_node.getAttribute("hudprefix") stat.hudsuffix = stat_node.getAttribute("hudsuffix") stat.hudcolor = stat_node.getAttribute("hudcolor") + stat.stat_loth = stat_node.getAttribute("stat_loth") + stat.stat_hith = stat_node.getAttribute("stat_hith") + stat.stat_locolor = stat_node.getAttribute("stat_locolor") + stat.stat_hicolor = stat_node.getAttribute("stat_hicolor") self.stats[stat.stat_name] = stat diff --git a/pyfpdb/HUD_config.xml.example b/pyfpdb/HUD_config.xml.example index b1ebd761..a772773e 100644 --- a/pyfpdb/HUD_config.xml.example +++ b/pyfpdb/HUD_config.xml.example @@ -449,59 +449,60 @@ Left-Drag to Move" - - - - - - - - + + + + + + + + - - - - - - - - + + + + + + + + - - - - - - - - + + + + + + + + - - - - - - - - + + + + + + + + - - - - - - - - + + + + + + + + - - - - - - - - + + + + + + + + + diff --git a/pyfpdb/Hud.py b/pyfpdb/Hud.py index b61c17aa..1eb51aea 100644 --- a/pyfpdb/Hud.py +++ b/pyfpdb/Hud.py @@ -632,6 +632,16 @@ class Hud: self.label.modify_fg(gtk.STATE_NORMAL, gtk.gdk.color_parse(self.colors['hudfgcolor'])) window.label[r][c].modify_fg(gtk.STATE_NORMAL, gtk.gdk.color_parse(this_stat.hudcolor)) + if this_stat.stat_loth != "": + if number[0] < (float(this_stat.stat_loth)/100): + self.label.modify_fg(gtk.STATE_NORMAL, gtk.gdk.color_parse(self.colors['hudfgcolor'])) + window.label[r][c].modify_fg(gtk.STATE_NORMAL, gtk.gdk.color_parse(this_stat.stat_locolor)) + + if this_stat.stat_hith != "": + if number[0] > (float(this_stat.stat_hith)/100): + self.label.modify_fg(gtk.STATE_NORMAL, gtk.gdk.color_parse(self.colors['hudfgcolor'])) + window.label[r][c].modify_fg(gtk.STATE_NORMAL, gtk.gdk.color_parse(this_stat.stat_hicolor)) + window.label[r][c].set_text(statstring) if statstring != "xxx": # is there a way to tell if this particular stat window is visible already, or no? window.window.show_all()