Link Item (linkitem) — Orange Canvas Core 0.0.9 documentation

# Orange Canvas Core 0.0.9 documentation

## Link Item (linkitem)

# Link Item (`linkitem`)

## Link Item

class `orangecanvas.canvas.items.linkitem.` `LinkItem`(*args)

  Bases: `PyQt5.QtWidgets.QGraphicsObject`

  A Link item in the canvas that connects two `NodeItem`s in the canvas.

  The link curve connects two Anchor items (see `setSourceItem()` and `setSinkItem()`). 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()`)

  class `State`

    Bases: `enum.IntEnum`

    Flags indicating the runtime state of a link

  `font`()

    Return the font for the channel names text.

  `isDynamic`()

    Is the link dynamic.

  `isDynamicEnabled`()

    Is the link dynamic enabled.

  `setChannelNamesVisible`(visible)

    Set the visibility of the channel name text.

  `setDynamic`(dynamic)

    Mark the link as dynamic (i.e. it responds to `setDynamicEnabled()`).

  `setDynamicEnabled`(enabled)

    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.

  `setEnabled`(enabled)

    Reimplemented from `QGraphicsObject`

    Set link enabled state. When disabled the link is rendered with a dashed line.

  `setFont`(font)

    Set the font for the channel names text item.

  `setRuntimeState`(state)

    Style the link appropriate to the LinkItem.State

    Parameters: | state (LinkItem.State) –

  `setSinkItem`(item, anchor=None)

    Set the sink item (`NodeItem`). Use anchor (`AnchorPoint`) as the curve end point (if `None` a new input anchor will be created using `item.newInputAnchor()`).

    Setting item to `None` and a valid anchor is a valid operation (for instance while mouse dragging one and of the link).

  `setSinkName`(name)

    Set the name of the sink (used in channel name text).

  `setSourceItem`(item, anchor=None)

    Set the source item (`NodeItem`). Use anchor (`AnchorPoint`) as the curve start point (if `None` a new output anchor will be created using `item.newOutputAnchor()`).

    Setting item to `None` and a valid anchor is a valid operation (for instance while mouse dragging one end of the link).

  `setSourceName`(name)

    Set the name of the source (used in channel name text).

  `sinkName`()

    Return the sink name.

  `sourceName`()

    Return the source name.