enable.tools.base_drop_tool module¶
Abstract base class for tools that handle drag and drop
-
class
enable.tools.base_drop_tool.
BaseDropTool
(component=None, **traits)[source]¶ Bases:
enable.base_tool.BaseTool
Abstract base class for tools that handle drag and drop
-
accept_drop
(position, obj)[source]¶ Whether or not to accept the drop
Subclasses should override this method.
- Parameters
position – The coordinates of the drag over event
obj (any) – The object(s) being dragged, if available. Some backends (such as Wx) may not be able to provide the object being dragged, in which case obj will be None.
- Returns
- Return type
True if the drop should be accepted, False otherwise.
-
get_drag_result
(position, obj)[source]¶ The type of drag that will happen
By default, if the dragged objects are available this method calls accept_drop() and returns “none” if the result is False, otherwise it returns the value of default_drag_result.
- Parameters
position – The coordinates of the drag over event
obj (any) – The object(s) being dragged, if available. Some backends (such as Wx) may not be able to provide the object being dragged, in which case obj will be None.
- Returns
Either None, if the drop should be ignored by this tool and not
handled, or one of the keys of DRAG_RESULTS_MAP (“none”, “copy, “move”,)
”link”, “cancel” or “error”.
-