On Wednesday, September 12, 2012 3:12:52 PM UTC-5, Edward K. Ream wrote:
>
> The more I think about it, the more I think Leo needs an automated 
> playback capability. 
>
... 

> The main question is, how easy will it be to create and edit playbacks? 


Rev 5432 provides some answers.  test.leo contains the node, "Prototype of 
screencast script".  It took many hours of happy experimentation to get the 
script to work, but the results are worth all the futzing.  Here is the 
first script::

    s = p.b # This script.
    c = c.new()
    p = c.p
    p.h = ''
    n1,n2 = 0.01,0.2 # Small difference are important.
    head_keys('This is headline text',n1,n2)
    body_keys('This is some body text.\n',0.0,0.0) # n1,n2)
    body_keys('Some more body text.\n',0.0,0.0)
    body_keys(s,0.0,0.0)

The head_keys and body_keys (not shown) simulate typing, with a range of 
typing speed indicated by the n1 and n2 params.  The result is really fun 
to watch.  As you will see, there is a wait method that waits a variable 
number of seconds.  This will be useful in other contexts.

This is the most fun I've had in quite awhile. It's becoming clear that 
being able to generate screencasts from scripts will be an excellent tool 
for those trying to explain Leo.  Imo, creating screencasts from such 
scripts will be *much* simpler than making slideshows.

I've got lots of ideas for improvements to screencasts.  I should have 
something pretty cool to show in a week or so...

Edward

P.S.  The head_keys and body_keys methods cost me a *lot* of work.  It's 
tricky to show the typing immediately without flash.  These are the first 
of several planned helper methods for use in screencasts::

     def head_keys(s,n1=0.04,n2=0.1):
        import leo.core.leoGui as leoGui
        p = c.p
        tree = c.frame.tree
        c.editHeadline()
        w = tree.edit_widget(p)
        for ch in s:
            p.h = p.h + ch
            tree.repaint() # *not* tree.update.
            wait(n1,n2)
            event = leoGui.leoKeyEvent(c,ch,ch,w,x=0,y=0,x_root=0,y_root=0)
            c.k.masterKeyHandler(event)
        c.frame.tree.repaint()
        c.redraw()

    def body_keys(s,n1=0.04,n2=0.1):
        c.bodyWantsFocusNow()
        p = c.p
        w = c.frame.body.bodyCtrl.widget
        for ch in s:
            p.b = p.b + ch
            w.repaint()
            wait(n1,n2)
        c.redraw()

EKR

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/leo-editor/-/KfS7IwKVIrEJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/leo-editor?hl=en.

Reply via email to