[PATCH 5/5] Move accordion population into a separate function
Vratislav Podzimek
vpodzime at redhat.com
Fri Mar 14 11:34:24 UTC 2014
This makes the code clearer and better readable.
Signed-off-by: Vratislav Podzimek <vpodzime at redhat.com>
---
pyanaconda/ui/gui/spokes/custom.py | 31 ++++++++++++++++++-------------
1 file changed, 18 insertions(+), 13 deletions(-)
diff --git a/pyanaconda/ui/gui/spokes/custom.py b/pyanaconda/ui/gui/spokes/custom.py
index f3b5870..058eca5 100644
--- a/pyanaconda/ui/gui/spokes/custom.py
+++ b/pyanaconda/ui/gui/spokes/custom.py
@@ -431,18 +431,10 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker):
return new_devices
- def _do_refresh(self, mountpointToShow=None):
- # block mountpoint selector signal handler for now
- self._initialized = False
- self._clear_current_selector()
-
- # Make sure we start with a clean slate.
+ def _populate_accordion(self):
+ # Make sure we start with a clean state.
self._accordion.removeAllPages()
- # Start with buttons disabled, since nothing is selected.
- self._removeButton.set_sensitive(False)
- self._configButton.set_sensitive(False)
-
new_devices = self.new_devices
# Now it's time to populate the accordion.
@@ -462,9 +454,10 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker):
self._accordion.addPage(page, cb=self.on_page_clicked)
self._partitionsNotebook.set_current_page(NOTEBOOK_LABEL_PAGE)
- self._whenCreateLabel.set_text(
- _("When you create mount points for your %(name)s %(version)s installation, you'll be able to view their details here.") %\
- {"name" : productName, "version" : productVersion})
+ self._whenCreateLabel.set_text(_("When you create mount points for "
+ "your %(name)s %(version)s installation, you'll be able to "
+ "view their details here.") % {"name" : productName,
+ "version" : productVersion})
else:
swaps = [d for d in self.new_devices if d.format.type == "swap"]
mounts = dict((d.format.mountpoint, d) for d in new_devices
@@ -519,6 +512,18 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker):
page.show_all()
self._accordion.addPage(page, cb=self.on_page_clicked)
+ def _do_refresh(self, mountpointToShow=None):
+ # block mountpoint selector signal handler for now
+ self._initialized = False
+ self._clear_current_selector()
+
+ # Start with buttons disabled, since nothing is selected.
+ self._removeButton.set_sensitive(False)
+ self._configButton.set_sensitive(False)
+
+ # populate the accorion with roots and mount points
+ self._populate_accordion()
+
# And then open the first page by default. Most of the time, this will
# be fine since it'll be the new installation page.
self._initialized = True
--
1.8.5.3
More information about the anaconda-patches
mailing list