Scheme Annotations (annotations)

Scheme Annotations

class orangecanvas.scheme.annotations.BaseSchemeAnnotation[source]

Bases: PyQt5.QtCore.QObject

Base class for scheme annotations.

geometry_changed

Signal emitted when the geometry of the annotation changes

class orangecanvas.scheme.annotations.SchemeArrowAnnotation(start_pos, end_pos, color='red', anchor=None, parent=None)[source]

Bases: orangecanvas.scheme.annotations.BaseSchemeAnnotation

An arrow annotation in the scheme.

set_line(start_pos, end_pos)[source]

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

start_pos: Tuple[float, float]

Start position of the arrow (base point).

end_pos: Tuple[float, float]

End position of the arrow (arrow head points toward the end).

set_geometry(geometry)[source]

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

geometry: Tuple[Tuple[float, float], Tuple[float, float]]

Return the start and end positions of the arrow.

set_color(color)[source]

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

color: str

The arrow’s fill color.

class orangecanvas.scheme.annotations.SchemeTextAnnotation(rect, text='', content_type='text/plain', font=None, anchor=None, parent=None)[source]

Bases: orangecanvas.scheme.annotations.BaseSchemeAnnotation

Text annotation in the scheme.

text_changed(str)

Signal emitted when the annotation text changes.

set_rect(rect)[source]

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

rect: Tuple[float, float, float, float]

Text bounding rectangle

set_geometry(rect)[source]

Set the text geometry (same as set_rect)

geometry: Tuple[float, float, float, float]

Text annotation geometry (same as rect)

set_text(text)[source]

Set the annotation text.

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

text: str

Annotation text.

Deprecated since version Use: content instead.

property content_type

Return the annotations’ content type.

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

property content

The annotation content.

How the content is interpreted/displayed depends on content_type.

set_content(content, content_type='text/plain')[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)[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})
font: dict

Annotation’s font property dictionary.