Status
1. I added a call to callLater(pyzo.shells.addShell) at the end of make_all_docks. This revealed several problems with the init code, including some buglets (undefined pyzo ivars) in the pyzo code when using the plugin's (slightly altered) startup logic.
2. Pyzo's config code continues to be a confounding factor in understanding, initing and executing the code. The plugin uses the real pyzo's config.ssdf file, and that makes the startup code appear to be non-deterministic. The value of command-line arguments (sys.argv) is another confounding factor.
3. Leo does not shut down properly when the pyzo_in_leo plugin is enabled. There is some unused code that does this. I'll probably just have to put it back in place. It's an easy monkey-patch to Leo itself.
Here are my next steps...
Execute pyzo's startup code exactly as pyzo does
Failure to do this may be causing subtle startup bugs, including the buglets described above. I shall replace start_pyzo_in_leo with the following functions in the plugin:
- pyzo_start: a copy of pyzo.start, with as few changes as possible. It will call:
- pyzo_main_ctor: a copy of pyzo's MainWindow.__init__.py,which will call:
- pyzo_main_populate: a copy of pyzo's MainWindow._populate.
De-fang pyzo.config
This can't wait any longer. pyzo.config is, in effect, a set of global vars that depend on the real pyzo's configuration. It's way too confusing to continue to allow this coupling. The changed code will be an in-place shim. Traces in pyzo.config should be helpful in debugging.
Create a dock for pyzo's main "Editors" window
In the real pyzo this is the central widget, not a dock, but Leo already has a central widget :-) Making pyzo's editors visible will help with debugging, and might even remain in the final code.
Summary
I have begun debugging pyzo in the context of the pyzo_in_leo plugin.
Subtle differences in the plugin's startup logic are causing subtle, difficult-to-find, execution time errors.
pyzo.config must be made deterministic. This will start the process of melding pyzo's config system with Leo's.
For debugging (and longer?), I'll make pyzo's editors visible by putting them in a new Leo dock.
Edward