Skip to content

Commit 1c9405d

Browse files
authored
Merge pull request #866 from plotly/pres-fixes
Presentation setup.py fix
2 parents 02466a6 + b861a40 commit 1c9405d

File tree

5 files changed

+14
-11
lines changed

5 files changed

+14
-11
lines changed

CHANGELOG.md

+5-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,11 @@
22
All notable changes to this project will be documented in this file.
33
This project adheres to [Semantic Versioning](http://semver.org/).
44

5-
## [2.2.0] - 2017-10-20
5+
## [2.2.1] - 2017-10-26
6+
### Fixed
7+
- presentation objects now added to setup.py
8+
9+
## [2.2.0] - 2017-10-26
610
### Added
711
- NEW Presentations API for Python! Run `help(plotly.presentation_objs.Presentations)` for help or check out the new [documentation](https://plot.ly/python/presentations-api/)
812

plotly/presentation_objs/presentation_objs.py

+6-7
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@
4848
}
4949

5050

51-
5251
def list_of_options(iterable, conj='and', period=True):
5352
"""
5453
Returns an English listing of objects seperated by commas ','
@@ -886,16 +885,16 @@ class Presentation(dict):
886885
:param (str) style: the theme that the presentation will take on. The
887886
themes that are available now are 'martik' and 'moods'.
888887
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
890889
will not have heights and widths that will not exceed the parent
891890
container they belong to. In other words, images will keep their
892891
original aspect ratios.
893-
Default = False.
892+
Default = True.
894893
895894
For examples see the documentation:\n
896895
https://plot.ly/python/presentations-api/
897896
"""
898-
def __init__(self, markdown_string=None, style='moods', imgStretch=False):
897+
def __init__(self, markdown_string=None, style='moods', imgStretch=True):
899898
self['presentation'] = {
900899
'slides': [],
901900
'slidePreviews': [None for _ in range(496)],
@@ -1090,9 +1089,9 @@ def _markdown_to_presentation(self, markdown_string, style, imgStretch):
10901089
height=specs[2], width=specs[3],
10911090
slide=slide_num)
10921091

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']):
10961095
if child['type'] in ['Image', 'Plotly']:
10971096
deep_child = child['props']['style']
10981097
width = deep_child['width']

plotly/tests/test_core/test_spectacle_presentation/test_spectacle_presentation.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,11 @@ def test_invalid_code_language(self):
5151
markdown_string, style='moods'
5252
)
5353

54-
5554
def test_expected_pres(self):
5655
markdown_string = "# title\n---\ntransition: zoom, fade, fade\n# Colors\nColors are everywhere around us.\nPlotly(https://plot.ly/~AdamKulidjian/3564/)\nImage(https://raw.githubusercontent.com/jackparmer/gradient-backgrounds/master/moods1.png)\n```python\nx=1\n```\n---\nPlotly(https://plot.ly/~AdamKulidjian/3564/)\nPlotly(https://plot.ly/~AdamKulidjian/3564/)\nPlotly(https://plot.ly/~AdamKulidjian/3564/)\nPlotly(https://plot.ly/~AdamKulidjian/3564/)\nPlotly(https://plot.ly/~AdamKulidjian/3564/)\nPlotly(https://plot.ly/~AdamKulidjian/3564/)\nPlotly(https://plot.ly/~AdamKulidjian/3564/)\n---\n"
5756

5857
my_pres = pres.Presentation(
59-
markdown_string, style='moods', imgStretch=False
58+
markdown_string, style='moods', imgStretch=True
6059
)
6160

6261
exp_pres = {'presentation': {'paragraphStyles': {'Body': {'color': '#000016',

plotly/version.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = '2.2.0'
1+
__version__ = '2.2.1'

setup.py

+1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ def readme():
3535
'plotly/api/v1',
3636
'plotly/api/v2',
3737
'plotly/dashboard_objs',
38+
'plotly/presentation_objs',
3839
'plotly/plotly',
3940
'plotly/plotly/chunked_requests',
4041
'plotly/figure_factory',

0 commit comments

Comments
 (0)