On Fri, Feb 10, 2017 at 7:18 AM, Edward K. Ream <edream...@gmail.com> wrote:
This post will be pre-writing for a new section in demo.md <https://github.com/leo-editor/leo-editor/blob/master/leo/doc/demo.md>. > My task is now clear. Create demos that* show Leo in action*! This really is a programming task. The example top-level script <https://github.com/leo-editor/leo-editor/blob/master/leo/doc/demo.md#top-level-script> in demo.md <https://github.com/leo-editor/leo-editor/blob/master/leo/doc/demo.md> is no toy. The *setup *method defines the 'delta' ivar, incremented when changing font magnification in Leo's body pane. The *teardown* method restores the original font magnification. The Demo class catches all exceptions, so it can call teardown in *all* cases. The *setup_script* method calls demo.delete_widgets(), which frees individual demo scripts from having to do so. See below for a practical use for *teardown_script*. I want to emphasize something. Demo scripts can use *all *parts of Leo's API to "run" Leo automatically. For example, this is one way to create a new node: p = c.insertHeadline() p.h = 'a headline' p.b = 'some body text' This means that devs don't have to do *anything* "by hand" when creating a demo. *Demos are totally reproducible.* One more cool thing. During development, it's fine to move from one slide to the next using demo-next (bound to Ctrl-9 in the example top-level node). Just before creating the video, we can define this *teardown_script* method: def teardown_script(self): self.wait(self.inter_slide_wait) self.next() Instant automation! Do you see how cool this is? Edward P. S. > ...it might be useful to associate names with slides. That way, we could tell demo.start to start with the slide of a given name. A silly idea. @ignore or @ignore-tree allow devs to skip already "debugged" nodes. EKR -- You received this message because you are subscribed to the Google Groups "leo-editor" group. To unsubscribe from this group and stop receiving emails from it, send an email to leo-editor+unsubscr...@googlegroups.com. To post to this group, send email to leo-editor@googlegroups.com. Visit this group at https://groups.google.com/group/leo-editor. For more options, visit https://groups.google.com/d/optout.