Okay, I've made some progress.  Turns out, I was erroneously assumed I was 
in an IPython shell because it had 'magics', but it was just the idle 
interpreter, (never spent much time in Idle).  All it took was creating a 
new shell config, and ticking the IPython box.

I'm going paste in some of the shell interaction with comments interspersed 
and a question.

Python 3.7.7 (default, Apr 15 2020, 05:09:04) on Windows (64 bits).

This is the Pyzo interpreter with integrated event loop for PYQT5.



Using IPython 7.13.0 -- An enhanced Interactive Python.

?         -> Introduction and overview of IPython's features.

%quickref -> Quick reference.

help      -> Python's own help system.

object?   -> Details about 'object', use 'object??' for extra details.



In [1]: whos  #this is before I started "launchLeo.py" with F5

Interactive namespace is empty.



In [2]: (executing file "launchLeo.py")

Qt WebEngine seems to be initialized from a plugin. Please set 
Qt::AA_ShareOpenGLContexts 
using QCoreApplication::setAttribute before constructing QGuiApplication.



Leo 6.3-devel, devel branch, build cbb73524c3

2020-04-15 04:24:37 -0500

Note on using QApplication.exec_():

The GUI event loop is already running in the pyzo kernel, and exec_()

does not block. In most cases your app should run fine without the need

for modifications. For clarity, this is what the pyzo kernel does:

- Prevent deletion of objects in the local scope of functions leading to 
exec_()

- Prevent system exit right after the exec_() call


In [3]: whos #note our workspace is now populated with stuff from Leo!

Variable             Type      Data/Info

----------------------------------------

leo                  module    <module 'leo' from 
'c:\\v<...>ditor\\leo\\__init__.py'>

load_locals          dict      n=6

runMainLoop_locals   dict      n=1

run_locals           dict      n=4


In [4]: g.commander_command('new') # naive attempt open a new file in Leo

---------------------------------------------------------------------------

NameError                                 Traceback (most recent call last)

<ipython-input-4-c784551296f6> in <module>

----> 1 g.commander_command('new')


NameError: name 'g' is not defined

/*
Hmm, 'g' is not availible, let's try a fully qualified name, reaching down 
from the 'leo' we saw from In [3]: whos : 
*/

In [5]: leo.commands.commanderFileCommands.new() # so here is my 
question,what should I use for my argument?

---------------------------------------------------------------------------

TypeError                                 Traceback (most recent call last)

<ipython-input-5-0f3e5c284e86> in <module>

----> 1 leo.commands.commanderFileCommands.new()


TypeError: new() missing 1 required positional argument: 'self'


In [6]:

The question is at In [5] above, I guess it would be 'g.app', but 'g' isn't 
available, any suggestions?

Doing things like this is the reason I first started looking at IPython, to 
provide a way to explore Leo code.

Tom


-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/leo-editor/28f56ca2-3181-4595-8fb3-a9b567bdb8e5%40googlegroups.com.

Reply via email to