MCPcopy Create free account
hub / github.com/Paper2Poster/Paper2Poster / __init__

Method __init__

utils/src/presentation.py:109–132  ·  view source on GitHub ↗
(self, shape: BaseShape, level: int)

Source from the content-addressed store, hash-verified

107
108class TextFrame:
109 def __init__(self, shape: BaseShape, level: int):
110 if not shape.has_text_frame:
111 self.is_textframe = False
112 return
113 self.paragraphs = [
114 Paragraph(paragraph, idx)
115 for idx, paragraph in enumerate(shape.text_frame.paragraphs)
116 ]
117 para_offset = 0
118 for para in self.paragraphs:
119 if para.idx == -1:
120 para_offset += 1
121 else:
122 para.idx = para.idx - para_offset
123 if len(self.paragraphs) == 0:
124 self.is_textframe = False
125 return
126 self.level = level
127 self.text = shape.text
128 self.is_textframe = True
129 self.font = merge_dict(
130 object_to_dict(shape.text_frame.font),
131 [para.font for para in self.paragraphs if para.idx != -1],
132 )
133
134 def to_html(self, style_args: StyleArg):
135 """

Callers

nothing calls this directly

Calls 3

merge_dictFunction · 0.90
object_to_dictFunction · 0.90
ParagraphClass · 0.70

Tested by

no test coverage detected