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

[PATCH 17/30] Display the device path with a smaller font and different color.



* iw/partition_gui.py (__init__): For the "Device" cell renderer, use
'markup' instead of just text.
(populate):  Use pango markup to chaqnge the size and color of the
device paths for 'normal' devices and raid devices.
---
 iw/partition_gui.py |   30 ++++++++++++++++++++----------
 1 files changed, 20 insertions(+), 10 deletions(-)

diff --git a/iw/partition_gui.py b/iw/partition_gui.py
index 1d70ba5..f718f7a 100644
--- a/iw/partition_gui.py
+++ b/iw/partition_gui.py
@@ -388,7 +388,7 @@ class DiskTreeModel(gtk.TreeStore):
             elif (kind == gobject.TYPE_STRING or
                   kind == gobject.TYPE_INT):
                 renderer = gtk.CellRendererText()
-		propertyMapping = {'text': i}
+                propertyMapping = {'markup': i}
 
             # wire in the cells that we want only visible on leaf nodes to
             # the special leaf node column.
@@ -772,11 +772,12 @@ class PartitionWindow(InstallWindow):
                     ptype = _("Unknown")
                     self.tree[iter]['IsFormattable'] = False
 
-		if array.minor is not None:
-		    device = "%s" % array.path
-		else:
-		    device = "Auto"
-		    
+                if array.minor is not None:
+                    device = "%s <span size=\"small\" color=\"gray\">(%s)</span>" \
+                            % (array.name, array.path)
+                else:
+                    device = "Auto"
+
                 self.tree[iter]['IsLeaf'] = True
                 self.tree[iter]['Device'] = device
                 if array.format.exists and getattr(format, "label", None):
@@ -797,7 +798,16 @@ class PartitionWindow(InstallWindow):
 
             # add a parent node to the tree
             parent = self.tree.append(drvparent)
-            self.tree[parent]['Device'] = "%s" % disk.path
+
+            # Insert a '\n' when device string is too long.  Usually when it
+            # contains '/dev/mapper'.  First column should be around 20 chars.
+            if len(disk.name) + len(disk.path) > 20:
+                separator = "\n"
+            else:
+                separator= " "
+            self.tree[parent]['Device'] = \
+                    "%s%s<span size=\"small\" color=\"gray\">(%s)</span>" \
+                    % (disk.name, separator, disk.path)
             self.tree[parent]['PyObject'] = disk
 
             part = disk.format.firstPartition
@@ -916,10 +926,10 @@ class PartitionWindow(InstallWindow):
                     else:
                         ptype = _("Unknown")
                 if part.type & parted.PARTITION_FREESPACE:
-                    devname = _("Free")
+                    devstring = _("Free")
                 else:
-                    devname = "%s" % device.path
-                self.tree[iter]['Device'] = devname
+                    devstring = device.name
+                self.tree[iter]['Device'] = devstring
                 if format and format.exists and \
                    getattr(format, "label", None):
                     self.tree[iter]['Label'] = "%s" % format.label
-- 
1.6.4.2


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