[PATCH 2/2] Don't traceback when removing a mountpoint with no expanded selector (#862746).

Chris Lumens clumens at redhat.com
Fri Oct 12 17:33:59 UTC 2012


Most of this patch is just un-indenting stuff.  The rest is replacing references
to currentPage with references to selector._root.  Same data, really.
---
 pyanaconda/ui/gui/spokes/custom.py | 67 ++++++++++++++++++++------------------
 1 file changed, 35 insertions(+), 32 deletions(-)

diff --git a/pyanaconda/ui/gui/spokes/custom.py b/pyanaconda/ui/gui/spokes/custom.py
index b47e76d..3150f6d 100644
--- a/pyanaconda/ui/gui/spokes/custom.py
+++ b/pyanaconda/ui/gui/spokes/custom.py
@@ -1679,42 +1679,45 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker):
             self._current_selector = None
 
     def on_remove_clicked(self, button):
-        page = self._accordion.currentPage()
-        log.info("on_remove_clicked: %s" % page.pageTitle)
+        # Nothing displayed on the RHS?  Nothing to remove.
+        if not self._current_selector:
+            return
 
-        if self._current_selector:
-            device = self._current_selector._device
-            log.debug("removing device '%s' from page %s" % (device,
-                                                             page.pageTitle))
-            if page.pageTitle == new_install_name:
-                if device.exists:
-                    # This is an existing device that was added to the new page.
-                    # All we want to do is revert any changes to the device and
-                    # it will end up back in whatever old pages it came from.
-                    with ui_storage_logger():
-                        self.__storage.resetDevice(device)
-
-                    log.debug("updated device: %s" % device)
-                else:
-                    # Destroying a non-existing device doesn't require any
-                    # confirmation.
-                    self._destroy_device(device)
-            else:
-                # This is a device that exists on disk and most likely has data
-                # on it.  Thus, we first need to confirm with the user and then
-                # schedule actions to delete the thing.
-                dialog = ConfirmDeleteDialog(self.data)
-                with enlightbox(self.window, dialog.window):
-                    dialog.refresh(getattr(device.format, "mountpoint", ""),
-                                   device.name)
-                    rc = dialog.run()
-
-                    if rc == 0:
-                        return
+        selector = self._current_selector
+        log.info("on_remove_clicked: %s" % selector._root.name)
+
+        device = self._current_selector._device
+        log.debug("removing device '%s' from page %s" % (device, selector._root.name))
+
+        if selector._root.name == new_install_name:
+            if device.exists:
+                # This is an existing device that was added to the new page.
+                # All we want to do is revert any changes to the device and
+                # it will end up back in whatever old pages it came from.
+                with ui_storage_logger():
+                    self.__storage.resetDevice(device)
 
+                log.debug("updated device: %s" % device)
+            else:
+                # Destroying a non-existing device doesn't require any
+                # confirmation.
                 self._destroy_device(device)
+        else:
+            # This is a device that exists on disk and most likely has data
+            # on it.  Thus, we first need to confirm with the user and then
+            # schedule actions to delete the thing.
+            dialog = ConfirmDeleteDialog(self.data)
+            with enlightbox(self.window, dialog.window):
+                dialog.refresh(getattr(device.format, "mountpoint", ""),
+                               device.name)
+                rc = dialog.run()
+
+                if rc == 0:
+                    return
+
+            self._destroy_device(device)
 
-            log.info("ui: removed device %s" % device.name)
+        log.info("ui: removed device %s" % device.name)
 
         # Now that devices have been removed from the installation root,
         # refreshing the display will have the effect of making them disappear.
-- 
1.7.11.2



More information about the anaconda-patches mailing list