Is this code supposed to automatically mark the nodes as dirty, and the
overall file as being changed? If so, it doesn't seem to do so in 4.8
rc1 build 3715. I must be doing something wrong or have a wrong setting?
-------- 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.