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

Function generate_poster_code

PosterAgent/gen_pptx_code.py:169–249  ·  view source on GitHub ↗
(
    panel_arrangement_list,
    text_arrangement_list,
    figure_arrangement_list,
    presentation_object_name,
    slide_object_name,
    utils_functions,
    slide_width,
    slide_height,
    img_path,
    save_path,
    visible=False,
    content=None,
    check_overflow=False,
    theme=None,
    tmp_dir='tmp',
)

Source from the content-addressed store, hash-verified

167 return code
168
169def generate_poster_code(
170 panel_arrangement_list,
171 text_arrangement_list,
172 figure_arrangement_list,
173 presentation_object_name,
174 slide_object_name,
175 utils_functions,
176 slide_width,
177 slide_height,
178 img_path,
179 save_path,
180 visible=False,
181 content=None,
182 check_overflow=False,
183 theme=None,
184 tmp_dir='tmp',
185):
186 code = ''
187 code += initialize_poster_code(slide_width, slide_height, slide_object_name, presentation_object_name, utils_functions)
188
189 if theme is None:
190 panel_visible = visible
191 textbox_visible = visible
192 figure_visible = visible
193
194 panel_theme, textbox_theme, figure_theme = None, None, None
195 else:
196 panel_visible = theme['panel_visible']
197 textbox_visible = theme['textbox_visible']
198 figure_visible = theme['figure_visible']
199 panel_theme = theme['panel_theme']
200 textbox_theme = theme['textbox_theme']
201 figure_theme = theme['figure_theme']
202
203 for p in panel_arrangement_list:
204 code += generate_panel_code(p, '', slide_object_name, panel_visible, panel_theme)
205
206 if check_overflow:
207 t = text_arrangement_list[0]
208 # Pass full theme for consistency
209 code += generate_textbox_code(t, '', slide_object_name, textbox_visible, content, theme, tmp_dir, is_title=False)
210 else:
211 all_content = []
212 title_indices = set() # Track which indices are section titles
213 if content is not None:
214 idx = 0
215 for section_content in content:
216 if 'title' in section_content:
217 all_content.append(section_content['title'])
218 title_indices.add(idx) # Mark this index as a title
219 idx += 1
220 if len(section_content) == 2:
221 all_content.append(section_content['textbox1'])
222 idx += 1
223 elif len(section_content) == 3:
224 all_content.append(section_content['textbox1'])
225 all_content.append(section_content['textbox2'])
226 idx += 2

Callers 2

render_textboxFunction · 0.90
new_pipeline.pyFile · 0.90

Calls 6

initialize_poster_codeFunction · 0.70
generate_panel_codeFunction · 0.70
generate_textbox_codeFunction · 0.70
generate_figure_codeFunction · 0.70
save_poster_codeFunction · 0.70
addMethod · 0.45

Tested by

no test coverage detected