On Monday, August 5, 2019 at 1:27:12 PM UTC-5, Edward K. Ream wrote:

This time around everything things much easier.
>

This post describes recent progress in the pyzo branch. As usual, the 
summary contains the gist.

The pyzo_file_browser plugin now can embed *all* of pyzo's docks (except 
the Shell and Workspace docks) into Leo.  The pyzo docks are, to various 
degrees, partially or fully functional.

*Enabling docks*

LeoSettings.leo now contains the @data pyzo_tool_ids node.  It's contents 
are:

# Valid ids:

# pyzofilebrowser
# pyzohistoryviewer
# pyzointeractivehelp
# pyzologger
# pyzowebbrowser
# pyzosourcestructure
    # Partially functional.

# Not ready yet.
# pyzoworkspace

Copy this node to myLeoSettings.leo and uncomment the id of the desired 
pyzo dock.

*Only Leo's copy of pyzo is executing*

In the pyzo branch, Leo's external/pyzo directory tree contains a copy of 
pyzo's sources.

Yesterday's big breakthrough is that just a few changes to pyzo's code 
suffice to make imports "just work".

I've made a few other *minor *changes to the pyzo sources.  They are all 
marked with ekr:change in the pyzo sources.  Eventually these changes 
*might* be made via monkey-patching, but there is no need to do so at 
present.

Please read the next two sections carefully.  The present union of Leo and 
pyzo is confusing.


*Startup and configuration*

During startup, the plugin recreates most, *but not all*, of pyzo's startup 
logic, using the copy of pyzo's source code in Leo.  What happens depends 
on pyzo's configuration file, *config.ssdf*.

- If you *don't* have the "real" pyzo installed, the plugin's startup logic 
will (I haven't checked) create a standard config.ssdf file for you.
- If you *do* have the "real" pyzo installed, the plugin's startup logic 
will use the "real" config.ssdf.

At present, the plugin will update config.ssdf when Leo exits. This will 
affect the real pyzo, if present.

*Pyzo editors are hidden*

During startup, Leo will create a *hidden pyzo editor* for all files 
mentioned in config.ssdf.  Opening a file (in Leo) using the Pyzo File 
Browser dock will also create a hidden pyzo editor. All these hidden 
editors are likely pretty much fully functional, as far as the rest Leo's 
embedded pyzo code is concerned.  Some examples:

- The Source Structure dock will show the structures of the last file 
opened.
- On exit, the embedded pyzo code will update config.ssdf. If you then open 
the "real" pyzo, pyzo will open the files you have opened in Leo.


*To do: configuration*

It will be easy to suppress the updates of config.ssdf from within Leo.  
That makes sense for many reasons. 

The embedded version of pyzo will likely continue to read config.ssdf for 
stuff that Leo's users don't know or care about. Eventually, we'll want to 
use Leo's own configuration system for all pyzo stuff that Leo's users *do* 
care about.

Leo's non-pyzo code *already* remembers the placement of *all* docks. 
That's a feature of Qt's main window code.


*To do: other*

Progress has been so fast that I'm a bit dizzy.  Here are some preliminary 
thoughts:

1. Making the Shell and Workspace docks visible seems like a reasonable 
first step. This will likely complete most startup-related issues. I don't 
expect serious problems.

2. I'll start making pyzo's configuration more Leonine.  Leo probably 
should never write config.ssdf.

2. The *big question* is how to unify/reconcile pyzo's hidden editors with 
Leo's body pane?  Do we adapt Leo's body classes to pyzo, or adapt pyzo's 
editor classes to Leo?  It might go either way.  Imo, pyzo's editors are 
*much* better than Leo's, but adapting pyzo's editors so they look (and 
act) like Leo's body pane might be quite a trick.  Either way, I have a 
general idea of what is required.  I'll leave the details for later.

*Summary*

The pyzo_file_browser plugin is misnamed.  It will be renamed 
pyzo_in_leo.py eventually.

Enable pyzo docks using *@data pyzo_tool_ids*.

The plugin interacts with the real pyzo via *config.ssdf*.  Don't have the 
real pyzo open while using this plugin.

The plugin creates *hidden pyzo editors* during startup.  Opening a file 
using the Pyzo File Browser dock will also create a hidden pyzo editor.  
These hidden editors interact with other pyzo docks.

The *big question*: how to reconcile pyzo's editor tabs with Leo's body 
pane?  The entire pyzo_in_leo project depends on this step.  Some 
relatively clean way will likely emerge. Imo, this project is worth almost 
any amount of work.

If you feel adventurous, please try out the plugin in the pyzo branch. 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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/leo-editor/42d5a2ce-6cd2-4be6-9b8f-64c09212f504%40googlegroups.com.

Reply via email to