[PATCH 2/2] Put AM/PM label and buttons in a revealer and hide/unhide them

Vratislav Podzimek vpodzime at redhat.com
Thu Dec 11 14:54:09 UTC 2014


When the whole manual time setting part is insensitive (NTP turned on), the
AM/PM part is the same insensitive as the current time and shows things like
"13:25 PM".

Signed-off-by: Vratislav Podzimek <vpodzime at redhat.com>
---
 pyanaconda/ui/gui/spokes/datetime_spoke.glade | 112 ++++++++++++++++----------
 pyanaconda/ui/gui/spokes/datetime_spoke.py    |   4 +-
 2 files changed, 72 insertions(+), 44 deletions(-)

diff --git a/pyanaconda/ui/gui/spokes/datetime_spoke.glade b/pyanaconda/ui/gui/spokes/datetime_spoke.glade
index a733a0f..c5f4fdb 100644
--- a/pyanaconda/ui/gui/spokes/datetime_spoke.glade
+++ b/pyanaconda/ui/gui/spokes/datetime_spoke.glade
@@ -143,8 +143,8 @@
           <object class="GtkLabel" id="configHeadingLabel">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
-            <property name="xalign">0</property>
             <property name="label" translatable="yes">Add and mark for usage NTP servers</property>
+            <property name="xalign">0</property>
             <attributes>
               <attribute name="font-desc" value="Sans Bold 12"/>
             </attributes>
@@ -633,24 +633,6 @@
                                   </packing>
                                 </child>
                                 <child>
-                                  <object class="GtkButton" id="amPmUpButton">
-                                    <property name="visible">True</property>
-                                    <property name="can_focus">True</property>
-                                    <property name="receives_default">True</property>
-                                    <property name="image">upImage1</property>
-                                    <signal name="clicked" handler="on_updown_ampm_clicked" swapped="no"/>
-                                    <child internal-child="accessible">
-                                      <object class="AtkObject" id="amPmUpButton-atkobject">
-                                        <property name="AtkObject::accessible-name" translatable="yes">AM/PM Up</property>
-                                      </object>
-                                    </child>
-                                  </object>
-                                  <packing>
-                                    <property name="left_attach">4</property>
-                                    <property name="top_attach">0</property>
-                                  </packing>
-                                </child>
-                                <child>
                                   <object class="GtkButton" id="minutesUpButton">
                                     <property name="visible">True</property>
                                     <property name="can_focus">True</property>
@@ -669,24 +651,6 @@
                                   </packing>
                                 </child>
                                 <child>
-                                  <object class="GtkButton" id="amPmDownButton">
-                                    <property name="visible">True</property>
-                                    <property name="can_focus">True</property>
-                                    <property name="receives_default">True</property>
-                                    <property name="image">downImage1</property>
-                                    <signal name="clicked" handler="on_updown_ampm_clicked" swapped="no"/>
-                                    <child internal-child="accessible">
-                                      <object class="AtkObject" id="amPmDownButton-atkobject">
-                                        <property name="AtkObject::accessible-name" translatable="yes">AM/PM Down</property>
-                                      </object>
-                                    </child>
-                                  </object>
-                                  <packing>
-                                    <property name="left_attach">4</property>
-                                    <property name="top_attach">2</property>
-                                  </packing>
-                                </child>
-                                <child>
                                   <object class="GtkButton" id="minutesDownButton">
                                     <property name="visible">True</property>
                                     <property name="can_focus">True</property>
@@ -719,17 +683,79 @@
                                   </packing>
                                 </child>
                                 <child>
-                                  <object class="GtkLabel" id="amPmLabel">
+                                  <object class="GtkRevealer" id="amPmRevealer">
                                     <property name="visible">True</property>
                                     <property name="can_focus">False</property>
