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

Function _parse_alignment

utils/pptx_utils.py:1246–1263  ·  view source on GitHub ↗

Internal helper to convert a string alignment (e.g., "left", "center") to the corresponding PP_ALIGN constant. Default to PP_ALIGN.LEFT if unrecognized or None.

(alignment)

Source from the content-addressed store, hash-verified

1244 return font_size # Assume user provided a Pt object already
1245
1246def _parse_alignment(alignment):
1247 """
1248 Internal helper to convert a string alignment (e.g., "left", "center")
1249 to the corresponding PP_ALIGN constant.
1250 Default to PP_ALIGN.LEFT if unrecognized or None.
1251 """
1252 if not isinstance(alignment, str):
1253 # If user passed None or something else, default to PP_ALIGN.LEFT
1254 return PP_ALIGN.LEFT
1255
1256 alignment = alignment.lower().strip()
1257 alignment_map = {
1258 "left": PP_ALIGN.LEFT,
1259 "center": PP_ALIGN.CENTER,
1260 "right": PP_ALIGN.RIGHT,
1261 "justify": PP_ALIGN.JUSTIFY,
1262 }
1263 return alignment_map.get(alignment, PP_ALIGN.LEFT)
1264
1265def create_poster(width_inch=48, height_inch=36):
1266 """

Callers 4

add_textboxFunction · 0.70
fill_textframeFunction · 0.70
edit_textboxFunction · 0.70
set_text_styleFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected