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.
See also
-
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.
See also
-
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.
-
scheme
()¶ Alias
-
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.
-
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.
-
signals_on_link
(link)[source]¶ Return
Signal
instances representing the current values present 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.
-
process_queued
(max_nodes=None)[source]¶ Process queued signals.
Take one node node from the pending input queue and deliver all scheduled signals.
-
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: - node (SchemeNode) –
- signals (List[Signal]) –
-
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]
-
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.
-
class
-
class
orangecanvas.scheme.signalmanager.
Signal
[source]¶ A signal sent via a link between two nodes.
-
link
¶ 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
-