Have addFragment except list of fragments
This commit is contained in:
@@ -374,29 +374,29 @@ class Line:
|
||||
return lineSpacing
|
||||
|
||||
|
||||
def addFragment(
|
||||
self,
|
||||
frag: Fragment,
|
||||
) -> None:
|
||||
def addFragment(self, frags: Fragment|list[Fragment],) -> None:
|
||||
SPEAKER = "\U0001F508"
|
||||
|
||||
if frag.audio().isValid():
|
||||
frag.setText(frag.text() + " " + SPEAKER)
|
||||
if not isinstance(frags, list):
|
||||
frags = [frags, ]
|
||||
for frag in frags:
|
||||
if frag.audio().isValid():
|
||||
frag.setText(frag.text() + " " + SPEAKER)
|
||||
|
||||
text = frag.text()
|
||||
text = re.sub(r"\*", "\u2022", text)
|
||||
text = re.sub(r"\{ldquo\}", "\u201c", text)
|
||||
text = re.sub(r"\{rdquo\}", "\u201d", text)
|
||||
frag.setText(text)
|
||||
if frag.audio().isValid():
|
||||
frag.setPadding(3, 0, 0, 5)
|
||||
frag.setBorder(1)
|
||||
frag.setMargin(0, 0, 0, 0)
|
||||
if Line.parseText:
|
||||
items = Line.parseText(frag)
|
||||
self._fragments += items
|
||||
else:
|
||||
self._fragments.append(frag)
|
||||
text = frag.text()
|
||||
text = re.sub(r"\*", "\u2022", text)
|
||||
text = re.sub(r"\{ldquo\}", "\u201c", text)
|
||||
text = re.sub(r"\{rdquo\}", "\u201d", text)
|
||||
frag.setText(text)
|
||||
if frag.audio().isValid():
|
||||
frag.setPadding(3, 0, 0, 5)
|
||||
frag.setBorder(1)
|
||||
frag.setMargin(0, 0, 0, 0)
|
||||
if Line.parseText:
|
||||
items = Line.parseText(frag)
|
||||
self._fragments += items
|
||||
else:
|
||||
self._fragments.append(frag)
|
||||
return
|
||||
|
||||
def finalizeLine(self, width: int, base: int) -> None:
|
||||
|
||||
Reference in New Issue
Block a user