From 9ddfb74a6124c2b971d0adf497bf7f8476ef2f46 Mon Sep 17 00:00:00 2001 From: Simon Schampijer Date: Mon, 29 Oct 2007 15:35:09 +0100 Subject: [PATCH] Make the output of get_timezone and get_color more clear --- shell/controlpanel/control.py | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/shell/controlpanel/control.py b/shell/controlpanel/control.py index cf2b688b..89870514 100644 --- a/shell/controlpanel/control.py +++ b/shell/controlpanel/control.py @@ -232,7 +232,15 @@ def get_color(): return profile.get_color() def print_color(): - print get_color().to_string() + color = get_color().to_string() + str = color.split(',') + + for color in _COLORS: + for hue in _COLORS[color]: + if _COLORS[color][hue] == str[0]: + print 'stroke: color=%s hue=%s'%(color, hue) + if _COLORS[color][hue] == str[1]: + print 'fill: color=%s hue=%s'%(color, hue) def set_color(stroke, fill, modstroke='medium', modfill='medium'): """Set the system color. @@ -365,16 +373,6 @@ def _read_zonetab(fn='/usr/share/zoneinfo/zone.tab'): timezones.sort() return timezones -def _remove_encoding(lang): - if '.' in lang: - langBase = lang.split('.') - return langBase[0] - elif '@' in lang: - langBase = lang.split('@') - return langBase[0] - else: - return lang - def _writeI18N(lang, sysfont): path = '/etc/sysconfig/i18n' if os.access(path, os.R_OK) == 0: @@ -402,15 +400,20 @@ def get_language(): lang = line[5:].replace('"', '') lang = lang.strip() - if lang: - lang = _remove_encoding(lang) - else: + if not lang: lang = "en_US" + return lang def print_language(): - print get_language() - + code = get_language() + + for lang in _LANGUAGES: + if _LANGUAGES[lang][0] == code: + print lang + return + print (_("Language for code=%s could not be determined.")%code) + def set_language(language): """Set the system language. languages :