MouseMode

class glue.viewers.common.qt.mouse_mode.MouseMode(viewer, press_callback=None, move_callback=None, release_callback=None, key_callback=None)[source]

Bases: object

The base class for all MouseModes.

MouseModes have the following attributes:

  • press_callback : Callback method that will be called whenever a MouseMode processes a mouse press event

  • move_callback : Same as above, for move events

  • release_callback : Same as above, for release events

  • key_callback : Same as above, for release events

The _callback hooks are called with the MouseMode as its only argument

Methods Summary

activate(self)

Activates all MPL event handlers associated with this mouse mode.

deactivate(self)

Deactivates all MPL event handlers associated with this mouse mode.

key(self, event)

Handles key press events.

move(self, event)

Handles mouse move events.

press(self, event)

Handles mouse presses.

release(self, event)

Handles mouse release events.

Methods Documentation

activate(self)[source]

Activates all MPL event handlers associated with this mouse mode.

deactivate(self)[source]

Deactivates all MPL event handlers associated with this mouse mode.

key(self, event)[source]

Handles key press events.

Calls key_callback method.

Parameters
eventKeyEvent

The event that was triggered

move(self, event)[source]

Handles mouse move events.

Logs mouse position and calls move_callback method.

Parameters
eventMouseEvent

The event that was triggered

press(self, event)[source]

Handles mouse presses.

Logs mouse position and calls press_callback method.

Parameters
eventMouseEvent

The event that was triggered

release(self, event)[source]

Handles mouse release events.

Logs mouse position and calls release_callback method.

Parameters
eventMouseEvent

The event that was triggered