[PATCH] Make several changes to how addons are displayed (#873498).

Chris Lumens clumens at redhat.com
Wed Apr 17 15:16:18 UTC 2013


(1) Change the labels at the top of the software spoke so it looks like the
thing on the left side and the thing on the right side are related.

(2) Show environment-specific addons at the top of the list, followed by
generic ones.  Each set of addons is sorted alphabetically.

(3) Display a thin separator after the environment-specific addons.
---
 pyanaconda/ui/gui/spokes/software.glade |  6 ++++--
 pyanaconda/ui/gui/spokes/software.py    | 36 +++++++++++++++++++++++++++++----
 2 files changed, 36 insertions(+), 6 deletions(-)

diff --git a/pyanaconda/ui/gui/spokes/software.glade b/pyanaconda/ui/gui/spokes/software.glade
index 0b4ca77..8dac27c 100644
--- a/pyanaconda/ui/gui/spokes/software.glade
+++ b/pyanaconda/ui/gui/spokes/software.glade
@@ -10,6 +10,8 @@
       <column type="gchararray"/>
       <!-- column-name addonName -->
       <column type="gchararray"/>
+      <!-- column-name addonSeparator -->
+      <column type="gboolean"/>
     </columns>
   </object>
   <object class="GtkListStore" id="environmentStore">
@@ -84,7 +86,7 @@
                         <property name="margin_bottom">6</property>
                         <property name="hexpand">True</property>
                         <property name="xalign">0</property>
-                        <property name="label" translatable="yes">Choose your environment</property>
+                        <property name="label" translatable="yes">Base Environment</property>
                         <attributes>
                           <attribute name="font-desc" value="Cantarell 12"/>
                           <attribute name="weight" value="normal"/>
@@ -104,7 +106,7 @@
                         <property name="margin_bottom">6</property>
                         <property name="hexpand">True</property>
                         <property name="xalign">0</property>
-                        <property name="label" translatable="yes">Choose your add-ons</property>
+                        <property name="label" translatable="yes">Add-Ons for Selected Environment</property>
                         <attributes>
                           <attribute name="font-desc" value="Cantarell 12"/>
                           <attribute name="weight" value="normal"/>
diff --git a/pyanaconda/ui/gui/spokes/software.py b/pyanaconda/ui/gui/spokes/software.py
index 0f81fe8..a628b76 100644
--- a/pyanaconda/ui/gui/spokes/software.py
+++ b/pyanaconda/ui/gui/spokes/software.py
@@ -64,6 +64,9 @@ class SoftwareSelectionSpoke(NormalSpoke):
         self._origAddons = []
         self._origEnvironment = None
 
+        # We need to tell the addon view whether something is a separator or not.
+        self.builder.get_object("addonView").set_row_separator_func(self._addon_row_is_separator, None)
+
     def _apply(self):
         row = self._get_selected_environment()
         if not row:
@@ -258,18 +261,43 @@ class SoftwareSelectionSpoke(NormalSpoke):
 
         self.refreshAddons()
 
+    def _addon_row_is_separator(self, model, itr, *args):
+        # The last column of the model tells us if this row is a separator or not.
+        return model[itr][3]
+
+    def _addAddon(self, grp):
+        (name, desc) = self.payload.groupDescription(grp)
+        selected = grp in self.selectedGroups
+
+        self._addonStore.append([selected, "<b>%s</b>\n%s" % (name, desc), grp, False])
+
     def refreshAddons(self):
         from gi.repository import Gtk
 
         self._addonStore = self.builder.get_object("addonStore")
         self._addonStore.clear()
         if self.environment:
+            # First, we make up two lists:  One of addons specific to this environment,
+            # and one of all the others.  The environment-specific ones will be displayed
+            # first and then a separator, and then the generic ones.  This is to make it
+            # a little more obvious that the thing on the left side of the screen and the
+            # thing on the right side of the screen are related.
+            specific = []
+            generic = []
+
             for grp in self.payload.groups:
-                if self.payload.environmentHasOption(self.environment, grp) or (self.payload._isGroupVisible(grp) and self.payload._groupHasInstallableMembers(grp)):
-                    (name, desc) = self.payload.groupDescription(grp)
-                    selected = grp in self.selectedGroups
+                if self.payload.environmentHasOption(self.environment, grp):
+                    specific.append(grp)
+                elif self.payload._isGroupVisible(grp) and self.payload._groupHasInstallableMembers(grp):
+                    generic.append(grp)
+
+            for grp in specific:
+                self._addAddon(grp)
+
+            self._addonStore.append([False, "", "", True])
 
-                    self._addonStore.append([selected, "<b>%s</b>\n%s" % (name, desc), grp])
+            for grp in generic:
+                self._addAddon(grp)
 
         self._selectFlag = True
 
-- 
1.8.1.2



More information about the anaconda-patches mailing list