Ed Leafe wrote:
> On Mar 28, 2009, at 7:20 PM, Ricardo Aráoz wrote:
>
>   
>> Nevertheless when in dShell I do :
>> ----------------------------------------
>>     
>>>>> dabo.ui.dTreeView(w)
>>>>> dabo.ui.dNode(tv)
>>>>>           
>> ----------------------------------------
>> <dTreeView1 (baseclass dabo.ui.dTreeView, id:-403)>
>> Traceback (most recent call last):
>>  File "<input>", line 1, in <module>
>> AttributeError: 'module' object has no attribute 'dNode'
>> ----------------------------------------
>>     
>
>       dNode is not supposed to be instantiated directly. Nodes cannot exist  
> outside of the context of a tree, so the only way to create them is to  
> call appendNode(); it will return a reference to the node. Take a look  
> at dTreeView.treeFromStructure() for a good code example of how to  
> deal with nodes.
>
>
> -- Ed Leafe
>   

And yet there is no way to reproduce the testing code found in
dabo/dabo/ui/uiwx/dTreeView.py outside of this file. You won't be able
do do :
class TestNode(dNode):
    def afterInit(self):
        self.ForeColor = "darkred"
        self.FontItalic = True
        self.FontSize += 3

and then myTree.NodeClass = TestNode as is done in the test. So you can
not subclass a node nor change or add to it's behaviour.

Besides that, I checked wx.TreeCtrl and it seems to work in the same way
as dTreeView, that is, you can not define a node's behaviour, you must
put all the controlling code inside the tree.
I am not comfortable with this, I think it would be nicer if I could do
"""myTreeView.appendNode(None, 'myNode',
OnHit=myOnHitFunctionOrMethod)""" instead of having to keep as a
property of the tree a dictionary with references to all the nodes (that
have functionality) and it's intended functions/methods.
My impression is that the TreeCtrl/dTreeView has a lot of functionality
directed at itself (i.e. to inspect/modify/drag/etc/etc itself ) and
next to no functionality dedicated to it's intended use. After all I
don't use a tree just to display or modify it, but as a trigger to other
processes.
I think it would not be so hard to add an OnHit property and bind a left
hit event to it in the tree. Would it be ok if I give it a try and
submit a patch?

Thx

Ricardo.



--- StripMime Report -- processed MIME parts ---
multipart/alternative
  text/plain (text body -- kept)
  text/html
---

_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users
Searchable Archives: http://leafe.com/archives/search/dabo-users
This message: http://leafe.com/archives/byMID/[email protected]

Reply via email to