diff options
author | Sascha Silbe <silbe@activitycentral.com> | 2011-03-12 17:09:51 (GMT) |
---|---|---|
committer | Sascha Silbe <silbe@activitycentral.com> | 2011-03-12 17:09:51 (GMT) |
commit | 3d7cae64f6eacdb77d84cd34c2965086221ff509 (patch) | |
tree | 62370ed13a666649db6047dfd5a7631952365da2 /extensions/cpsection/datetime/model.py | |
parent | 12ed51c8c945ce02d93fbec048b6d44a18f639d9 (diff) | |
parent | ff47b24c5aa032f830c6f3dc3ae32dfed3c72229 (diff) |
Merge commit 'refs/top-bases/t/upower' into t/upowert/upower
* commit 'refs/top-bases/t/upower': (87 commits)
Fix up style issues introduced by commit 3f8a1e1
Don't set default timezone
Restore setting a language with the command line OLPC #10681
battery frame device: replace HAL with UPower
use ConsoleKit instead of HAL for shutdown/reboot
fix recognition of JEBs outside of data store
Adjust the year in the licence visible in the control panel
Handle activities that cycle through windows dlo#10695
Speaker frame device: pop up palette on left-click instead of toggling mute
recognise translations using pgettext
Remove last few pieces of buddy-icon.jpg handling
fix whitespace error introduced by 4b6a534 (revert of 4a3416b)
Commit from Sugar Labs: Translation System by user RafaelOrtiz.: 374 of 374 messages translated (0 fuzzy).
Intro: Fall back to user name if GECOS real name field is empty
Sugar Ad-hoc icons show in search results when connect/disconnect to AP OLPC #10412
Show busy cursor during session shutdown
Show free space for the Journal in the Journal volumes toolbar (SL#2318)
Fix incorrect logging level for warning about missing GSM configuration
simplify extension loading exception error
Revert "Add cpu and memory resource indicator to frame" as agreed on with erikos. Scheduling for inclusion in 0.94 after potential artwork changes based on feedback from the Design Team.
...
Conflicts:
extensions/deviceicon/battery.py
Diffstat (limited to 'extensions/cpsection/datetime/model.py')
-rw-r--r-- | extensions/cpsection/datetime/model.py | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/extensions/cpsection/datetime/model.py b/extensions/cpsection/datetime/model.py index 76064e4..84e1259 100644 --- a/extensions/cpsection/datetime/model.py +++ b/extensions/cpsection/datetime/model.py @@ -26,18 +26,20 @@ import gconf _zone_tab = '/usr/share/zoneinfo/zone.tab' + def _initialize(): - '''Initialize the docstring of the set function''' + """Initialize the docstring of the set function""" if set_timezone.__doc__ is None: # when running under 'python -OO', all __doc__ fields are None, # so += would fail -- and this function would be unnecessary anyway. return - timezones = read_all_timezones() + timezones = read_all_timezones() for timezone in timezones: - set_timezone.__doc__ += timezone + '\n' - + set_timezone.__doc__ += timezone + '\n' + + def read_all_timezones(fn=_zone_tab): - fd = open (fn, 'r') + fd = open(fn, 'r') lines = fd.readlines() fd.close() timezones = [] @@ -48,7 +50,7 @@ def read_all_timezones(fn=_zone_tab): if len(line) > 1: timezones.append(line[2]) timezones.sort() - + for offset in xrange(-12, 13): if offset < 0: tz = 'GMT%d' % offset @@ -56,7 +58,7 @@ def read_all_timezones(fn=_zone_tab): tz = 'GMT+%d' % offset else: tz = 'GMT' - timezones.append(tz) + timezones.append(tz) for offset in xrange(-12, 13): if offset < 0: tz = 'UTC%d' % offset @@ -64,16 +66,19 @@ def read_all_timezones(fn=_zone_tab): tz = 'UTC+%d' % offset else: tz = 'UTC' - timezones.append(tz) + timezones.append(tz) return timezones + def get_timezone(): client = gconf.client_get_default() return client.get_string('/desktop/sugar/date/timezone') + def print_timezone(): print get_timezone() + def set_timezone(timezone): """Set the system timezone timezone : e.g. 'America/Los_Angeles' @@ -84,9 +89,8 @@ def set_timezone(timezone): client = gconf.client_get_default() client.set_string('/desktop/sugar/date/timezone', timezone) else: - raise ValueError(_("Error timezone does not exist.")) + raise ValueError(_('Error timezone does not exist.')) return 1 -# inilialize the docstrings for the timezone +# inilialize the docstrings for the timezone _initialize() - |