Does no one has an idea?
Am I the only one facing such problems?

https://stackoverflow.com/q/50643938/4865723

On 2018-05-31 23:59 <c.bu...@posteo.jp> wrote:
> I am looking for an elegant and pythonic way to connect the model of a
> Gtk.ListStore (the content container for a Gtk.TreeView) to the real
> data.
> 
> Thinking the C-way I would store a pointer as a hidden column linking
> to the data structure in each entry of Gtk.ListStore. But I don't see
> a way to do this.
> 
> The data is just one or more lists of dictionaries. The point is that
> the Gtk.ListStore can represent on complete data list or only a
> selection of some entries of multiple data lists. It is important to
> know that the entries doesn't have a unique key. A data list could
> look like this:
> 
> data_list = [
>     {
>         'title': 'A title',
>         'read_status': False
>     },
>     {
>         'title': ....
>     }]
> 
> Imagine news or mail messages. The font is bold if 'read_status' is
> False and otherwise. When I click on an entry in the Gtk.TreeView the
> font is modified from bold to normal. But the entry in the data list
> should know this also! But how does the Gtk.TreeView or the
> Gtk.ListStore entry know the real data?
> 
> How do you solve such problems?
> 
> I could create unique keys for each data list entry and store this
> keys in a hidden column in the Gtk.ListStore. But this would blow up
> the (real) code and would cause some other problems I need to deal
> with. What is about pythons id() function? Or is there any other
> solution? _______________________________________________
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Reply via email to