Matt Wilkie recently wrote (http://tinyurl.com/22lf48p)

> Thank you for taking the time to explain. Insight into your process is
> more valuable to me at this stage in my learning-to-program
> development than what or how script X does Y.

I would like to know the specific steps you went through to find the "docstring" (whatever that is) for the unmark-all command in order for you to copy and paste it into this thread.

-------- Original Message --------
Subject: Re: Unmark-all command [was: Q: Outline icon has red line that won't go away]
From: Edward K. Ream <[email protected]>
To: [email protected]
Date: Thursday, November 11, 2010 3:41:07 PM

On Thu, Nov 11, 2010 at 12:35 PM, taa, Leo Newbie<[email protected]>  wrote:

Unmark-all appears to remove all marks in ALL outlines and not just
the currently selected one.

You are confused about what "the outline" means.

The docstring for the unmark-all command is:

'''Unmark all nodes in the entire outline.'''

I think this is as clear as it can possibly be.

How can I unmark only the select outline
(node) and all its children?

The proper terminology would be, umark the selected *node* and all its children.

I don't think there is a command that does exactly this, but the
following script will do the job:

for p in c.p.subtree():
    p.clearMarked()
c.redraw()

I put it in a node called @button unmark-tree.

To make this undoable, use the following (tested) code:

u = c.undoer ; undoType = 'unmark-tree'
changed = False
u.beforeChangeGroup(c.p,undoType)
for p in c.p.subtree():
     if p.isMarked():
         bunch = u.beforeMark(p,undoType)
         p.clearMarked()
         u.afterMark(p,undoType,bunch)
         changed = True
if changed:
     u.afterChangeGroup(c.p,undoType)
     c.redraw()

Edward


--
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/leo-editor?hl=en.

Reply via email to