Impliment self replication/copy
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import re
|
||||
from typing import Any, Optional, cast, overload
|
||||
from typing import Any, Optional, Self, cast, overload
|
||||
import re
|
||||
from PyQt6.QtCore import QMargins, QPoint, QRect, QSize, QUrl, Qt, pyqtSignal
|
||||
from PyQt6.QtGui import QColor, QFont, QFontMetrics, QMouseEvent, QPaintEvent, QPainter, QResizeEvent, QTextOption, QTransform, QBrush
|
||||
@@ -9,14 +9,20 @@ class Fragment:
|
||||
"""A fragment of text to be displayed"""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
text: str,
|
||||
font: QFont,
|
||||
audio: str = "",
|
||||
color: Optional[QColor] = None,
|
||||
asis: bool = False,
|
||||
self,
|
||||
which: str|Self,
|
||||
font: QFont|None = None,
|
||||
audio: str = "",
|
||||
color: Optional[QColor] = None,
|
||||
asis: bool = False,
|
||||
) -> None:
|
||||
self._text = text
|
||||
if isinstance(which, Fragment):
|
||||
for k,v in which.__dict__.items():
|
||||
self.__dict__[k] = v
|
||||
return
|
||||
self._text:str = which
|
||||
if font is None:
|
||||
raise TypeError("Missing required parameter 'font'")
|
||||
self._font = font
|
||||
self._audio: QUrl = QUrl(audio)
|
||||
self._align = QTextOption(
|
||||
|
||||
Reference in New Issue
Block a user