Linux Archive

Linux Archive (http://www.linux-archive.org/)
-   Edubuntu User (http://www.linux-archive.org/edubuntu-user/)
-   -   Add 24-hour/AMPM RadioButtons functionality (http://www.linux-archive.org/edubuntu-user/651779-add-24-hour-ampm-radiobuttons-functionality.html)

Vratislav Podzimek 04-02-2012 03:13 PM

Add 24-hour/AMPM RadioButtons functionality
 
---
pyanaconda/ui/gui/spokes/datetime_spoke.py | 21 +++++++++++++++++++--
1 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/pyanaconda/ui/gui/spokes/datetime_spoke.py b/pyanaconda/ui/gui/spokes/datetime_spoke.py
index 546ceba..b66a282 100644
--- a/pyanaconda/ui/gui/spokes/datetime_spoke.py
+++ b/pyanaconda/ui/gui/spokes/datetime_spoke.py
@@ -99,6 +99,10 @@ class DatetimeSpoke(NormalSpoke):
self._citiesSort.set_sort_column_id(0, 0) #column 0, Ascending

self._mod_hours = 13 #TODO: change on timeformat RB change
+ self._radioButton24h = self.builder.get_object("timeFormatRB")
+ if self._radioButton24h.get_active():
+ self._set_amPm_part_sensitive(False)
+
self._tzmap.set_timezone("Europe/Prague")

@property
@@ -153,6 +157,14 @@ class DatetimeSpoke(NormalSpoke):

return city in self._regions_zones[region]

+ def _set_amPm_part_sensitive(self, sensitive):
+ amPmUp = self.builder.get_object("amPmUpButton")
+ amPmDown = self.builder.get_object("amPmDownButton")
+ amPmLabel = self.builder.get_object("amPmLabel")
+
+ for widget in (amPmUp, amPmDown, amPmLabel):
+ widget.set_sensitive(sensitive)
+
def on_up_hours_clicked(self, *args):
hours_label = self.builder.get_object("hoursLabel")
hours = int(hours_label.get_text())
@@ -248,5 +260,10 @@ class DatetimeSpoke(NormalSpoke):

itr = self._citiesSort.iter_next(itr)

- def on_timeformat_changed(self, *args):
- pass
+ def on_timeformat_changed(self, button24h, *args):
+ #connected to 24-hour radio button
+ if button24h.get_active():
+ self._set_amPm_part_sensitive(False)
+ else:
+ self._set_amPm_part_sensitive(True)
+
--
1.7.4.4

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list


All times are GMT. The time now is 12:33 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.