Re: [PyGObject] Drag & Drop in a TreeView
- From: Colomban Wendling <lists ban herbesfolles org>
- To: gtk-app-devel-list gnome org
- Subject: Re: [PyGObject] Drag & Drop in a TreeView
- Date: Sat, 28 Jul 2018 11:02:50 +0200
Le 27/07/2018 à 23:05, c.buhtz--- via gtk-app-devel-list a écrit :
Dear Reuben
On 2018-07-23 08:03 Reuben Rissler <silrep emypeople net> wrote:
This is how I have done it in the past. Note, I do not proclaim
spectacular or Pythonic code, and would humbly accept any corrections
and/or better ways to accomplish this. It seems to me there should be
a way to let the TreeView do this work itself, but alas, I have not
found it yet.
Your code works for me - thank you very much. But I also have the
question if anyone here could improve it or show a more easier and
elegant way.
If it's only for reordering the elements in the tree view, you can use
the built-in Gtk.TreeView.set_reorderable() method [1], and you're all
set. You get inserted/deleted signals for moved rows so you can know
when and how things changed if needed, and the underlying model is also
changing accordingly.
Regards,
Colomban
[1]
https://developer.gnome.org/gtk3/stable/GtkTreeView.html#gtk-tree-view-set-reorderable
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]