On Monday, August 12, 2019 at 5:55:08 AM UTC-5, Edward K. Ream wrote:
 
> leo/plugins/pyzo will allow me to experiment safely with significant 
changes to pyzo's code, especially pyzo's startup code.

Done.

> Side effects of "import pyzo" must be eliminated.
 
Done.   

Today marks a huge milestone. The pyzo_file_browser plugin has collapsed in 
complexity!

- The plugin gets *all* pyzo's code using imports from leo/plugins/pyzo!
- The new start_pyzo_in_leo() function completely de-fang's "import pyzo"!

Here are the plugin's imports:

# Must patch sys.path here.
import sys
plugins_dir = g.os_path_finalize_join(g.app.loadDir, '..', 'plugins')
sys.path.insert(0, plugins_dir)

# Start pyzo, de-fanged.
import pyzo
pyzo.start_pyzo_in_leo()

# Import the file browser.
from pyzo.tools.pyzoFileBrowser import PyzoFileBrowser

That's *all!*

*Summary*

At long last there is an *easy* path for using any part of pyzo's code, 
modified as we like, without monkey-patches.

The generalized pyzo_in_leo plugin will use exactly this pattern.

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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/leo-editor/a05d1e06-9993-42af-8809-815dfb2fe95e%40googlegroups.com.

Reply via email to