Scheme Annotations (annotations)

Scheme Annotations

class orangecanvas.scheme.annotations.BaseSchemeAnnotation[source]

Bases: QObject

Base class for scheme annotations.

geometry_changed

int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Type:

pyqtSignal(*types, name

Type:

str = …, revision

Signal emitted when the geometry of the annotation changes

class orangecanvas.scheme.annotations.SchemeArrowAnnotation(start_pos: Tuple[float, float], end_pos: Tuple[float, float], color: str = 'red', anchor: Any | None = None, parent: QObject | None = None)[source]

Bases: BaseSchemeAnnotation

An arrow annotation in the scheme.

set_line(start_pos: Tuple[float, float], end_pos: Tuple[float, float]) None[source]

Set arrow lines start and end position ((x, y) tuples).

set_geometry(geometry: Tuple[Tuple[float, float], Tuple[float, float]]) None[source]

Set the geometry of the arrow as a start and end position tuples (e.g. set_geometry(((0, 0), (100, 0))).

set_color(color: str) None[source]

Set the fill color for the arrow as a string (#RGB, #RRGGBB, #RRRGGGBBB, #RRRRGGGGBBBB format or one of SVG color keyword names).

class orangecanvas.scheme.annotations.SchemeTextAnnotation(rect: Tuple[float, float, float, float], text: str = '', content_type: str = 'text/plain', font: dict | None = None, anchor: Any | None = None, parent: QObject | None = None)[source]

Bases: BaseSchemeAnnotation

Text annotation in the scheme.

text_changed(str)

int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Type:

pyqtSignal(*types, name

Type:

str = …, revision

Signal emitted when the annotation text changes.

set_rect(rect: Tuple[float, float, float, float]) None[source]

Set the text geometry bounding rectangle ((x, y, width, height) tuple).

set_geometry(rect: Tuple[float, float, float, float]) None[source]

Set the text geometry (same as set_rect)

set_text(text: str) None[source]

Set the annotation text.

Same as set_content(text, “text/plain”)

property content_type: str

Return the annotations’ content type.

Currently this will be ‘text/plain’, ‘text/html’ or ‘text/rst’.

property content: str

The annotation content.

How the content is interpreted/displayed depends on content_type.

set_content(content: str, content_type: str = 'text/plain') None[source]

Set the annotation content.

Parameters:
  • content (str) – The content.

  • content_type (str) – Content type. Currently supported are ‘text/plain’ ‘text/html’ (subset supported by QTextDocument) and text/rst.

set_font(font: dict) None[source]

Set the annotation’s default font as a dictionary of font properties (at the moment only family and size are used).

>>> annotation.set_font({"family": "Helvetica", "size": 16})