MCPcopy Create free account
hub / github.com/SLiCAP/SLiCAP_python / FreeTextItem

Class FreeTextItem

SLiCAP/schematic/free_text_item.py:7–29  ·  view source on GitHub ↗

Text annotation on the schematic. Font, size, and colour are read from Preferences (config.TEXT_*). Placement and editing go through TextDialog; there is no inline editing. Double-click is intercepted by the canvas and opens the dialog.

Source from the content-addressed store, hash-verified

5
6
7class FreeTextItem(QGraphicsTextItem):
8 """
9 Text annotation on the schematic.
10
11 Font, size, and colour are read from Preferences (config.TEXT_*).
12 Placement and editing go through TextDialog; there is no inline editing.
13 Double-click is intercepted by the canvas and opens the dialog.
14 """
15
16 def __init__(self, text: str = "Text", pos: QPointF = QPointF(0, 0)):
17 super().__init__(text)
18 self.setPos(pos)
19 self.setFont(TEXT_FONT)
20 self.setDefaultTextColor(TEXT_COLOR)
21 self.setFlag(QGraphicsItem.ItemIsSelectable)
22 self.setFlag(QGraphicsItem.ItemIsMovable)
23 self.setFlag(QGraphicsItem.ItemSendsGeometryChanges)
24 self.setTextInteractionFlags(Qt.NoTextInteraction)
25
26 def itemChange(self, change, value):
27 if change == QGraphicsItem.ItemPositionChange:
28 return snap(value)
29 return super().itemChange(change, value)

Callers 3

_commit_pasteMethod · 0.85
from_dataMethod · 0.85
mousePressEventMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected