Spaces:
Runtime error
Runtime error
Relax shape display condition and adjust shape width
Browse files221 unmodified lines22222322422522622722813 unmodified lines242243244245246247248249250251221 unmodified linesif not step.startswith(STEP_BY_STEP_PROCESS_MARKER):no_marker_count += 1if no_marker_count / n_steps > 0.2:return Falseshapes = slide.shapes13 unmodified lineselif 4 < n_steps <= 6:# Vertical displayheight = pptx.util.Inches(0.65)width = pptx.util.Inches(slide_width_inch * 2/ 3)top = pptx.util.Inches(slide_height_inch / 4)left = INCHES_1 # slide_width_inch - width.inches)for step in steps:shape = shapes.add_shape(MSO_AUTO_SHAPE_TYPE.PENTAGON, left, top, width, height)shape.text = step.removeprefix(STEP_BY_STEP_PROCESS_MARKER)221 unmodified lines22222322422522622722822923023113 unmodified lines245246247248249250251252253254255256257258259260261262263264265266267268221 unmodified linesif not step.startswith(STEP_BY_STEP_PROCESS_MARKER):no_marker_count += 1slide_header = slide_json['heading'].lower()if (no_marker_count / n_steps > 0.25) and not (('step-by-step' in slide_header) or ('step by step' in slide_header)):return Falseshapes = slide.shapes13 unmodified lineselif 4 < n_steps <= 6:# Vertical displayheight = pptx.util.Inches(0.65)top = pptx.util.Inches(slide_height_inch / 4)left = INCHES_1 # slide_width_inch - width.inches)# Find the close to median width, based on the length of each text, to be set# for the shapeswidth = pptx.util.Inches(slide_width_inch * 2 / 3)lengths = [len(step) for step in steps]font_size_20pt = pptx.util.Pt(20)widths = sorted([min(pptx.util.Inches(font_size_20pt.inches * a_len),width) for a_len in lengths])width = widths[len(widths) // 2]for step in steps:shape = shapes.add_shape(MSO_AUTO_SHAPE_TYPE.PENTAGON, left, top, width, height)shape.text = step.removeprefix(STEP_BY_STEP_PROCESS_MARKER)
helpers/pptx_helper.py+19-2