SignalManager (signalmanager)

A SignalManager instance handles the runtime signal propagation between widgets in a scheme workflow.

class orangecanvas.scheme.signalmanager.SignalManager(parent=None, **kwargs)[source]

Bases: PyQt5.QtCore.QObject

SignalManager handles the runtime signal propagation for a Scheme instance.

Note

If a scheme instance is passed as a parent to the constructor it is also set as the workflow model.

class State[source]

Bases: enum.IntEnum

SignalManager state flags.

Running = 0

The manager is running, i.e. it propagates signals

Stopped = 1

The manager is stopped. It does not track node output changes, and does not deliver signals to dependent nodes

Paused = 2

The manager is paused. It still tracks node output changes, but does not deliver new signals to dependent nodes. The pending signals will be delivered once it enters Running state again

Running = 0

The manager is running, i.e. it propagates signals

Stopped = 1

The manager is stopped. It does not track node ouput changes, and does not deliver signals to dependent nodes

Paused = 2

The manager is paused. It still tracks node output changes, but does not deliver new signals to dependent nodes. The pending signals will be delivered once it enters Running state again

class RuntimeState[source]

Bases: enum.IntEnum

SignalManager runtime state.

Waiting = 0

Waiting, idle state. The signal queue is empty

Processing = 1

stateChanged

Emitted when the state of the signal manager changes.

updatesPending

Emitted when signals are added to the queue.

processingStarted

Emitted right before a SchemeNode instance has its inputs updated.

processingFinished

Emitted right after a SchemeNode instance has had its inputs updated.

runtimeStateChanged

Emitted when SignalManager’s runtime state changes.

workflow()[source]

Return the Scheme instance.

scheme()

Alias

set_workflow(workflow)[source]

Set the workflow model.

Parameters:workflow (Scheme) –
has_pending()[source]

Does the manager have any signals to deliver?

start()[source]

Start the update loop.

Note

The updates will not happen until the control reaches the Qt event loop.

stop()[source]

Stop the update loop.

Note

If the SignalManager is currently in process_queues it will still update all current pending signals, but will not re-enter until start() is called again.

pause()[source]

Pause the delivery of signals.

resume()[source]

Resume the delivery of signals.

step()[source]

Deliver signals to a single node (only applicable while the state() is Paused).

state()[source]

Return the current state.

Returns:state
Return type:SignalManager.State
runtime_state()[source]

Return the runtime state. This can be SignalManager.Waiting or SignalManager.Processing.

Return Signal instances representing the current values present on the link.

Return the contents on the link.

send(node, channel, value, id)[source]

Send the value with id on an output channel from node.

Schedule the signal delivery to all dependent nodes

Parameters:
  • node (SchemeNode) – The originating node.
  • channel (OutputSignal) – The nodes output on which the value is sent.
  • value (Any) – The value to send,
  • id (Any) – Signal id.

Purge the link (send None for all ids currently present)

process_queued(max_nodes=None)[source]

Process queued signals.

Take one node node from the pending input queue and deliver all scheduled signals.

process_node(node)[source]

Process pending input signals for node.

compress_signals(signals)[source]

Compress a list of Signal instances to be delivered.

Before the signal values are delivered to the sink node they can be optionally compressed, i.e. values can be merged or dropped depending on the execution semantics.

The input list is in the order that the signals were enqueued.

The base implementation returns the list unmodified.

Parameters:signals (List[Signal]) –
Returns:signals
Return type:List[Signal]
send_to_node(node, signals)[source]

Abstract. Reimplement in subclass.

Send/notify the node instance (or whatever object/instance it is a representation of) that it has new inputs as represented by the signals list).

Parameters:
is_pending(node)[source]

Is node (class:SchemeNode) scheduled for processing (i.e. it has incoming pending signals).

Parameters:node (SchemeNode) –
Returns:pending
Return type:bool
pending_nodes()[source]

Return a list of pending nodes.

The nodes are returned in the order they were enqueued for signal delivery.

Returns:nodes
Return type:List[SchemeNode]
pending_input_signals(node)[source]

Return a list of pending input signals for node.

remove_pending_signals(node)[source]

Remove pending signals for node.

blocking_nodes()[source]

Return a list of nodes in a blocking state.

is_blocking(node)[source]

Is the node in blocking state.

Is it currently in a state where will produce new outputs and therefore no signals should be delivered to dependent nodes until it does so.

The default implementation returns False.

node_update_front()[source]

Return a list of nodes on the update front, i.e. nodes scheduled for an update that have no ancestor which is either itself scheduled for update or is in a blocking state).

Note

The node’s ancestors are only computed over enabled links.

eventFilter(receiver, event)[source]

Reimplemented.

class orangecanvas.scheme.signalmanager.Signal[source]

A signal sent via a link between two nodes.

The link on which the signal is sent

Type:SchemeLink
value

The signal value

Type:Any
id

A signal id used to (optionally) differentiate multiple signals (Multiple is in link.sink_channel.flags)

Type:Any

See also

InputSignal.flags, OutputSignal.flags