[pygtk] Avoid leafs become root nodes on a 2-level tree TreeView

jors worbynet at gmail.com
Mon May 17 03:21:23 WST 2010


Hi there people,

I'm new in this list (this is my first post) and I'm also new at pygtk,
so it was clear someday I was going to come to you guys :)

The thing is I want to do a 2-level tree with a TreeView, each level
having different node types:

- The 1st level will contain "folders". They should be able to contain
entries (leaf nodes), but they may not be moved/drag'n'dropped anywhere.

- The 2nd level will contain "leafs". They may not have any child (other
leafs). They must be always contained inside a 1st level node, but can
be moved/drag'n'dropped to any 1st level node.

The problem is I don't know how to avoid drag'n'dropping leafs to the
top level. This would not be a problem if the tree maintained it's
consistency, but it does not. For example, if I move a leaf at the 1st
level, the leaf gets copied instead of moved (even if I have defined
drag'n'drops as MOVES!).

I'm attaching a functional PoC to let you test what I'm trying to
explain. Just run it, drag'n'drop a leaf node to put it in the 1st level
(the same level as "folders") and see that it creates a copy. Even when
you drag'n'drop this last copy inside a 1st level node, it will create
another copy.

PS. JFYI, this won't be a filesystem mapping, but a hierarchy of
categories (root nodes) containing rss/feeds (leaf nodes). Hope I have
been clear enough.

Hope hearing from you soon,
-- 
jors <worbynet _ at _ gmail.com>

-------------- next part --------------
A non-text attachment was scrubbed...
Name: naufrago3_simple.py
Type: text/x-python
Size: 6172 bytes
Desc: not available
Url : http://www.daa.com.au/pipermail/pygtk/attachments/20100516/05a7103b/attachment.py 


More information about the pygtk mailing list