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

Cole Robinson crobinso at redhat.com
Fri Jun 28 17:03:46 UTC 2013


On 06/28/2013 12:57 PM, Richard W.M. Jones wrote:
> 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

What pygobject3 version are you using? We already hit a similar issue but
worked around it, search for can_set_row_none in manager.py. But this should
be fixed with F19 pygobject3 at least.

- Cole

> ---
>  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.
> 




More information about the virt-tools-list mailing list