On Thu, 23 Mar 2017 09:53:56 -0500
"Edward K. Ream" <[email protected]> wrote:

> Is there code I can look at?  And I'll try to remember to call them
> EP's :-)

The code is in the branch 
https://github.com/tbnorth/leo-dev-tbnorth/tree/leo_edit_pane
but I'd ask you to hold off on any modifications just yet, I'd like to
get the proof of concept solid before we start dealing with the
intricacies of integration.

To open a LEP you need to tell free_layout about them.  I still want to
replace free_layout with Qt's docks, but for now free_layout is how you
add panes of any kind.  To do that you need to run this script once (I
have it on a @script node):

from leo.core.editpane import editpane
if g.isPython3:
    from importlib import reload

class MinimalDemoProvider:
    def ns_provides(self):
        return [("Demo editor", "__demo_provider_minimal_slider")]
    def ns_provide(self, id_):
        if id_ == "__demo_provider_minimal_slider":
            reload(editpane)  
            g.es("reloaded")          
            w = editpane.LeoEditPane(c=c, mode='split')
            return w
        return None
    def ns_provider_id(self):
        return "__demo_provider_minimal"
        
c.free_layout.get_top_splitter().register_provider(MinimalDemoProvider())

Then you can either use the free_layout menus to open a LEP, or more
easily run this code from a button:

s = c.free_layout.get_top_splitter()
s.open_window("__demo_provider_minimal_slider")

This opens the LEP in a separate window, it works the same as a pane in
the main window.

You should get at least Plain Text Edit, Plain Text Edit B, Plain Text
View, and Plain Text View B.  These are what they sound like, with the B
versions having a different background color to show they're alternate
widgets.  Depending on what you have installed, you may also get a
WebKit based HTML viewer, a WebEngine based HTML viewer, and a Markdown
viewer descending from one of the HTML viewers.  Possibly also a
markdown-html viewer which shows you the HTML for markdown, can't remember.

LEP is an attempt at a split pane source / rendered source view.  I don't
think all the new editor components we've been discussing should necessarily 
build on top of LEP, but I think the approach to integration into Leo 
that LEP is following might be useful for other editor components.

Cheers -Terry

-- 
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 post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.

Reply via email to