diff --git a/examples/presenter/ReadMe.md b/examples/presenter/ReadMe.md index 62b93ad1505..69874d80044 100755 --- a/examples/presenter/ReadMe.md +++ b/examples/presenter/ReadMe.md @@ -21,7 +21,7 @@ pytest my_presentation.py ### Creating a new presentation: ```python -self.create_presentation(name=None, theme="serif", show_notes=True) +self.create_presentation(name=None, theme="serif") """ Creates a Reveal-JS presentation that you can add slides to. @Params name - If creating multiple presentations at the same time, @@ -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. """ ``` @@ -64,13 +62,16 @@ self.add_slide(content=None, image=None, code=None, iframe=None, ### Running a presentation: ```python -self.begin_presentation(filename="my_presentation.html", interval=0) +self.begin_presentation( + filename="my_presentation.html", 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. """ @@ -161,7 +162,7 @@ class MyPresenterClass(BaseCase): 'from seleniumbase import BaseCase\n\n' 'class MyPresenterClass(BaseCase):\n\n' ' def test_presenter(self):\n' - ' self.create_presentation()\n' + ' self.create_presentation(theme="serif")\n' ' self.add_slide("Welcome to Presenter!")\n' ' self.add_slide(\n' ' "Add code to slides:",\n' @@ -170,7 +171,8 @@ class MyPresenterClass(BaseCase): ' "class MyPresenterClass(BaseCase):\\n\\n"\n' ' " def test_presenter(self):\\n"\n' ' " self.create_presentation()\\n"))\n' - ' self.begin_presentation(filename="demo.html")')) + ' self.begin_presentation(\n' + ' filename="demo.html", show_notes=True)')) self.add_slide( '

Include notes with slides:


', code=('self.add_slide("[Your HTML goes here]",\n' @@ -195,7 +197,8 @@ class MyPresenterClass(BaseCase): self.add_slide( '

The End

', image="https://seleniumbase.io/img/sb_logo_10.png") - self.begin_presentation(filename="presenter.html", interval=0) + self.begin_presentation( + filename="presenter.html", show_notes=True, interval=0) ``` #### This example is from [my_presentation.py](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/presenter/my_presentation.py), which you can run from the ``examples/presenter`` folder with the following command: @@ -209,10 +212,10 @@ pytest my_presentation.py If you want to save the presentation you created as an HTML file, use: ```python -self.save_presentation(filename="my_presentation.html") +self.save_presentation(filename="my_presentation.html", show_notes=True) ``` Presentations automatically get saved when calling: ```python -self.begin_presentation() +self.begin_presentation(show_notes=True) ``` diff --git a/examples/presenter/my_presentation.py b/examples/presenter/my_presentation.py index a7ec2d643e6..de737b470f7 100755 --- a/examples/presenter/my_presentation.py +++ b/examples/presenter/my_presentation.py @@ -75,7 +75,7 @@ def test_presenter(self): 'from seleniumbase import BaseCase\n\n' 'class MyPresenterClass(BaseCase):\n\n' ' def test_presenter(self):\n' - ' self.create_presentation()\n' + ' self.create_presentation(theme="serif")\n' ' self.add_slide("Welcome to Presenter!")\n' ' self.add_slide(\n' ' "Add code to slides:",\n' @@ -84,7 +84,8 @@ def test_presenter(self): ' "class MyPresenterClass(BaseCase):\\n\\n"\n' ' " def test_presenter(self):\\n"\n' ' " self.create_presentation()\\n"))\n' - ' self.begin_presentation(filename="demo.html")')) + ' self.begin_presentation(\n' + ' filename="demo.html", show_notes=True)')) self.add_slide( '

Include notes with slides:


