[PATCH 4/5] Put newly created devices in a page of their own.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Unset autopart flag after running ksdata.autopart.execute since we
are still techically doing custom partitioning.

Don't show devices queued for removal in the custom spoke.

Don't include Roots whose root device has been queued for removal.
---
 pyanaconda/ui/gui/spokes/custom.py |   36 +++++++++++++++++++++++++++++-------
 1 files changed, 29 insertions(+), 7 deletions(-)

diff --git a/pyanaconda/ui/gui/spokes/custom.py b/pyanaconda/ui/gui/spokes/custom.py
index a97b96e..e304854 100644
--- a/pyanaconda/ui/gui/spokes/custom.py
+++ b/pyanaconda/ui/gui/spokes/custom.py
@@ -38,6 +38,7 @@ P_ = lambda x, y, z: gettext.ldngettext("anaconda", x, y, z)
 from pyanaconda.product import productName, productVersion
 from pyanaconda.storage.formats import device_formats
 from pyanaconda.storage.size import Size
+from pyanaconda.storage import Root
 
 from pyanaconda.ui.gui import UIObject
 from pyanaconda.ui.gui.spokes import NormalSpoke
@@ -243,11 +244,18 @@ class CustomPartitioningSpoke(NormalSpoke):
         # We can only have one page expanded at a time.
         did_expand = False
 
+        unused = self._unusedDevices()
+        new_devices = [d for d in self.storage.devicetree.leaves if d not in unused and not d.exists]
+
+        new_install_name = _("New %s %s Installation") % (productName, productVersion)
+
+        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 self._ran_autopart:
+        if not self._ran_autopart and not new_devices:
             page = CreateNewPage(self.on_create_clicked)
-            page.pageTitle = _("New %s %s Installation") % (productName, productVersion)
+            page.pageTitle = new_install_name
             self._accordion.addPage(page, cb=self.on_page_clicked)
             self._accordion.expandPage(page.pageTitle)
             did_expand = True
@@ -255,18 +263,32 @@ class CustomPartitioningSpoke(NormalSpoke):
             self._partitionsNotebook.set_current_page(0)
             label = self.builder.get_object("whenCreateLabel")
             label.set_text(self._when_create_text % (productName, productVersion))
+        elif new_devices:
+            swaps = [d for d in new_devices if d in self.storage.swaps]
+            mounts = dict([(d.format.mountpoint, d) for d in new_devices if getattr(d.format, "mountpoint", None)])
+            new_root = Root(mounts=mounts, swaps=swaps, name=new_install_name)
+            roots.insert(0, new_root)
 
         # Add in all the existing (or autopart-created) operating systems.
-        for root in self.storage.roots:
+        for root in roots:
+            if root.device and root.device not in self.storage.devices:
+                continue
+
             page = Page()
             page.pageTitle = root.name
 
-            for swap in root.swaps:
-                selector = page.addDevice("Swap", swap.size, None, self.on_selector_clicked)
-                selector._device = swap
+            for device in root.swaps:
+                if device not in self.storage.devices:
+                    continue
+
+                selector = page.addDevice("Swap", device.size, None, self.on_selector_clicked)
+                selector._device = device
                 selector._root = root
 
             for (mountpoint, device) in root.mounts.iteritems():
+                if device not in self.storage.devices:
+                    continue
+
                 selector = page.addDevice(self._mountpointName(mountpoint) or device.format.name, device.size, mountpoint, self.on_selector_clicked)
                 selector._device = device
                 selector._root = root
@@ -279,7 +301,6 @@ class CustomPartitioningSpoke(NormalSpoke):
                 self._accordion.expandPage(root.name)
 
         # Anything that doesn't go with an OS we understand?  Put it in the Other box.
-        unused = self._unusedDevices()
         if unused:
             page = UnknownPage()
             page.pageTitle = _("Unknown")
@@ -542,6 +563,7 @@ class CustomPartitioningSpoke(NormalSpoke):
         # FIXME:  Handle all the autopart exns here.
         self.data.autopart.autopart = True
         self.data.autopart.execute(self.storage, self.data, self.instclass)
+        self.data.autopart.autopart = False
 
         # Create a new Root object for the new installation and put it into
         # the storage object.  This means any boot-related devices we make for
-- 
1.7.7.6

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list


[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux