Python @dataclass and GtkTreeStore


I would like to know if it will be possible to serialize and deserialize GtkTreeStore data in Json format.

Or could you give me, please, a way to use python @dataclass for analyse, and a GtkTreeView to display change and save this same datas.

Thanks for your attention.

Well, the Gio.Resource seems to do the work :thinking:

Sorry to Ask this,
Any one know if JSON_GLIB will be soon implemented in pygobject ?

Pygobject does not “implement” libraries: you use pygobject to access libraries through the introspection layer.

Pretty sure you can already do:

import gi
from gi.repository import Json

and start using JSON-GLib.

Of course, I’d recommend using Python’s json module, unless you’re trying to integrate with object serialization. Even in that case, you cannot serialize a GtkTreeStore instance automatically: you have to iterate over the store and build a JSON array. At that point, you don’t need JSON-GLib.

Thanks for this information about libraries acces with pygobject. :slightly_smiling_face:

I was confuse to see nothing about json library in this adresse.

Sorry for this misunderstud.

This adress is still fine. Just amolenaar give the new usage to use GTK4.

Probably the same confusing about GListStore and GtkListStore :melting_face: