Impliment self replication/copy

This commit is contained in:
Christopher T. Johnson
2024-04-14 18:14:04 -04:00
parent d34239dfa4
commit b3ccaa5fc4
2 changed files with 17 additions and 12 deletions

View File

@@ -1,4 +1,3 @@
import copy
from importlib.abc import InspectLoader
from PyQt6.QtGui import QColor, QFont
from trycast import trycast
@@ -601,7 +600,7 @@ def parseText(frag: Fragment) -> list[Fragment]:
results.append(frag)
return results
if start > 0:
newFrag = copy.copy(frag)
newFrag = Fragment(frag)
newFrag.setText(text[:start])
results.append(newFrag)
frag.setText(text[start:])
@@ -623,7 +622,7 @@ def parseText(frag: Fragment) -> list[Fragment]:
end = text.find("}")
token = text[1:end]
frag.setText(text[end + 1 :])
newFrag = copy.copy(frag)
newFrag = Fragment(frag)
oldFont = QFont(frag.font())
if token == "bc":
results.append(Fragment(": ", boldFont, color=baseColor))
@@ -729,7 +728,7 @@ def parseText(frag: Fragment) -> list[Fragment]:
wref = fields[1]
else:
raise NotImplementedError(f"Unknown code: {token} in {org}")
newFrag = copy.copy(frag)
newFrag = Fragment(frag)
newFrag.setText(htext)
newFrag.setWRef(wref)
newFrag.setTarget(target)