[pygtk] Not possible to drag-n-drop in a treeview after a set_sort_column_id

Lionel Dricot zeploum at gmail.com
Tue Jan 27 22:56:22 WST 2009


Hello,

I'm displaying a TreeStore in a TreeView and I want to allow the user to
re-organize its data by drag-n-dropping.

( If you want to try, the code is available with "bzr branch lp:gtg" in
taskbrowser/browser.py. I will specify the line.
 If I give you a given rev. number $X, type, after branching, "bzr revert -r
$X"  use "./debug.sh" to launch the soft with a dummy data set )

In order to handle drag-n-drop, I connect to the row-changed and row-deleted
signal to the function that will update my datas to reflect the change
(rev.123,li 675)


It was working fine until my co-coder fixed some sorting bugs (typically, we
display strings but we want to sort them as integer or date).

Between rev. 108 and rev. 109, drag-n-dropping stopped working. The tree
just refuses you to drag-n-drop.

I've looked and found that commenting one line added during this commit was
causing the problem :

self.treestore.set_sort_column_id (2, gtk.SORT_ASCENDING (rev.109,li 113)

Commenting this line restore drag-n-drop. Re-enabling it break the feature.

So, why such a behaviour ? I'm sure there's something I don't understand
about drag-n-drop and sorting. Can anyone explain to me how I can keep this
line and restore drag-n-drop functionnality ?

Thanks in advance,

Lionel


PS: in rev.123 this line is now in taskbrowser/treetools.py, li 19
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.daa.com.au/pipermail/pygtk/attachments/20090127/da17184d/attachment.htm 


More information about the pygtk mailing list