Theres a bug in dTreeView when using multiselect. If dragging only one
item, Selection isn't updated to the drop target.
import dabo
dabo.ui.loadUI('wx')
from dabo.ui import dEvents
class TestTree(dabo.ui.dTreeView):
def afterInit(self):
self.MultipleSelect = True
root = self.setRootNode('rootnode')
for gi in range(2):
group = self.appendNode(root,
'group')
for i in range(4):
self.appendNode(group,
'items%d'%i)
self._draggedItems = [] # Used to store the
items dragged
self.bindEvent(dEvents.TreeBeginDrag,
self.onBeginDrag)
self.bindEvent(dEvents.TreeEndDrag,
self.onEndDrag)
def onBeginDrag(self, evt):
self._draggedItems = self.Selection
def onEndDrag(self, evt):
tonode = self.Selection[0]
# If we are dragging only one item, the node we
are dropping
# to always is the node we are dragging!
if len(self._draggedItems) == 1:
print 'The same object?',
self._draggedItems[0] is tonode
else: # It works as expected when moving more
than one item
print 'The same object?', tonode in
self._draggedItems
self._draggedItems = []
class TestForm(dabo.ui.dForm):
def afterInit(self):
tree = TestTree(self)
self.Sizer.append1x(tree)
if __name__ == '__main__':
app = dabo.dApp()
app.setup()
app.MainForm = TestForm(None)
app.start()
--- 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