4.2. AbstractTool¶
4.2.1. Synopsis¶
4.2.1.2. Virtual functions¶
def
on_activate
()def
on_deactivate
()def
on_mouse_move
(event)def
on_mouse_press
(event)def
on_mouse_release
(event)
4.2.2. Detailed Description¶
Abstract tool class that provides overridable methods to determine custom tools. Every overridable method must be implemented.
-
class
mocha.tools.
AbstractTool
([action=NULL])¶ - Parameters
action (
QAction
) – APySide.QtGui.QAction
instance associated with the tool.
Creates a custom tool instance. action will be added automatically to mocha tool bar and tool menu if it is passed in. If the argument is None, an associated action will be created anyway, but will not be added to mocha tool bar and tool menu and be available from
action()
. Don’t create the instance manually. Mocha backend creates the instance upon project opening and destroys it upon project closing. Please note that you must redefine __init__ method, as mocha passes amocha.project.Project
instance as the single argument.Example:
class MyTool(AbstractTool): def __init__(self, project_instance): ... action = QAction() ... AbstractTool.__init__(self, action) ...
-
AbstractTool.
action
()¶ - Return type
QAction
Returns associated
PySide.QtGui.QAction
instance.
-
AbstractTool.
on_activate
()¶ Implements a handler on the tool activation event.
-
AbstractTool.
on_deactivate
()¶ Implements a handler on the tool activation event.
-
AbstractTool.
on_mouse_move
(event)¶ - Parameters
event (InputEvent) – Input event instance.
Implements a handler on the mouse move event.
-
AbstractTool.
on_mouse_press
(event)¶ - Parameters
event (InputEvent) – Input event instance.
Implements a handler on the mouse press event.
-
AbstractTool.
on_mouse_release
(event)¶ - Parameters
event (InputEvent) – Input event instance.
Implements a handler on the mouse release event.