Spaces:
Runtime error
Runtime error
Prevent the addition of empty slide when the number of steps are too few or many
Browse files91 unmodified lines9293949596979899523 unmodified lines62362462562662762836 unmodified lines66566666766866967067167267367491 unmodified lines# Add content in a loopfor a_slide in parsed_data['slides']:# The loop has a bug:# if any of this functions fail (i.e., returns False), an empty slide would still existis_processing_done = _handle_double_col_layout(presentation=presentation,slide_json=a_slide,523 unmodified lines):return Falsebullet_slide_layout = presentation.slide_layouts[1]slide = presentation.slides.add_slide(bullet_slide_layout)shapes = slide.shapes36 unmodified linesshape.text = step.removeprefix(STEP_BY_STEP_PROCESS_MARKER)top += height + INCHES_0_3left += INCHES_0_5else:# Two steps -- probably not a process# More than 5--6 steps -- would likely cause a visual clutterreturn Falsereturn True91 unmodified lines929394959697523 unmodified lines62162262362462562662762862963063136 unmodified lines66866967067167267391 unmodified lines# Add content in a loopfor a_slide in parsed_data['slides']:is_processing_done = _handle_double_col_layout(presentation=presentation,slide_json=a_slide,523 unmodified lines):return Falseif n_steps < 3 or n_steps > 6:# Two steps -- probably not a process# More than 5--6 steps -- would likely cause a visual clutterreturn Falsebullet_slide_layout = presentation.slide_layouts[1]slide = presentation.slides.add_slide(bullet_slide_layout)shapes = slide.shapes36 unmodified linesshape.text = step.removeprefix(STEP_BY_STEP_PROCESS_MARKER)top += height + INCHES_0_3left += INCHES_0_5return True
helpers/pptx_helper.py+5-6