(oops, apologies for double-posting ... Google Groups grr...)

Spurred on by my triumph I have experimented with adding a new primitive of 
my own! This allows me to have a key combination to expend or contract a 
node
depending on its current state.

Apologies if there's already a way of doing this ... I submit the following 
for possible inclusion into Leo:

{{{ in leoCommands.py

    def toggleExpandState (self,event=None):
        """ Toggle the expand state of the current node
        """
        trace = False and not g.unitTesting
        c = self; p = c.p
        # set up the functions to call
        if p.isExpanded():
            fa = p.contract
            frd = c.redraw_after_contract
        else:
            fa = p.expand
            frd = c.redraw_after_expand
        # perform the calls
        fa()
        if p.isCloned():
            if trace: g.trace('***redraw')
            c.redraw()
        else:
            frd(p,setFocus=True)
}}}

and the obvious entry in leoEditCommands.py:

{{{
            'toggle-expand-state':          c.toggleExpandState,
}}}

I bind this to Ctrl-E (Expand) and Ctrl-H (Hide) FWIW.

    Cheers
    Jon N


>

-- 
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 http://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to