', code=('self.add_slide("[Your HTML goes here]",\n' @@ -109,4 +110,5 @@ def test_presenter(self): self.add_slide( '

The End

', image="https://seleniumbase.io/img/sb_logo_10.png") - self.begin_presentation(filename="presenter.html", interval=0) + self.begin_presentation( + filename="presenter.html", show_notes=True, interval=0) diff --git a/help_docs/method_summary.md b/help_docs/method_summary.md index 0bedfe99214..1b2f52d5a37 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/requirements.txt b/requirements.txt index 96b8d92fb76..90c9a261313 100755 --- a/requirements.txt +++ b/requirements.txt @@ -42,7 +42,7 @@ coverage==5.1 pyotp==2.3.0 boto==2.49.0 cffi==1.14.0 -rich==3.0.0;python_version>="3.6" and python_version<"4.0" +rich==3.0.1;python_version>="3.6" and python_version<"4.0" flake8==3.7.9;python_version<"3.5" flake8==3.8.3;python_version>="3.5" pyflakes==2.1.1;python_version<"3.5" diff --git a/seleniumbase/common/obfuscate.py b/seleniumbase/common/obfuscate.py index 438a8eccfa1..f96cf71f765 100755 --- a/seleniumbase/common/obfuscate.py +++ b/seleniumbase/common/obfuscate.py @@ -30,7 +30,7 @@ def main(): print("\nInside a test, use the following to decrypt it:\n") time.sleep(0.2) print(" from seleniumbase import encryption") - print(" encryption.decrypt('%s')" % encrypted_password) + print(' encryption.decrypt("%s")' % encrypted_password) time.sleep(0.2) except KeyboardInterrupt: print("\nExiting...\n") diff --git a/seleniumbase/console_scripts/sb_mkdir.py b/seleniumbase/console_scripts/sb_mkdir.py index 2f753d08b53..88287deb658 100755 --- a/seleniumbase/console_scripts/sb_mkdir.py +++ b/seleniumbase/console_scripts/sb_mkdir.py @@ -58,14 +58,21 @@ def main(): 'Directory name must not include slashes ("/", "\\")!') elif os.path.exists(os.getcwd() + '/' + dir_name): error_msg = ( - 'Directory "%s" already exists in the current path!\n' - '' % dir_name) + 'Directory "%s" already exists in the current path!' % dir_name) if error_msg: error_msg = c5 + error_msg + cr invalid_run_command(error_msg) os.mkdir(dir_name) + data = [] + data.append("seleniumbase") + data.append("") + file_path = "%s/%s" % (dir_name, "requirements.txt") + file = codecs.open(file_path, "w+", "utf-8") + file.writelines("\r\n".join(data)) + file.close() + data = [] data.append("[pytest]") data.append("addopts = --capture=no --ignore conftest.py " diff --git a/seleniumbase/fixtures/base_case.py b/seleniumbase/fixtures/base_case.py index 55e590d8d1b..459a4a5e06b 100755 --- a/seleniumbase/fixtures/base_case.py +++ b/seleniumbase/fixtures/base_case.py @@ -3151,7 +3151,7 @@ def add_meta_tag(self, http_equiv=None, content=None): ############ - 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 @@ def create_presentation(self, name=None, theme="default", 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. """ if not name: name = "default" @@ -3242,7 +3240,7 @@ def add_slide(self, content=None, image=None, code=None, iframe=None, 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 @@ def add_slide(self, content=None, image=None, code=None, iframe=None, 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 @@ def save_presentation(self, name=None, filename=None, interval=0): 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 @@ def save_presentation(self, name=None, filename=None, interval=0): '\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 @@ def save_presentation(self, name=None, filename=None, interval=0): 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 @@ def begin_presentation(self, name=None, filename=None, interval=0): '

\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) diff --git a/setup.py b/setup.py index 1249d6987ca..bc9b2e790d4 100755 --- a/setup.py +++ b/setup.py @@ -54,7 +54,7 @@ setup( name='seleniumbase', - version='1.42.1', + version='1.42.2', description='Fast, Easy, and Reliable Browser Automation & Testing.', long_description=long_description, long_description_content_type='text/markdown', @@ -134,7 +134,7 @@ 'pyotp==2.3.0', 'boto==2.49.0', 'cffi==1.14.0', - 'rich==3.0.0;python_version>="3.6" and python_version<"4.0"', + 'rich==3.0.1;python_version>="3.6" and python_version<"4.0"', 'flake8==3.7.9;python_version<"3.5"', 'flake8==3.8.3;python_version>="3.5"', 'pyflakes==2.1.1;python_version<"3.5"',