[PATCH 1/7] Require passing the title to a Page's constructor.

Chris Lumens clumens at redhat.com
Wed Feb 27 21:18:25 UTC 2013


---
 pyanaconda/ui/gui/spokes/custom.py        | 14 ++++++--------
 pyanaconda/ui/gui/spokes/lib/accordion.py | 12 ++++++------
 2 files changed, 12 insertions(+), 14 deletions(-)

diff --git a/pyanaconda/ui/gui/spokes/custom.py b/pyanaconda/ui/gui/spokes/custom.py
index ba93b72..bb72697 100644
--- a/pyanaconda/ui/gui/spokes/custom.py
+++ b/pyanaconda/ui/gui/spokes/custom.py
@@ -684,8 +684,9 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker):
         # If we've not yet run autopart, add an instance of CreateNewPage.  This
         # ensures it's only added once.
         if not new_devices:
-            page = CreateNewPage(self.on_create_clicked, partitionsToReuse=bool(ui_roots))
-            page.pageTitle = self.translated_new_install_name
+            page = CreateNewPage(self.translated_new_install_name,
+                                 self.on_create_clicked,
+                                 partitionsToReuse=bool(ui_roots))
             self._accordion.addPage(page, cb=self.on_page_clicked)
 
             if page.pageTitle not in page_order:
@@ -715,8 +716,7 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker):
                            (root.name == self.translated_new_install_name or d.format.exists)]:
                 continue
 
-            page = Page()
-            page.pageTitle = root.name
+            page = Page(root.name)
 
             for (mountpoint, device) in root.mounts.iteritems():
                 if device not in self._devices or \
@@ -744,8 +744,7 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker):
 
         # Anything that doesn't go with an OS we understand?  Put it in the Other box.
         if self.unusedDevices:
-            page = UnknownPage()
-            page.pageTitle = _("Unknown")
+            page = UnknownPage(_("Unknown"))
 
             for u in sorted(self.unusedDevices, key=lambda d: d.name):
                 page.addSelector(u, self.on_selector_clicked)
@@ -803,8 +802,7 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker):
             expander = self._accordion._find_by_title(self.translated_new_install_name)
             expander.remove(expander.get_child())
 
-            page = Page()
-            page.pageTitle = self.translated_new_install_name
+            page = Page(self.translated_new_install_name)
             expander.add(page)
 
             # pull in all the existing swap devices
diff --git a/pyanaconda/ui/gui/spokes/lib/accordion.py b/pyanaconda/ui/gui/spokes/lib/accordion.py
index 7c47c6a..d0d1a83 100644
--- a/pyanaconda/ui/gui/spokes/lib/accordion.py
+++ b/pyanaconda/ui/gui/spokes/lib/accordion.py
@@ -181,7 +181,7 @@ class Accordion(Gtk.Box):
 # comprise a single installed OS into two categories - Data filesystems and System filesystems.
 # Each filesystem is described by a single MountpointSelector.
 class Page(Gtk.Box):
-    def __init__(self):
+    def __init__(self, title):
         Gtk.Box.__init__(self, orientation=Gtk.Orientation.VERTICAL, spacing=6)
 
         # Create the Data label and a box to store all its members in.
@@ -195,7 +195,7 @@ class Page(Gtk.Box):
         self.add(self._systemBox)
 
         self._members = []
-        self.pageTitle = ""
+        self.pageTitle = title
 
     def _make_category_label(self, name):
         label = Gtk.Label()
@@ -250,11 +250,11 @@ class Page(Gtk.Box):
         cb(selector)
 
 class UnknownPage(Page):
-    def __init__(self):
+    def __init__(self, title):
         # For this type of page, there's only one place to store members.
         Gtk.Box.__init__(self, orientation=Gtk.Orientation.VERTICAL, spacing=6)
         self._members = []
-        self.pageTitle = ""
+        self.pageTitle = title
 
     def addSelector(self, device, cb, mountpoint=""):
         selector = selectorFromDevice(device, mountpoint=mountpoint)
@@ -275,9 +275,9 @@ class UnknownPage(Page):
 # of this class will be packed into the Accordion first and then when the new installation
 # is created, it will be removed and replaced with a Page for it.
 class CreateNewPage(Page):
-    def __init__(self, cb, partitionsToReuse=True):
+    def __init__(self, title, cb, partitionsToReuse=True):
         Gtk.Box.__init__(self, orientation=Gtk.Orientation.VERTICAL, spacing=6)
-        self.pageTitle = ""
+        self.pageTitle = title
 
         # Create a box where we store the "Here's how you create a new blah" info.
         self._createBox = Gtk.Grid()
-- 
1.8.1.2



More information about the anaconda-patches mailing list