[virt-tools-list] [PATCH 1/3] inspection: Don't set the OS_ICON to None.

Richard W.M. Jones rjones at redhat.com
Fri Jun 28 16:57:03 UTC 2013


From: "Richard W.M. Jones" <rjones at redhat.com>

Previously one could set the icon field of a tree model to None with
the obvious meaning that the icon shouldn't be displayed.  From what I
can tell it's no longer possible to do this.
See eg: http://www.daa.com.au/pipermail/pygtk/2012-December/020503.html

The field should already be None, so it probably doesn't matter.

The previous traceback was:

Traceback (most recent call last):
  File "/home/rjones/d/virt-manager/virtManager/manager.py", line 981, in vm_inspection_changed
    self.get_inspection_icon_pixbuf(vm, 16, 16)
  File "/usr/lib64/python2.7/site-packages/gi/overrides/Gtk.py", line 1152, in __setitem__
    self.model.set_value(self.iter, key, value)
  File "/usr/lib64/python2.7/site-packages/gi/overrides/Gtk.py", line 1298, in set_value
    Gtk.TreeStore.set_value(self, treeiter, column, value)
  File "/usr/lib64/python2.7/site-packages/gi/types.py", line 47, in function
    return info.invoke(*args, **kwargs)
TypeError: Argument 3 does not allow None as a value
---
 virtManager/manager.py | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/virtManager/manager.py b/virtManager/manager.py
index bdc21cf..4fdb5d9 100644
--- a/virtManager/manager.py
+++ b/virtManager/manager.py
@@ -977,9 +977,12 @@ class vmmManager(vmmGObjectUI):
             return
 
         row = self.rows[self.vm_row_key(vm)]
-        row[ROW_INSPECTION_OS_ICON] = \
-            self.get_inspection_icon_pixbuf(vm, 16, 16)
-        model.row_changed(row.path, row.iter)
+        new_icon = self.get_inspection_icon_pixbuf(vm, 16, 16)
+
+        # XXX Can't set field to None.
+        if new_icon is not None:
+            row[ROW_INSPECTION_OS_ICON] = new_icon
+            model.row_changed(row.path, row.iter)
 
     def get_inspection_icon_pixbuf(self, vm, w, h):
         # libguestfs gives us the PNG data as a string.
-- 
1.8.2.1




More information about the virt-tools-list mailing list