[PATCH] Don't traceback when a freespace partition is present (#499662).

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

 



This does not allow you to click on a freespace slice in the graph and then
edit, new, delete, etc. but it does prevent tracebacks.  One step at a time.
---
 iw/partition_gui.py |   17 +++++++++++++++--
 1 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/iw/partition_gui.py b/iw/partition_gui.py
index 9907ae8..9968f07 100644
--- a/iw/partition_gui.py
+++ b/iw/partition_gui.py
@@ -180,12 +180,19 @@ class DiskStripeSlice:
     def __init__(self, parent, partition, treeView, editCB):
         self.text = None
         self.partition = partition
-        self.partedPartition = partition.partedPartition
         self.parent = parent
         self.treeView = treeView
         self.editCB = editCB
         pgroup = parent.getGroup()
 
+        # Slices representing freespace are passed a pyparted object as
+        # partition, not an anaconda storage object.  Therefore, they do
+        # not have a partedPartition attribute.
+        if self.partition and hasattr(self.partition, "partedPartition"):
+            self.partedPartition = self.partition.partedPartition
+        else:
+            self.partedPartition = self.partition
+
         self.group = pgroup.add(gnomecanvas.CanvasGroup)
         self.box = self.group.add(gnomecanvas.CanvasRect)
         self.group.connect("event", self.eventHandler)
@@ -816,7 +823,13 @@ class PartitionWindow(InstallWindow):
                         part = part.nextPartition()
                         continue
 
-                stripe.add(device)
+                # If this is a freespace "partition", there's no device so
+                # don't add it.
+                if device:
+                    stripe.add(device)
+                else:
+                    stripe.add(part)
+
                 if device and device.isExtended:
                     if extendedParent:
                         raise RuntimeError, ("can't handle more than "
-- 
1.6.1.3

_______________________________________________
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