[PATCH] Use GtkRevealer for widget hiding in storage spoke

Martin Kolman mkolman at redhat.com
Fri Jul 4 14:34:08 UTC 2014


This prevents the other widgets from jumping around, which
occurs when just using set_visible() and also provides a nice
fade-in and fade-out effect. :)

Signed-off-by: Martin Kolman <mkolman at redhat.com>
---
 pyanaconda/ui/gui/spokes/storage.glade | 125 ++++++++++++++++++++-------------
 pyanaconda/ui/gui/spokes/storage.py    |  10 +--
 2 files changed, 80 insertions(+), 55 deletions(-)

diff --git a/pyanaconda/ui/gui/spokes/storage.glade b/pyanaconda/ui/gui/spokes/storage.glade
index 011ccdc..6074750 100644
--- a/pyanaconda/ui/gui/spokes/storage.glade
+++ b/pyanaconda/ui/gui/spokes/storage.glade
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.18.1 -->
+<!-- Generated with glade 3.18.3 -->
 <interface>
-  <requires lib="gtk+" version="3.6"/>
+  <requires lib="gtk+" version="3.10"/>
   <requires lib="AnacondaWidgets" version="1.0"/>
   <object class="GtkDialog" id="need_space_dialog">
     <property name="can_focus">False</property>
@@ -595,15 +595,24 @@
                               </packing>
                             </child>
                             <child>
-                              <object class="GtkLabel" id="local_untouched_label">
+                              <object class="GtkRevealer" id="local_untouched_label_revealer">
+                                <property name="visible">True</property>
                                 <property name="can_focus">False</property>
-                                <property name="no_show_all">True</property>
-                                <property name="margin_right">18</property>
-                                <property name="xalign">1</property>
-                                <property name="label" translatable="yes">Disks left unselected here will not be touched.</property>
-                                <attributes>
-                                  <attribute name="font-desc" value="Cantarell Italic 10"/>
-                                </attributes>
+                                <property name="transition_type">crossfade</property>
+                                <property name="reveal_child">True</property>
+                                <child>
+                                  <object class="GtkLabel" id="local_untouched_label">
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">False</property>
+                                    <property name="no_show_all">True</property>
+                                    <property name="margin_right">18</property>
+                                    <property name="xalign">1</property>
+                                    <property name="label" translatable="yes">Disks left unselected here will not be touched.</property>
+                                    <attributes>
+                                      <attribute name="font-desc" value="Cantarell Italic 10"/>
+                                    </attributes>
+                                  </object>
+                                </child>
                               </object>
                               <packing>
                                 <property name="expand">False</property>
@@ -726,15 +735,24 @@
                               </packing>
                             </child>
                             <child>
-                              <object class="GtkLabel" id="special_untouched_label">
+                              <object class="GtkRevealer" id="special_untouched_label_revealer">
+                                <property name="visible">True</property>
                                 <property name="can_focus">False</property>
-                                <property name="no_show_all">True</property>
-                                <property name="margin_right">18</property>
-                                <property name="xalign">1</property>
-                                <property name="label" translatable="yes">Disks left unselected here will not be touched.</property>
-                                <attributes>
-                                  <attribute name="font-desc" value="Cantarell Italic 10"/>
-                                </attributes>
+                                <property name="transition_type">crossfade</property>
+                                <property name="reveal_child">True</property>
+                                <child>
+                                  <object class="GtkLabel" id="special_untouched_label">
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">False</property>
+                                    <property name="no_show_all">True</property>
+                                    <property name="margin_right">18</property>
+                                    <property name="xalign">1</property>
+                                    <property name="label" translatable="yes">Disks left unselected here will not be touched.</property>
+                                    <attributes>
+                                      <attribute name="font-desc" value="Cantarell Italic 10"/>
+                                    </attributes>
+                                  </object>
+                                </child>
                               </object>
                               <packing>
                                 <property name="expand">False</property>
@@ -930,38 +948,6 @@
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
                     <child>
-                      <object class="GtkButton" id="summary_button">
-                        <property name="visible">True</property>
-                        <property name="can_focus">True</property>
-                        <property name="receives_default">True</property>
-                        <property name="no_show_all">True</property>
-                        <property name="halign">start</property>
-                        <property name="margin_left">18</property>
-                        <property name="hexpand">True</property>
-                        <property name="relief">none</property>
-                        <property name="use_underline">True</property>
-                        <property name="focus_on_click">False</property>
-                        <property name="xalign">0</property>
-                        <signal name="clicked" handler="on_summary_clicked" swapped="no"/>
-                        <child>
-                          <object class="GtkLabel" id="label5">
-                            <property name="visible">True</property>
-                            <property name="can_focus">False</property>
-                            <property name="label" translatable="yes" context="GUI|Storage">_Full disk summary and bootloader...</property>
-                            <property name="use_underline">True</property>
-                            <attributes>
-                              <attribute name="underline" value="True"/>
-                              <attribute name="foreground" value="#00000000ffff"/>
-                            </attributes>
-                          </object>
-                        </child>
-                      </object>
-                      <packing>
-                        <property name="left_attach">0</property>
-                        <property name="top_attach">0</property>
-                      </packing>
-                    </child>
-                    <child>
                       <object class="GtkLabel" id="summary_label">
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
@@ -978,6 +964,45 @@
                         <property name="top_attach">0</property>
                       </packing>
                     </child>
+                    <child>
+                      <object class="GtkRevealer" id="summary_button_revealer">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="transition_type">crossfade</property>
+                        <property name="reveal_child">True</property>
+                        <child>
+                          <object class="GtkButton" id="summary_button">
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="receives_default">True</property>
+                            <property name="no_show_all">True</property>
+                            <property name="halign">start</property>
+                            <property name="hexpand">True</property>
+                            <property name="relief">none</property>
+                            <property name="use_underline">True</property>
+                            <property name="focus_on_click">False</property>
+                            <property name="xalign">0</property>
+                            <signal name="clicked" handler="on_summary_clicked" swapped="no"/>
+                            <child>
+                              <object class="GtkLabel" id="label5">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="label" translatable="yes" context="GUI|Storage">_Full disk summary and bootloader...</property>
+                                <property name="use_underline">True</property>
+                                <attributes>
+                                  <attribute name="underline" value="True"/>
+                                  <attribute name="foreground" value="#00000000ffff"/>
+                                </attributes>
+                              </object>
+                            </child>
+                          </object>
+                        </child>
+                      </object>
+                      <packing>
+                        <property name="left_attach">0</property>
+                        <property name="top_attach">0</property>
+                      </packing>
+                    </child>
                   </object>
                   <packing>
                     <property name="expand">False</property>
diff --git a/pyanaconda/ui/gui/spokes/storage.py b/pyanaconda/ui/gui/spokes/storage.py
index bc391c6..79bb12a 100644
--- a/pyanaconda/ui/gui/spokes/storage.py
+++ b/pyanaconda/ui/gui/spokes/storage.py
@@ -592,11 +592,11 @@ class StorageSpoke(NormalSpoke, StorageChecker):
         summary_label.set_text(summary)
         summary_label.set_sensitive(anySelected)
 
-        summary_button = self.builder.get_object("summary_button")
-        summary_button.set_visible(anySelected)
-
-        self.builder.get_object("local_untouched_label").set_visible(anySelected)
-        self.builder.get_object("special_untouched_label").set_visible(anySelected)
+        # only show the "we won't touch your other disks" labels and summary button when
+        # some disks are selected
+        self.builder.get_object("summary_button_revealer").set_reveal_child(anySelected)
+        self.builder.get_object("local_untouched_label_revealer").set_reveal_child(anySelected)
+        self.builder.get_object("special_untouched_label_revealer").set_reveal_child(anySelected)
         self.builder.get_object("other_options_label").set_sensitive(anySelected)
         self.builder.get_object("other_options_grid").set_sensitive(anySelected)
 
-- 
1.9.3



More information about the anaconda-patches mailing list