From a9a1fc38dff4d19fbe721c6902dc1419e51dd634 Mon Sep 17 00:00:00 2001 From: Michael Mintz Date: Wed, 1 Jul 2020 14:13:13 -0400 Subject: [PATCH] Fix Presenter "show_notes" and move arg to different area --- examples/presenter/ReadMe.md | 20 +++++++++----------- help_docs/method_summary.md | 6 +++--- seleniumbase/fixtures/base_case.py | 26 ++++++++++++++++++-------- 3 files changed, 30 insertions(+), 22 deletions(-) diff --git a/examples/presenter/ReadMe.md b/examples/presenter/ReadMe.md index 62b93ad1..66194745 100755 --- a/examples/presenter/ReadMe.md +++ b/examples/presenter/ReadMe.md @@ -30,8 +30,6 @@ self.create_presentation(name=None, theme="serif", show_notes=True) Valid themes: "serif" (default), "sky", "white", "black", "simple", "league", "moon", "night", "beige", "blood", and "solarized". - show_notes - When set to True, the Notes feature becomes enabled, - which allows presenters to see notes next to slides. """ ``` @@ -47,16 +45,14 @@ self.add_slide(content=None, image=None, code=None, iframe=None, content2=None, notes=None, name=None) """ Allows the user to add slides to a presentation. @Params - content - The HTML content to display on the presentation slide. - image - Attach an image (from a URL link) to the slide. - code - Attach code of any programming language to the slide. - Language-detection will be used to add syntax formatting. - iframe - Attach an iFrame (from a URL link) to the slide. - content2 - HTML content to display after adding an image or code. - notes - Additional notes to include with the slide. - ONLY SEEN if show_notes is set for the presentation. name - If creating multiple presentations at the same time, - use this to select the presentation to add slides to. + use this to select the one you wish to add slides to. + filename - The name of the HTML file that you wish to + save the presentation to. (filename must end in ".html") + show_notes - When set to True, the Notes feature becomes enabled, + which allows presenters to see notes next to slides. + interval - The delay time between autoplaying slides. (in seconds) + If set to 0 (default), autoplay is disabled. """ ``` @@ -71,6 +67,8 @@ self.begin_presentation(filename="my_presentation.html", interval=0) use this to select the one you wish to add slides to. filename - The name of the HTML file that you wish to save the presentation to. (filename must end in ".html") + show_notes - When set to True, the Notes feature becomes enabled, + which allows presenters to see notes next to slides. interval - The delay time between autoplaying slides. (in seconds) If set to 0 (default), autoplay is disabled. """ diff --git a/help_docs/method_summary.md b/help_docs/method_summary.md index 0bedfe99..1b2f52d5 100755 --- a/help_docs/method_summary.md +++ b/help_docs/method_summary.md @@ -356,14 +356,14 @@ self.add_meta_tag(http_equiv=None, content=None) ############ -self.create_presentation(name=None, theme="default", show_notes=True) +self.create_presentation(name=None, theme="default") self.add_slide(content=None, image=None, code=None, iframe=None, content2=None, notes=None, name=None) -self.save_presentation(name=None, filename=None, interval=0) +self.save_presentation(name=None, filename=None, show_notes=True, interval=0) -self.begin_presentation(name=None, filename=None, interval=0) +self.begin_presentation(name=None, filename=None, show_notes=True, interval=0) ############ diff --git a/seleniumbase/fixtures/base_case.py b/seleniumbase/fixtures/base_case.py index 55e590d8..459a4a5e 100755 --- a/seleniumbase/fixtures/base_case.py +++ b/seleniumbase/fixtures/base_case.py @@ -3151,7 +3151,7 @@ class BaseCase(unittest.TestCase): ############ - def create_presentation(self, name=None, theme="default", show_notes=True): + def create_presentation(self, name=None, theme="default"): """ Creates a Reveal-JS presentation that you can add slides to. @Params name - If creating multiple presentations at the same time, @@ -3160,8 +3160,6 @@ class BaseCase(unittest.TestCase): Valid themes: "serif" (default), "sky", "white", "black", "simple", "league", "moon", "night", "beige", "blood", and "solarized". - show_notes - When set to True, the Notes feature becomes enabled, - which allows presenters to see notes next to slides. """ if not name: name = "default" @@ -3242,7 +3240,7 @@ class BaseCase(unittest.TestCase): name = "default" if name not in self._presentation_slides: # Create a presentation if it doesn't already exist - self.create_presentation(name=name, show_notes=True) + self.create_presentation(name=name) if not content: content = "" if not content2: @@ -3273,13 +3271,16 @@ class BaseCase(unittest.TestCase): self._presentation_slides[name].append(html) - def save_presentation(self, name=None, filename=None, interval=0): + def save_presentation( + self, name=None, filename=None, show_notes=True, interval=0): """ Saves a Reveal-JS Presentation to a file for later use. @Params name - If creating multiple presentations at the same time, use this to select the one you wish to add slides to. filename - The name of the HTML file that you wish to save the presentation to. (filename must end in ".html") + show_notes - When set to True, the Notes feature becomes enabled, + which allows presenters to see notes next to slides. interval - The delay time between autoplaying slides. (in seconds) If set to 0 (default), autoplay is disabled. """ @@ -3300,6 +3301,10 @@ class BaseCase(unittest.TestCase): raise Exception('The "interval" cannot be a negative number!') interval_ms = float(interval) * 1000.0 + show_notes_str = "false" + if show_notes: + show_notes_str = "true" + the_html = "" for slide in self._presentation_slides[name]: the_html += slide @@ -3310,13 +3315,14 @@ class BaseCase(unittest.TestCase): '\n' '\n' '\n' '\n' '\n' '' % (constants.Reveal.MIN_JS, constants.PrettifyJS.RUN_PRETTIFY_JS, + show_notes_str, interval_ms)) saved_presentations_folder = constants.Presentations.SAVED_FOLDER @@ -3334,13 +3340,16 @@ class BaseCase(unittest.TestCase): print('\n>>> [%s] was saved!\n' % file_path) return file_path - def begin_presentation(self, name=None, filename=None, interval=0): + def begin_presentation( + self, name=None, filename=None, show_notes=True, interval=0): """ Begin a Reveal-JS Presentation in the web browser. @Params name - If creating multiple presentations at the same time, use this to select the one you wish to add slides to. filename - The name of the HTML file that you wish to save the presentation to. (filename must end in ".html") + show_notes - When set to True, the Notes feature becomes enabled, + which allows presenters to see notes next to slides. interval - The delay time between autoplaying slides. (in seconds) If set to 0 (default), autoplay is disabled. """ @@ -3366,7 +3375,8 @@ class BaseCase(unittest.TestCase): '

\n\n') self._presentation_slides[name].append(end_slide) file_path = self.save_presentation( - name=name, filename=filename, interval=interval) + name=name, filename=filename, + show_notes=show_notes, interval=interval) self._presentation_slides[name].pop() self.open_html_file(file_path)