WidgetManager (widgetmanager)

class orangecanvas.scheme.widgetmanager.WidgetManager(*args, **kwargs)[source]

Bases: PyQt5.QtCore.QObject

WidgetManager class is responsible for creation, tracking and deletion of UI elements constituting an interactive workflow.

It does so by reacting to changes in the underlying workflow model, creating and destroying the components when needed.

This is an abstract class, subclassed MUST reimplement at least create_widget_for_node() and delete_widget_for_node().

The widgets created with create_widget_for_node() will automatically receive dispatched events:

  • WorkflowEvent.InputLinkAdded - when a new input link is added to the workflow.
  • LinkEvent.InputLinkRemoved - when a input link is removed.
  • LinkEvent.OutputLinkAdded - when a new output link is added to the workflow.
  • LinkEvent.InputLinkRemoved - when a output link is removed.
  • LinkEvent.InputLinkStateChanged - when the input link’s runtime state changes.
  • LinkEvent.OutputLinkStateChanged - when the output link’s runtime state changes.
  • WorkflowEnvEvent.WorkflowEnvironmentChanged - when the workflow environment changes.

See also

Scheme.add_link(), Scheme.remove_link(), Scheme.runtime_env()

widget_for_node_added(SchemeNode, QWidget)

A new QWidget was created and added by the manager. Signal emitted when a QWidget was created and added by the manager.

widget_for_node_removed(SchemeNode, QWidget)

A QWidget was removed, hidden and will be deleted when appropriate. Signal emitted when a QWidget was removed and will be deleted.

class CreationPolicy[source]

Bases: enum.Enum

Widget Creation Policy.

Normal = 'Normal'

Widgets are scheduled to be created from the event loop, or when first accessed with widget_for_node

Immediate = 'Immediate'

Widgets are created immediately when a node is added to the workflow model.

OnDemand = 'OnDemand'

Widgets are created only when first accessed with widget_for_node (e.g. when activated in the view).

set_workflow(workflow)[source]

Set the workflow.

set_scheme(workflow)

Set the workflow.

set_creation_policy(policy)[source]

Set the widget creation policy.

creation_policy()[source]

Return the current widget creation policy.

create_widget_for_node(node)[source]

Create and initialize a widget for node.

This is an abstract method. Subclasses must reimplemented it.

delete_widget_for_node(node, widget)[source]

Remove and delete widget for node.

This is an abstract method. Subclasses must reimplemented it.

node_for_widget(widget)[source]

Return the node for widget.

widget_for_node(node)[source]

Return the widget for node.

ensure_created(node)[source]

Ensure that the widget for node is created.

activate_widget_for_node(node, widget)[source]

Activate the widget for node (show and raise above other)

raise_widgets_to_front()[source]

Raise all current visible widgets to the front.

The widgets will be stacked by activation order.

set_float_widgets_on_top(float_on_top)[source]

Set Float Widgets on Top flag on all widgets.

save_window_state()[source]

Save current open window arrangement.

restore_window_state(state)[source]

Restore the window state.

save_widget_geometry(node, widget)[source]

Save and return the current geometry and state for node.

restore_widget_geometry(node, widget, state)[source]

Restore the widget geometry and state for node.

Return True if the geometry was restored successfully.

The default implementation does nothing.

eventFilter(self, QObject, QEvent) → bool[source]
actions_for_context_menu(node)[source]

Return a list of extra actions that can be inserted into context menu in the workflow editor.

Subclasses can reimplement this method to extend the default context menu.

Parameters:node (SchemeNode) – The node for which the context menu is requested.
Returns:actions – Actions that are appended to the default menu.
Return type:List[QAction]