Hi all,
I've just created an entry in bugzilla.gnome.org with a patch that wraps
a paier of useful d'n'd methods for reordering treeview rows, for those
who are foolish enough to not use set_reorderable[1].
http://bugzilla.gnome.org/show_bug.cgi?id=116133
I've implemented the TreeView.enable_model_drag_{source|dest} and the
TreeView.{set|get}_drag_dest_row methods. The changes compile fine,
and should be correct, code-wise(I've never wrapped a C function with
Python...).
+++
Unfortunately, I've a problem when I try to implement row drag and
dropping... More than a problem, I'd call it an odd behaviour. It has
nothing to do with the patch: in fact, I wrote the patch just in case
that my previous approach to solve this odd behaviour was wrong.
Foreword: I've a widget which subclasses the gtk.TreeView; I've tried
to work on a test case using the list_store.py example, and, indeed, I
set up a working drag and drop reordering (even without using the
patched pygtk). If someone needs it, I'll send it on the list...
+++
When I apply the same solutions to my code, this is what happens:
* When I drag any row that's *below* the fourth from the bottom, to a
position *above* that row, the dragged row places itself at the fourth
position from the bottom, that is:
row0 row0 row0
row1 row1 <- drop row1
row2 row2 row2
row3 row3 row3
row4 row4 row6 <- result
row5 row5 row4
row6 <-drag row6 row5
row7 row7 row7
Obviously enough, my intent would be to place the 7th row in place of
the second row, with the other rows shifting one position down.
* When I drag a row *above* the fourth from the bottom to *any*
position, there's no effect whatsoever.
+++
The question is: am I doing something really brain damaged here, or is
there something that I'm not aware of in order to implement dragging and
dropping of rows between treeview widgets?
Thanks in advance,
Emmanuele.
+++
[1] Me, for instance. :-) But I need to drag'n'drop rows between various
treeview widgets, so set_reorderable it's not an option.
--
Emmanuele Bassi (Zefram) [ http://digilander.libero.it/ebassi/ ]
GnuPG Key fingerprint = 4DD0 C90D 4070 F071 5738 08BD 8ECC DB8F A432 0FF4
_______________________________________________
pygtk mailing list [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/