-                                    <property name="label" translatable="yes">PM</property>
-                                    <attributes>
-                                      <attribute name="scale" value="1.5"/>
-                                    </attributes>
+                                    <property name="transition_type">crossfade</property>
+                                    <property name="reveal_child">True</property>
+                                    <child>
+                                      <object class="GtkBox" id="amPmBox">
+                                        <property name="visible">True</property>
+                                        <property name="can_focus">False</property>
+                                        <property name="valign">center</property>
+                                        <property name="orientation">vertical</property>
+                                        <child>
+                                          <object class="GtkButton" id="amPmUpButton">
+                                            <property name="visible">True</property>
+                                            <property name="can_focus">True</property>
+                                            <property name="receives_default">True</property>
+                                            <property name="image">upImage1</property>
+                                            <signal name="clicked" handler="on_updown_ampm_clicked" swapped="no"/>
+                                            <child internal-child="accessible">
+                                              <object class="AtkObject" id="amPmUpButton-atkobject">
+                                                <property name="AtkObject::accessible-name" translatable="yes">AM/PM Up</property>
+                                              </object>
+                                            </child>
+                                          </object>
+                                          <packing>
+                                            <property name="expand">False</property>
+                                            <property name="fill">True</property>
+                                            <property name="position">0</property>
+                                          </packing>
+                                        </child>
+                                        <child>
+                                          <object class="GtkLabel" id="amPmLabel">
+                                            <property name="visible">True</property>
+                                            <property name="can_focus">False</property>
+                                            <property name="label" translatable="yes">PM</property>
+                                            <property name="margin_top">4</property>
+                                            <property name="margin_bottom">5</property>
+                                            <attributes>
+                                              <attribute name="scale" value="1.5"/>
+                                            </attributes>
+                                          </object>
+                                          <packing>
+                                            <property name="expand">False</property>
+                                            <property name="fill">True</property>
+                                            <property name="position">1</property>
+                                          </packing>
+                                        </child>
+                                        <child>
+                                          <object class="GtkButton" id="amPmDownButton">
+                                            <property name="visible">True</property>
+                                            <property name="can_focus">True</property>
+                                            <property name="receives_default">True</property>
+                                            <property name="image">downImage1</property>
+                                            <signal name="clicked" handler="on_updown_ampm_clicked" swapped="no"/>
+                                            <child internal-child="accessible">
+                                              <object class="AtkObject" id="amPmDownButton-atkobject">
+                                                <property name="AtkObject::accessible-name" translatable="yes">AM/PM Down</property>
+                                              </object>
+                                            </child>
+                                          </object>
+                                          <packing>
+                                            <property name="expand">False</property>
+                                            <property name="fill">True</property>
+                                            <property name="position">2</property>
+                                          </packing>
+                                        </child>
+                                      </object>
+                                   </child>
                                   </object>
                                   <packing>
                                     <property name="left_attach">4</property>
-                                    <property name="top_attach">1</property>
+                                    <property name="top_attach">0</property>
+                                    <property name="height">3</property>
                                   </packing>
                                 </child>
                                 <child>
diff --git a/pyanaconda/ui/gui/spokes/datetime_spoke.py b/pyanaconda/ui/gui/spokes/datetime_spoke.py
index b473924..12c9b06 100644
--- a/pyanaconda/ui/gui/spokes/datetime_spoke.py
+++ b/pyanaconda/ui/gui/spokes/datetime_spoke.py
@@ -434,6 +434,7 @@ class DatetimeSpoke(FirstbootSpokeMixIn, NormalSpoke):
         self._amPmDown = self.builder.get_object("amPmDownButton")
         self._amPmLabel = self.builder.get_object("amPmLabel")
         self._radioButton24h = self.builder.get_object("timeFormatRB")
+        self._amPmRevealer = self.builder.get_object("amPmRevealer")
 
         # create widgets for displaying/configuring date
         day_box, self._dayCombo, day_label = _new_date_field_box(self._daysFilter)
@@ -1026,11 +1027,12 @@ class DatetimeSpoke(FirstbootSpokeMixIn, NormalSpoke):
         if button24h.get_active():
             self._set_amPm_part_sensitive(False)
             new_hours = self._to_24h(hours, amPm)
-
+            self._amPmRevealer.set_reveal_child(False)
         else:
             self._set_amPm_part_sensitive(True)
             new_hours, new_amPm = self._to_amPm(hours)
             self._amPmLabel.set_text(new_amPm)
+            self._amPmRevealer.set_reveal_child(True)
 
         self._hoursLabel.set_text("%0.2d" % new_hours)
 
-- 
1.9.3



More information about the anaconda-patches mailing list