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

Function generate_panel_code

PosterAgent/gen_pptx_code.py:28–65  ·  view source on GitHub ↗
(panel_dict, utils_functions, slide_object_name, visible=False, theme=None)

Source from the content-addressed store, hash-verified

26 return code
27
28def generate_panel_code(panel_dict, utils_functions, slide_object_name, visible=False, theme=None):
29 code = utils_functions
30 raw_name = panel_dict["panel_name"]
31 var_name = 'var_' + sanitize_for_var(raw_name)
32
33 code += fr'''
34# Panel: {raw_name}
35{var_name} = add_textbox(
36 {slide_object_name},
37 '{var_name}',
38 {panel_dict['x']},
39 {panel_dict['y']},
40 {panel_dict['width']},
41 {panel_dict['height']},
42 text="",
43 word_wrap=True,
44 font_size=40,
45 bold=False,
46 italic=False,
47 alignment="left",
48 fill_color=None,
49 font_name="Arial"
50)
51'''
52
53 if visible:
54 if theme is None:
55 code += fr'''
56# Make border visible
57style_shape_border({var_name}, color=(0, 0, 0), thickness=5, line_style="solid")
58'''
59 else:
60 code += fr'''
61# Make border visible
62style_shape_border({var_name}, color={theme['color']}, thickness={theme['thickness']}, line_style="{theme['line_style']}")
63'''
64
65 return code
66
67def generate_textbox_code(
68 text_dict,

Callers 1

generate_poster_codeFunction · 0.70

Calls 1

sanitize_for_varFunction · 0.70

Tested by

no test coverage detected