Subject: manager: Use consistent row spacing even if we disable all graphs From: Cole Robinson crobinso@redhat.com Mon Sep 2 10:43:53 2013 -0400 Date: Mon Sep 2 10:43:53 2013 -0400: Git: b86c5b21ec3016f64dcf6e0375fcea166b16bcb7 Index: virt-manager-0.9.5/src/virtManager/manager.py =================================================================== --- virt-manager-0.9.5.orig/src/virtManager/manager.py +++ virt-manager-0.9.5/src/virtManager/manager.py @@ -48,11 +48,11 @@ ROW_COLOR = 11 ROW_INSPECTION_OS_ICON = 12 # Columns in the tree view -COL_NAME = 0 -COL_GUEST_CPU = 1 -COL_HOST_CPU = 2 -COL_DISK = 3 -COL_NETWORK = 4 +(COL_NAME, +COL_GUEST_CPU, +COL_HOST_CPU, +COL_DISK, +COL_NETWORK) = range(5) rcstring = """ style "toolbar-style" { @@ -92,13 +92,6 @@ class vmmManager(vmmGObjectUI): self.connmenu = gtk.Menu() self.connmenu_items = {} - # There seem to be ref counting issues with calling - # list.get_column, so avoid it - self.diskcol = None - self.netcol = None - self.guestcpucol = None - self.hostcpucol = None - self.window.connect_signals({ "on_menu_view_guest_cpu_usage_activate": (self.toggle_stats_visible, COL_GUEST_CPU), @@ -133,7 +126,15 @@ class vmmManager(vmmGObjectUI): "on_menu_help_activate": self.show_help, }) + # There seem to be ref counting issues with calling + # list.get_column, so avoid it + self.diskcol = None + self.netcol = None + self.guestcpucol = None + self.hostcpucol = None + self.spacer_txt = None self.init_vmlist() + self.init_stats() self.init_toolbar() self.init_context_menus() @@ -368,27 +369,31 @@ class vmmManager(vmmGObjectUI): nameCol = gtk.TreeViewColumn(_("Name")) nameCol.set_expand(True) nameCol.set_spacing(6) + nameCol.set_sort_column_id(COL_NAME) - statusCol = nameCol vmlist.append_column(nameCol) status_icon = gtk.CellRendererPixbuf() status_icon.set_property("stock-size", gtk.ICON_SIZE_DND) - statusCol.pack_start(status_icon, False) - statusCol.add_attribute(status_icon, 'icon-name', ROW_STATUS_ICON) - statusCol.add_attribute(status_icon, 'visible', ROW_IS_VM) + nameCol.pack_start(status_icon, False) + nameCol.add_attribute(status_icon, 'icon-name', ROW_STATUS_ICON) + nameCol.add_attribute(status_icon, 'visible', ROW_IS_VM) inspection_os_icon = gtk.CellRendererPixbuf() - statusCol.pack_start(inspection_os_icon, False) - statusCol.add_attribute(inspection_os_icon, 'pixbuf', - ROW_INSPECTION_OS_ICON) - statusCol.add_attribute(inspection_os_icon, 'visible', ROW_IS_VM) + nameCol.pack_start(inspection_os_icon, False) + nameCol.add_attribute(inspection_os_icon, 'pixbuf', + ROW_INSPECTION_OS_ICON) + nameCol.add_attribute(inspection_os_icon, 'visible', ROW_IS_VM) name_txt = gtk.CellRendererText() nameCol.pack_start(name_txt, True) nameCol.add_attribute(name_txt, 'markup', ROW_MARKUP) nameCol.add_attribute(name_txt, 'foreground-gdk', ROW_COLOR) - nameCol.set_sort_column_id(COL_NAME) + + self.spacer_txt = gtk.CellRendererText() + self.spacer_txt.set_property("ypad", 4) + self.spacer_txt.set_property("visible", False) + nameCol.pack_end(self.spacer_txt, False) def make_stats_column(title, colnum): col = gtk.TreeViewColumn(title) @@ -1161,6 +1166,10 @@ class vmmManager(vmmGObjectUI): col.set_visible(do_show) self.widget(menu).set_active(do_show) + any_visible = any([col.get_visible() for col in + [self.netcol, self.diskcol, self.guestcpucol, self.hostcpucol]]) + self.spacer_txt.set_property("visible", not any_visible) + def toggle_network_traffic_visible_widget(self, *ignore): self._toggle_graph_helper( self.config.is_vmlist_network_traffic_visible(), self.netcol,