|
48 | 48 | }
|
49 | 49 |
|
50 | 50 |
|
51 |
| - |
52 | 51 | def list_of_options(iterable, conj='and', period=True):
|
53 | 52 | """
|
54 | 53 | Returns an English listing of objects seperated by commas ','
|
@@ -886,16 +885,16 @@ class Presentation(dict):
|
886 | 885 | :param (str) style: the theme that the presentation will take on. The
|
887 | 886 | themes that are available now are 'martik' and 'moods'.
|
888 | 887 | Default = 'moods'.
|
889 |
| - :param (bool) imgStretch: if set to True, all images in the presentation |
| 888 | + :param (bool) imgStretch: if set to False, all images in the presentation |
890 | 889 | will not have heights and widths that will not exceed the parent
|
891 | 890 | container they belong to. In other words, images will keep their
|
892 | 891 | original aspect ratios.
|
893 |
| - Default = False. |
| 892 | + Default = True. |
894 | 893 |
|
895 | 894 | For examples see the documentation:\n
|
896 | 895 | https://plot.ly/python/presentations-api/
|
897 | 896 | """
|
898 |
| - def __init__(self, markdown_string=None, style='moods', imgStretch=False): |
| 897 | + def __init__(self, markdown_string=None, style='moods', imgStretch=True): |
899 | 898 | self['presentation'] = {
|
900 | 899 | 'slides': [],
|
901 | 900 | 'slidePreviews': [None for _ in range(496)],
|
@@ -1090,18 +1089,20 @@ def _markdown_to_presentation(self, markdown_string, style, imgStretch):
|
1090 | 1089 | height=specs[2], width=specs[3],
|
1091 | 1090 | slide=slide_num)
|
1092 | 1091 |
|
1093 |
| - if imgStretch: |
1094 |
| - for slide in self['presentation']['slides']: |
1095 |
| - for child in slide['children']: |
| 1092 | + if not imgStretch: |
| 1093 | + for s, slide in enumerate(self['presentation']['slides']): |
| 1094 | + for c, child in enumerate(slide['children']): |
1096 | 1095 | if child['type'] in ['Image', 'Plotly']:
|
1097 | 1096 | deep_child = child['props']['style']
|
1098 | 1097 | width = deep_child['width']
|
1099 | 1098 | height = deep_child['height']
|
1100 | 1099 |
|
1101 | 1100 | if width >= height:
|
1102 |
| - deep_child['max-width'] = deep_child.pop('width') |
| 1101 | + self['presentation']['slides'][s]['children'][c]['props']['style']['max-width'] = self['presentation']['slides'][s]['children'][c]['props']['style'].pop('width') |
| 1102 | + #deep_child['max-width'] = deep_child.pop('width') |
1103 | 1103 | else:
|
1104 |
| - deep_child['max-height'] = deep_child.pop('height') |
| 1104 | + self['presentation']['slides'][s]['children'][c]['props']['style']['max-height'] = self['presentation']['slides'][s]['children'][c]['props']['style'].pop('height') |
| 1105 | + #deep_child['max-height'] = deep_child.pop('height') |
1105 | 1106 |
|
1106 | 1107 | def _add_empty_slide(self):
|
1107 | 1108 | self['presentation']['slides'].append(
|
|
0 commit comments