Re: GtkListStore with None values



Hello Conscious user,

Conscious User [2012-03-19 19:21 -0300]:
> I'm working with a Gtk.ComboBox that uses a Gtk.ListStore
> as a model and Gtk.CellRendererText as the renderer. The
> model has two GdkRGBA elements that are added as the
> renderer attributes "background-rgba" and
> "foreground-rgba".
> 
> This was working with no warnings until today when, after
> a PyGObject update, several warnings like "liststore.c:
> unable to convert from (null) to GdkRGBA" started to appear.

This is a consequence of fixing
https://bugzilla.gnome.org/show_bug.cgi?id=671610 .

You cannot really put "NULL"/None values into a tree model for many
data types; Gtk silently puts in the default value for that data type
if you pass None (e. g. 0 for int).

So in C programs you'd get the same bug.

However, I realize that we can actually improve this to restore the
previous behaviour that cells which have a None value in the passed
row list just don't get set at all. Would you mind filing a bug about
it?

> So it seems that the model is not accepting None values
> anymore.

It does, it just complains about them instead of silently ignoring
them. In many cases that's actually better I think, but in the
interest of avoiding console spam we could restore the silent
behavioud, as I said above.

> But I was using None to indicate that the cell
> should use the default color (like override_color does).
> What should I do now to indicate this?

You can just put the actual default value there instead of None.

Martin

-- 
Martin Pitt                        | http://www.piware.de
Ubuntu Developer (www.ubuntu.com)  | Debian Developer  (www.debian.org)


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