[PATCH 1/3] Make code to get new devices reusable as property
Vratislav Podzimek
vpodzime at redhat.com
Thu Oct 3 14:02:35 UTC 2013
Related: rhbz#1011391
Signed-off-by: Vratislav Podzimek <vpodzime at redhat.com>
---
pyanaconda/ui/gui/spokes/custom.py | 41 ++++++++++++++++++++------------------
1 file changed, 22 insertions(+), 19 deletions(-)
diff --git a/pyanaconda/ui/gui/spokes/custom.py b/pyanaconda/ui/gui/spokes/custom.py
index 2d784d1..170f0b2 100644
--- a/pyanaconda/ui/gui/spokes/custom.py
+++ b/pyanaconda/ui/gui/spokes/custom.py
@@ -897,20 +897,8 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker):
self._current_selector.set_chosen(False)
self._current_selector = None
- 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.
- self._accordion.removeAllPages()
-
- # Start with buttons disabled, since nothing is selected.
- self._removeButton.set_sensitive(False)
- self._configButton.set_sensitive(False)
-
- # Now it's time to populate the accordion.
-
+ @property
+ def new_devices(self):
# A device scheduled for formatting only belongs in the new root.
new_devices = [d for d in self._devices if d.isleaf and
not d.format.exists and
@@ -927,15 +915,30 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker):
new_devices = list(set(new_devices))
+ 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.
+ self._accordion.removeAllPages()
+
+ # Start with buttons disabled, since nothing is selected.
+ self._removeButton.set_sensitive(False)
+ self._configButton.set_sensitive(False)
+
+ # Now it's time to populate the accordion.
log.debug("ui: devices=%s", [d.name for d in self._devices])
log.debug("ui: unused=%s", [d.name for d in self.unusedDevices])
- log.debug("ui: new_devices=%s", [d.name for d in new_devices])
+ log.debug("ui: new_devices=%s", [d.name for d in self.new_devices])
ui_roots = self.__storage.roots[:]
# If we've not yet run autopart, add an instance of CreateNewPage. This
# ensures it's only added once.
- if not new_devices:
+ if not self.new_devices:
page = CreateNewPage(self.translated_new_install_name,
self.on_create_clicked,
partitionsToReuse=bool(ui_roots))
@@ -946,11 +949,11 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker):
_("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 new_devices if d.format.type == "swap"]
- mounts = dict((d.format.mountpoint, d) for d in new_devices
+ swaps = [d for d in self.new_devices if d.format.type == "swap"]
+ mounts = dict((d.format.mountpoint, d) for d in self.new_devices
if getattr(d.format, "mountpoint", None))
- for device in new_devices:
+ for device in self.new_devices:
if device in self.bootLoaderDevices:
mounts[device.format.type] = device
--
1.8.3.1
More information about the anaconda-patches
mailing list