Revs fdb0e9c and 2b2fffea complete work on the essentials of the demo.py 
plugin. The highlights:

1. scripts.leo now contains a copy of the test script I used during 
development:

    @button test-demo @key=Ctrl-9

Today's major innovation is that the script uses the Ctrl-9 key binding to 
*start 
and continue *the demo. This is the *only* key binding appropriated by the 
demo! Not having to switch keys eliminates a big annoyance.

This script is really a template for all demos. As I write this, I see that 
Leo should have a demo;; abbreviation that creates this template 
automatically.  Coming next.

The @button node creates a custom MyDemo class that overrides the 
do-nothing Demo.setup_script method so that it calls demo.delete_widgets. 
This shows the power of subclassing the Demo class.

2. After several false starts, the *graphics classes* (Callout, Label, and 
Title) in demo.py now can use all helpers in the Demo class *without* using 
mixin class. This involved moving set_position and its helpers out of the 
Label class and back into the Demo class.

The inheritance of graphics classes is now *clean*. That is, the Callout 
and Title classes derive *only* from the base Label class. This is *extremely 
important*. Using a mixin class prevented easy subclassing.

Now, all graphics classes can be QtWidget's, of whatever kind. For example, 
Callout instances *are* QLabels because Callout is a subclass of Label, 
which is a QLabel. pyzo shows that having many base classes can work, but 
demo.py's present scheme is the simplest thing that could possibly work.

*Summary*

The overall framework for demo.py is now stable.

A new demo;; abbreviation will create a template for top-level demo scripts.

Your own demo scripts can easily define new graphics classes, using the 
Label, Callout and Title classes as a model.

I plan to add Image, Arrow, RedArrow and BlueArrow graphics classes soon. 
These will provide further examples of how to create your own graphics 
classes.

Do *not* use image-related methods of the Demo class.  They will go away 
when the Image class is in place.

All questions and comments welcome.

Edward

-- 
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.

Reply via email to