From 1099ed1d10ad3cc12ab817943c27d3ca1cd9fabf Mon Sep 17 00:00:00 2001 From: Joel Granados Moreno Date: Fri, 4 Sep 2009 11:12:28 +0200 Subject: 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 file changed, 20 insertions(+), 10 deletions(-) (limited to 'iw/partition_gui.py') diff --git a/iw/partition_gui.py b/iw/partition_gui.py index 7c7a2a68c..d230a33c7 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 (%s)" \ + % (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(%s)" \ + % (disk.name, separator, disk.path) self.tree[parent]['PyObject'] = disk part = disk.format.firstPartition @@ -916,11 +926,11 @@ class PartitionWindow(InstallWindow): else: ptype = _("Unknown") if part.type & parted.PARTITION_FREESPACE: - devname = _("Free") + devstring = _("Free") ptype = "" 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 -- cgit