[PATCH] For very small disks, don't try to display a stripe in the graph (#480484).

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

 



---
 iw/partition_gui.py |   25 +++++++++++--------------
 1 files changed, 11 insertions(+), 14 deletions(-)

diff --git a/iw/partition_gui.py b/iw/partition_gui.py
index 24559ee..ac01e4f 100644
--- a/iw/partition_gui.py
+++ b/iw/partition_gui.py
@@ -153,8 +153,14 @@ class DiskStripeSlice:
         else:
             width = CANVAS_WIDTH_640
 
+        # If it's a very, very small partition then there's no point in trying
+        # cut off a piece of the parent disk's stripe for it.
+        if totalSectors == 0:
+            return
+
         xoffset = self.partition.geometry.start / totalSectors * width
         xlength = self.partition.geometry.length / totalSectors * width
+
         if self.partition.type & parted.PARTITION_LOGICAL:
             yoffset = 0.0 + LOGICAL_INSET
             yheight = STRIPE_HEIGHT - (LOGICAL_INSET * 2)
@@ -163,6 +169,7 @@ class DiskStripeSlice:
             yoffset = 0.0
             yheight = STRIPE_HEIGHT
             texty = LOGICAL_INSET
+
         self.group.set(x=xoffset, y=yoffset)
         self.box.set(x1=0.0, y1=0.0, x2=xlength,
                      y2=yheight, fill_color=self.fillColor(),
@@ -297,25 +304,15 @@ class DiskStripeGraph:
                 return stripe.getDisk()
 
     def add(self, drive, disk):
-#        yoff = len(self.diskStripes) * (STRIPE_HEIGHT + 5)
         yoff = self.next_ypos
         text = self.canvas.root().add(gnomecanvas.CanvasText,
                                       x=0.0, y=yoff,
                                       font="sans",
                                       size_points=9)
-	show_geometry = 0
-	if show_geometry:
-	    (cylinders, heads, sectors) = disk.device.biosGeometry
-	    drivetext = _("Drive %s (Geom: %s/%s/%s) "
-			 "(Model: %s)") % ('/dev/' + drive,
-					   cylinders, heads, sectors,
-					   disk.device.model)
-	else:
-	    drivetext = _("Drive %s (%-0.f MB) "
-			 "(Model: %s)") % ('/dev/' + drive,
-					   disk.device.getSize(unit="MB"),
-					   disk.device.model)
-
+        drivetext = _("Drive %s (%-0.f MB) "
+                     "(Model: %s)") % ('/dev/' + drive,
+                                       disk.device.getSize(unit="MB"),
+                                       disk.device.model)
 
         text.set(text=drivetext, fill_color='black', anchor=gtk.ANCHOR_NW,
                  weight=pango.WEIGHT_BOLD)
-- 
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