gobject.TYPE_PYOBJECT in a liststore

View: New views
2 Messages — Rating Filter:   Alert me  

gobject.TYPE_PYOBJECT in a liststore

by M3nt0r3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi, i am  converting a complex glade project to gtkbuilder. After a long
fight with custom widget that are managed differently in gtkguilber i
am  trying to use the treeview builder in glade.  In the original code i
have that

        model = gtk.ListStore(gobject.TYPE_PYOBJECT, str, str)

i created a similar scheme in glade:
i selected Gobject in the list but it give me a NoneType so if i append
a "None" it works but if a try to append to the model an object, string,
string it give me a wrong type error

this is a print of the glade-made model:

print  type(model[0][0]), type(model[0][1]), type(model[0][2])

<type 'NoneType'> <type 'str'> <type 'str'>

model.append([None, "stringa1", "stringa2"]) <-- it works

model.append([mags[0], "stringa1", "stringa2"]) <-- doesn't work (
mags[0] is a db-record-obj )

any tips?

Thanks

F.

_______________________________________________
Glade-users maillist  -  Glade-users@...
http://lists.ximian.com/mailman/listinfo/glade-users

Re: gobject.TYPE_PYOBJECT in a liststore

by M3nt0r3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

francesco wrote:

> Hi, i am  converting a complex glade project to gtkbuilder. After a long
> fight with custom widget that are managed differently in gtkguilber i
> am  trying to use the treeview builder in glade.  In the original code i
> have that
>
>         model = gtk.ListStore(gobject.TYPE_PYOBJECT, str, str)
>
> i created a similar scheme in glade:
> i selected Gobject in the list but it give me a NoneType so if i append
> a "None" it works but if a try to append to the model an object, string,
> string it give me a wrong type error
>
> this is a print of the glade-made model:
>
> print  type(model[0][0]), type(model[0][1]), type(model[0][2])
>
> <type 'NoneType'> <type 'str'> <type 'str'>
>
> model.append([None, "stringa1", "stringa2"]) <-- it works
>
> model.append([mags[0], "stringa1", "stringa2"]) <-- doesn't work (
> mags[0] is a db-record-obj )
>
> any tips?
>
> Thanks
>
> F.
>
> _______________________________________________
> Glade-users maillist  -  Glade-users@...
> http://lists.ximian.com/mailman/listinfo/glade-users
>  
Found that if i change from :

<columns>
      <!-- column-name GObject1 -->
      <column type="GObject"/>
      <!-- column-name Denominazione -->
      <column type="gchararray"/>
      <!-- column-name localita -->
      <column type="gchararray"/>
    </columns>


to:

<columns>
      <!-- column-name GObject1 -->
      <column type="gobject.TYPE_PYOBJECT"/>
      <!-- column-name Denominazione -->
      <column type="gchararray"/>
      <!-- column-name localita -->
      <column type="gchararray"/>
    </columns>

it works but if I edit again from edit it save:

      <!-- column-name GObject1 -->
      <column />

so i have to modify the xml file by hand everytime.

F.
_______________________________________________
Glade-users maillist  -  Glade-users@...
http://lists.ximian.com/mailman/listinfo/glade-users