It's dead easy to run code in an external process, so that Leo doesn't 
hang.  Just use g.execute_shell_commands.  

For example, I can test Qt Quick code without hanging Leo like this:

g.execute_shell_commands('qmlscene /test/qml_test.qml')

The "work flow" is as follows:

1. Define "@file /test/qml_test.py" containing the code to be tested.  You 
can use @others and section references as always, but you must define c, g 
and p yourself.

2. Define @button qml-test containing just the call to 
g.execute_shell_commands given above.

3. The @button node defines a new command, "qml-test".  After running the 
command from the minibuffer, you can re-run the test using Ctrl-P, 
repeat-complex-command.

Similarly, *Leo can run code in any language*.  Just do something like this:

g.execute_shell_commands([
    '<path to>compiler <path to>program',
    '<command to run> <resulting program>',
])

Edward

P. S. g.execute_shell_commands_with_options provides more flexibility: it 
inits the environment and then calls g.execute_shell_commands.  See the 
source code in leoGlobals.py for details. For the ultimate in flexibility, 
use subprocess.popen.

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 [email protected].
To post to this group, send email to [email protected].
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