PolyMode

class glue.viewers.common.qt.toolbar_mode.PolyMode(viewer, **kwargs)[source]

Bases: glue.viewers.common.qt.toolbar_mode.ClickRoiMode

Defines a Polygonal ROI, accessible via the roi() method

Attributes Summary

action_text

disable_on_finalize

enabled

A property that callback functions can be added to.

icon

persistent

shortcut

status_tip

tool_id

tool_tip

Methods Summary

activate(self)

Activates all MPL event handlers associated with this mouse mode.

clear(self)

close(self, \*args)

deactivate(self)

Deactivates all MPL event handlers associated with this mouse mode.

key(self, event)

Handles key press events.

menu_actions(self)

List of QtWidgets.QActions to be attached to this tool as a context menu.

move(self, event)

Handles mouse move events.

press(self, event)

Handles mouse presses.

release(self, event)

Handles mouse release events.

roi(self)

The ROI defined by this mouse mode

Attributes Documentation

action_text = 'Polygonal ROI'
disable_on_finalize = True
enabled

A property that callback functions can be added to.

When a callback property changes value, each callback function is called with information about the state change. Otherwise, callback properties behave just like normal instance variables.

CallbackProperties must be defined at the class level. Use the helper function add_callback() to attach a callback to a specific instance of a class with CallbackProperties

Parameters
default

The initial value for the property

docstringstr

The docstring for the property

getter, setterfunc

Custom getter and setter functions (advanced)

icon = 'glue_lasso'
persistent = False
shortcut = 'G'
status_tip = 'CLICK and DRAG (or CLICK multiple times) to define selection, ENTER to finalize, ESC to cancel, CTRL-CLICK and DRAG to move selection'
tool_id = 'select:polygon'
tool_tip = 'Lasso a region of interest\n ENTER accepts the path\n ESCAPE clears the path'

Methods Documentation

activate(self)

Activates all MPL event handlers associated with this mouse mode.

clear(self)
close(self, *args)
deactivate(self)

Deactivates all MPL event handlers associated with this mouse mode.

key(self, event)

Handles key press events.

Calls key_callback method.

Parameters
eventKeyEvent

The event that was triggered

menu_actions(self)

List of QtWidgets.QActions to be attached to this tool as a context menu.

move(self, event)

Handles mouse move events.

Logs mouse position and calls move_callback method.

Parameters
eventMouseEvent

The event that was triggered

press(self, event)

Handles mouse presses.

Logs mouse position and calls press_callback method.

Parameters
eventMouseEvent

The event that was triggered

release(self, event)

Handles mouse release events.

Logs mouse position and calls release_callback method.

Parameters
eventMouseEvent

The event that was triggered

roi(self)

The ROI defined by this mouse mode

Returns
roiRoi