On Monday, August 12, 2019 at 9:24:43 AM UTC-5, Edward K. Ream wrote:

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

And today marks another huge milestone: the pyzo_in_leo plugin now loads 
*all* of pyzo's docks.  The code is ridiculously simple:

*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

*onCreate*

def onCreate(tag, keys): 
    c = keys.get('c')
    if not c and c.frame:
        return
    pyzo.start_pyzo_in_leo(c, pyzo)

*start_pyzo_in_leo*

This contains imports and inits from MainWindow.__init__ and 
MainWindow._populate. It must get a c arg in order to access *Leo's* main 
window, c.frame.top.

start_pyzo_in_leo loads all of pyzo's tool docks as follows:

table = (
        'PyzoFileBrowser',
        'PyzoHistoryViewer',
        'PyzoInteractiveHelp',
        'PyzoLogger',
        'PyzoSourceStructure',
        'PyzoWebBrowser',
        'PyzoWorkspace',
    )
    for tool_id in table:
        pyzo.toolManager.loadTool(tool_id)
            # Put a floatable dock on the right.

And that's *all.* Leo handles these docks just as with Leo's other docks, 
except pyzo's docks are floatable. Leo remembers any changes to the 
location and visibility of these pyzo docks.

*Summary*

This marks the successful conclusion of the first phase of the pyzo in Leo 
project.

start_pyzo_in_leo completely inits pyzo and will contain any necessary 
tweaks.

Leo remembers the location and visibility of these pyzo docks. All pyzo 
docks are floatable.

The real work of melding pyzo and Leo lies ahead. Just for example, pyzo 
editors, if they exist, are hidden.

Oh yeah, I just remembered that the code doesn't create pyzo's shell area.  
In pyzo, it's not a dock, but onCreate could make it a dock.

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/946355b7-f588-4947-93e8-51cda5fb7a3e%40googlegroups.com.

Reply via email to