Hi all,
I am trying to implement some DnD from a treectrl to a
flatnotebook. Everything works fine, except the implementation of
D inside a DropTarget class.
Basically, if the dragged tree item has no associated data (empty
dictionary), I would like to have the same "barred" icon which
provides a visual feedback to the user (the dop can't be performed
because there is no data).
This is what I do:
class DropTarget(wx.DropTarget):
def __init__(self, parent):
""" Default class constructor. """
wx.DropTargetinit__(self)
self._parent = parent
self._dataobject =
wx.CustomD(wx.CustomDataFormat("SymphonyPlot"))
self.SetD(self._dataobject)
def D(self, x, y, dragres):
if not self.GetData():
return wx.DragNone
draginfo = self._dataobject.GetData()
drginfo = cPickle.loads(draginfo)
if not drginfo.GetPlotData():
return wx.DragNone
return dragres
def Data(self, x, y, dragres):
""" Handles the Data() method to call the real DnD routine. """
if not self.GetData():
return wx.DragNone
draginfo = self._dataobject.GetData()
drginfo = cPickle.loads(draginfo)
if not drginfo.GetPlotData():
return wx.DragNone
return DropTarget(x, y, drginfo.GetPlotData())
Well, I am surely doing something stupid here, but as soon as
D is called, Python crashes with the usual Windows error
message box. The offending line in D is:
if not self.GetData():
return wx.DragNone
Does anyone know what I may be doing wrong?
Thank you for every hint.
Andrea.
"Imagination Is The Weapon In The War Against Reality."
To unsubscribe, e-mail: wxPython-users-unsubscribe (AT) lists (DOT) wxwidgets.org
For additional commands, e-mail: wxPython-users-help (AT) lists (DOT) wxwidgets.org