Loading ui/textitem.py +7 −12 Original line number Diff line number Diff line Loading @@ -56,7 +56,6 @@ class TextBlkItem(QGraphicsTextItem): self.background_pixmap: QPixmap = None self.stroke_color = QColor(0, 0, 0) self.bound_checking = False # not used self.oldPos = QPointF() self.oldRect = QRectF() self.repaint_on_changed = True Loading @@ -69,7 +68,6 @@ class TextBlkItem(QGraphicsTextItem): self.input_method_from = -1 self.input_method_text = '' self.block_all_input = False self.block_moving = False self.layout: Union[VerticalTextDocumentLayout, HorizontalTextDocumentLayout] = None self.document().setDocumentMargin(0) Loading Loading @@ -514,7 +512,6 @@ class TextBlkItem(QGraphicsTextItem): super().paint(painter, option, widget) def startEdit(self, pos: QPointF = None) -> None: self.block_moving = True self.pre_editing = False self.setCacheMode(QGraphicsItem.CacheMode.NoCache) self.setTextInteractionFlags(Qt.TextInteractionFlag.TextEditorInteraction) Loading @@ -525,7 +522,6 @@ class TextBlkItem(QGraphicsTextItem): cursor = self.textCursor() cursor.setPosition(hit) self.setTextCursor(cursor) self.block_moving = False def endEdit(self) -> None: self.end_edit.emit(self.idx) Loading @@ -540,14 +536,13 @@ class TextBlkItem(QGraphicsTextItem): return self.textInteractionFlags() == Qt.TextInteractionFlag.TextEditorInteraction def mouseDoubleClickEvent(self, event: QGraphicsSceneMouseEvent) -> None: super().mouseDoubleClickEvent(event) if not self.isEditing(): self.startEdit(pos=event.pos()) else: super().mouseDoubleClickEvent(event) def mouseMoveEvent(self, event: QGraphicsSceneMouseEvent) -> None: if self.block_moving: return if not self.bound_checking or \ self.textInteractionFlags() == Qt.TextInteractionFlag.TextEditorInteraction: if self.textInteractionFlags() == Qt.TextInteractionFlag.TextEditorInteraction: super().mouseMoveEvent(event) else: b_rect = self.boundingRect() Loading utils/fontformat.py +3 −3 Original line number Diff line number Diff line Loading @@ -16,8 +16,8 @@ class FontFormat(Config): family: str = field(default_factory=lambda: shared.DEFAULT_FONT_FAMILY) # to always apply shared.DEFAULT_FONT_FAMILY size: float = 24 stroke_width: float = 0 frgb: Tuple = (0, 0, 0) srgb: Tuple = (0, 0, 0) frgb: List = field(default_factory=lambda: [0, 0, 0]) srgb: List = field(default_factory=lambda: [0, 0, 0]) bold: bool = False underline: bool = False italic: bool = False Loading @@ -29,7 +29,7 @@ class FontFormat(Config): opacity: float = 1. shadow_radius: float = 0. shadow_strength: float = 1. shadow_color: Tuple = (0, 0, 0) shadow_color: List = field(default_factory=lambda: [0, 0, 0]) shadow_offset: List = field(default_factory=lambda: [0., 0.]) _style_name: str = '' Loading Loading
ui/textitem.py +7 −12 Original line number Diff line number Diff line Loading @@ -56,7 +56,6 @@ class TextBlkItem(QGraphicsTextItem): self.background_pixmap: QPixmap = None self.stroke_color = QColor(0, 0, 0) self.bound_checking = False # not used self.oldPos = QPointF() self.oldRect = QRectF() self.repaint_on_changed = True Loading @@ -69,7 +68,6 @@ class TextBlkItem(QGraphicsTextItem): self.input_method_from = -1 self.input_method_text = '' self.block_all_input = False self.block_moving = False self.layout: Union[VerticalTextDocumentLayout, HorizontalTextDocumentLayout] = None self.document().setDocumentMargin(0) Loading Loading @@ -514,7 +512,6 @@ class TextBlkItem(QGraphicsTextItem): super().paint(painter, option, widget) def startEdit(self, pos: QPointF = None) -> None: self.block_moving = True self.pre_editing = False self.setCacheMode(QGraphicsItem.CacheMode.NoCache) self.setTextInteractionFlags(Qt.TextInteractionFlag.TextEditorInteraction) Loading @@ -525,7 +522,6 @@ class TextBlkItem(QGraphicsTextItem): cursor = self.textCursor() cursor.setPosition(hit) self.setTextCursor(cursor) self.block_moving = False def endEdit(self) -> None: self.end_edit.emit(self.idx) Loading @@ -540,14 +536,13 @@ class TextBlkItem(QGraphicsTextItem): return self.textInteractionFlags() == Qt.TextInteractionFlag.TextEditorInteraction def mouseDoubleClickEvent(self, event: QGraphicsSceneMouseEvent) -> None: super().mouseDoubleClickEvent(event) if not self.isEditing(): self.startEdit(pos=event.pos()) else: super().mouseDoubleClickEvent(event) def mouseMoveEvent(self, event: QGraphicsSceneMouseEvent) -> None: if self.block_moving: return if not self.bound_checking or \ self.textInteractionFlags() == Qt.TextInteractionFlag.TextEditorInteraction: if self.textInteractionFlags() == Qt.TextInteractionFlag.TextEditorInteraction: super().mouseMoveEvent(event) else: b_rect = self.boundingRect() Loading
utils/fontformat.py +3 −3 Original line number Diff line number Diff line Loading @@ -16,8 +16,8 @@ class FontFormat(Config): family: str = field(default_factory=lambda: shared.DEFAULT_FONT_FAMILY) # to always apply shared.DEFAULT_FONT_FAMILY size: float = 24 stroke_width: float = 0 frgb: Tuple = (0, 0, 0) srgb: Tuple = (0, 0, 0) frgb: List = field(default_factory=lambda: [0, 0, 0]) srgb: List = field(default_factory=lambda: [0, 0, 0]) bold: bool = False underline: bool = False italic: bool = False Loading @@ -29,7 +29,7 @@ class FontFormat(Config): opacity: float = 1. shadow_radius: float = 0. shadow_strength: float = 1. shadow_color: Tuple = (0, 0, 0) shadow_color: List = field(default_factory=lambda: [0, 0, 0]) shadow_offset: List = field(default_factory=lambda: [0., 0.]) _style_name: str = '' Loading