Link Item (linkitem)
Link Item
- class orangecanvas.canvas.items.linkitem.LinkItem(parent: QGraphicsItem | None = None, **kwargs: Any)[source]
Bases:
QGraphicsWidgetA Link item in the canvas that connects two
NodeItems in the canvas.The link curve connects two Anchor items (see
setSourceItem()andsetSinkItem()). Once the anchors are set the curve automatically adjusts its end points whenever the anchors move.An optional source/sink text item can be displayed above the curve’s central point (
setSourceName(),setSinkName())- activated
Signal emitted when the item has been activated (double-click)
- selectedChanged
Signal emitted the the item’s selection state changes.
- Z_VALUE = 0
Z value of the item
- class State(value)
Bases:
IntEnumFlags indicating the runtime state of a link
- NoState = 0
The link has no associated state (e.g. is not associated with any execution contex)
- Empty = 1
A link is empty when it has no value on it.
- Active = 2
A link is active when the source node provides a value on output.
- Pending = 4
A link is pending when it’s sink node has not yet been notified of a change (note that Empty|Pending is a valid state)
- Invalidated = 8
The link’s source node has invalidated the source channel. The execution manager should not propagate this links source value until this flag is cleared.
Added in version 0.1.8.
- NoState = 0
The link has no associated state.
- Empty = 1
Link is empty; the source node does not have any value on output
- Active = 2
Link is active; the source node has a valid value on output
- Pending = 4
The link is pending; the sink node is scheduled for update
- Invalidated = 8
The link’s input is marked as invalidated (not yet available).
- setSourceItem(item: NodeItem | None, signal: OutputSignal | None = None, anchor: AnchorPoint | None = None) None[source]
Set the source item (
NodeItem). Use anchor (AnchorPoint) as the curve start point (ifNonea new output anchor will be created usingitem.newOutputAnchor()).Setting item to
Noneand a valid anchor is a valid operation (for instance while mouse dragging one end of the link).
- setSinkItem(item: NodeItem | None, signal: InputSignal | None = None, anchor: AnchorPoint | None = None) None[source]
Set the sink item (
NodeItem). Use anchor (AnchorPoint) as the curve end point (ifNonea new input anchor will be created usingitem.newInputAnchor()).Setting item to
Noneand a valid anchor is a valid operation (for instance while mouse dragging one and of the link).
- setEnabled(enabled: bool) None[source]
Reimplemented from
QGraphicWidgetSet link enabled state. When disabled the link is rendered with a dashed line.
- setDynamicEnabled(enabled: bool) None[source]
Set the link’s dynamic enabled state.
If the link is dynamic it will be rendered in red/green color respectively depending on the state of the dynamic enabled state.
- setDynamic(dynamic: bool) None[source]
Mark the link as dynamic (i.e. it responds to
setDynamicEnabled()).
- setRuntimeState(state: State) None[source]
Style the link appropriate to the LinkItem.State
- Parameters:
state (LinkItem.State)