def OnLeftDown(self, event):
"""
Function called when mouse left button is pressed
@param event: wx.MouseEvent
"""
# Get first item
item = self.ItemsDict.values()[0]
# Calculate item path bounding box
width, height = self.GetSize()
item_path = item.GetVariable(
self.ParentWindow.GetVariableNameMask())
w, h = self.GetTextExtent(item_path)
# Test if mouse has been pressed in this bounding box. In that case
# start a move drag'n drop of item variable
x, y = event.GetPosition()
item_path_bbox = wx.Rect(20, (height - h) / 2, w, h)
if item_path_bbox.InsideXY(x, y):
self.ShowButtons(False)
data = wx.TextDataObject(str((item.GetVariable(), "debug", "move")))
dragSource = wx.DropSource(self)
dragSource.SetData(data)
dragSource.DoDragDrop()
# In other case handle event normally
else:
event.Skip()
评论列表
文章目录