def demo_sequence(scene: CodeScene): title = PangoText( """ You can use Code Video Generator to also illustrate high-level concepts through sequence diagrams, or if you want more control, your own block diagrams: """, font="Helvetica", line_spacing=0.5, ).scale(0.7) scene.play(ShowCreation(title, run_time=4, rate_func=linear)) scene.wait(3) scene.clear() scene.add_background(f"{example_dir}/resources/blackboard.jpg") diagram = SequenceDiagram() browser, web, app = diagram.add_objects("Browser", "Web", "App") with browser: with web.text("Make a request"): web.to_target("Do a quick thing", app) with app.text("Retrieve a json object"): app.to_self("Calls itself") app.note("Do lots and lots and lots of thinking") app.ret("Value from db") web.ret("HTML response") diagram.animate(scene) scene.wait(3) scene.play(FadeOut(diagram)) scene.clear()
def construct(self): example_dir = dirname(__file__) self.add_background(f"{example_dir}/resources/blackboard.jpg") diagram = SequenceDiagram() browser, web, app = diagram.add_objects("Browser", "Web", "App") with browser: with web.text("Make a request"): with app.text("Retrieve a json object"): app.note("Do some thinking") app.note("Do lots and lots and lots of thinking") app.ret("Value from db") web.ret("HTML response") diagram.animate(self) self.wait(5)
def demo_sequence(scene: CodeScene): title = Text( """ You can use Code Video Generator to also illustrate high-level concepts through sequence diagrams, or if you want more control, your own block diagrams: """, font=DEFAULT_FONT, line_spacing=0.5, ).scale(0.7) scene.play(Create(title, run_time=4, rate_func=linear)) scene.wait(3) scene.clear() scene.add_background(f"{example_dir}/resources/blackboard.jpg") title = Text("examples/sequence-diagrams.py", font=DEFAULT_FONT) title.to_edge(UP) scene.add(title) diagram = AutoScaled(SequenceDiagram()) browser, web, app = diagram.add_objects("Browser", "Web", "App") browser.to(web, "Make a request") web.to(app, "Request with no response") web.to(app, "Retrieve a json object") app.to(app, "Calls itself") app.note("Do lots and lots and lots of thinking") app.to(web, "Value from db") web.to(browser, "HTML response") diagram.next_to(title, DOWN) scene.play(Create(diagram)) for interaction in diagram.get_interactions(): scene.play(Create(interaction)) scene.wait(3) scene.play(FadeOut(diagram), *[FadeOut(item) for item in diagram.interactions]) scene.clear()
def construct(self): example_dir = dirname(__file__) self.add_background(f"{example_dir}/resources/blackboard.jpg") diagram = AutoScaled(SequenceDiagram()) browser, web, app = diagram.add_objects("Browser", "Web", "App") browser.to(web, "Make a request") web.to(app, "Do a quick thing") web.to(app, "Retrieve a json object") app.to(app, "Call itself") app.note("Do lots and lots and lots of thinking") app.to(web, "Value from db") web.to(browser, "HTML response") title = Text("Sequence Diagram", font=DEFAULT_FONT, size=0.8) title.to_edge(UP) self.add(title) diagram.next_to(title, DOWN) self.play(ShowCreation(diagram)) for interaction in diagram.get_interactions(): self.play(ShowCreation(interaction)) self.wait(5)
def construct(self): diagram: SequenceDiagram = AutoScaled(SequenceDiagram()) test, browser, database = diagram.add_objects("Test", "Browser", "Database") self.wait() test.to(database, "Set up initial data") test.to(browser, "Starts a Chrome instance,\noften headless") test.to(browser, "Issues commands") browser.to(test, "Returns element data") test.to(database, "Run SQL queries") test.to(test, "Asserts based on the data") test.to(test, "Another go") diagram.to_edge(UR) self.play(ShowCreation(diagram)) for interaction in diagram.get_interactions(): self.play(ShowCreation(interaction)) self.wait() self.play_movie( "/home/mrdon/Videos/browser-tests/02-test-notifications.mkv") self.clear() notif_code: PartialCode = AutoScaled( PartialCode( path= "/home/mrdon/dev/sleuth/sleuth/apps/account/tests/selenium/test_notifications.py", start_line=29, end_line=43)) self.play(ShowCreation(notif_code)) self.wait() self.play(HighlightLine(notif_code, 30)) self.wait() self.play(HighlightLines(notif_code, 31)) self.wait() self.play_movie("/home/mrdon/Videos/browser-tests/02-login.mkv") self.clear() login_code: PartialCode = AutoScaled( PartialCode( path= "/home/mrdon/dev/sleuth/sleuth/apps/account/tests/selenium/login_page.py", start_line=18, end_line=27)) self.play(ShowCreation(login_code)) self.wait() self.play(HighlightLines(login_code, start=19, end=27)) self.wait() self.play_movie( "/home/mrdon/Videos/browser-tests/02-login-to-test-notifications.mkv" ) self.clear() notif_code: PartialCode = AutoScaled( PartialCode( path= "/home/mrdon/dev/sleuth/sleuth/apps/account/tests/selenium/test_notifications.py", start_line=29, end_line=43)) self.add(notif_code) self.highlight_line(notif_code, 32) self.wait() self.highlight_lines(notif_code, 36, 38) self.wait() self.highlight_line(notif_code, 40) self.wait() # add voiceover bits self.clear() ui_code: PartialCode = AutoScaled( PartialCode( path= "/home/mrdon/dev/sleuth/sleuth/apps/account/tests/selenium/login_page.py", start_line=74, end_line=81)) self.play(ShowCreation(ui_code)) self.wait()