That's only for the tagtest.leo file, the function in the API has such a
check. That tagtest.leo file was just hacked together to demonstrate
some things and shouldn't be considered bug free :)
I've attached a fixed version though, just in case.
In fixing that... I found another subtle bug. If you copy/paste
tag-bearing nodes from one outline to another, the global taglist isn't
updated... Easy enough to fix, just need to find the right hook!
Thanks!
-->Jake
On 8/6/2014 9:38 AM, Labas Cert wrote:
Jake, you may want to put a check on the rm-tag function, to make sure
that there is at least one tag when it is run, because if you try to
run it on a tagless node an error message is produced.
--
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 leo-editor+unsubscr...@googlegroups.com
<mailto:leo-editor+unsubscr...@googlegroups.com>.
To post to this group, send email to leo-editor@googlegroups.com
<mailto:leo-editor@googlegroups.com>.
Visit this group at http://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.
--
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 leo-editor+unsubscr...@googlegroups.com.
To post to this group, send email to leo-editor@googlegroups.com.
Visit this group at http://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.
<?xml version="1.0" encoding="utf-8"?>
<!-- Created by Leo (http://leoeditor.com/leo_toc.html) -->
<?xml-stylesheet ekr_test?>
<leo_file xmlns:leo="http://www.leo-editor.org/2011/leo" >
<leo_header file_format="2" tnodes="0" max_tnode_index="0" clone_windows="0"/>
<globals body_outline_ratio="0.5" body_secondary_ratio="0.5">
<global_window_position top="50" left="50" height="500" width="700"/>
<global_log_window_position top="0" left="0" height="0" width="0"/>
</globals>
<preferences/>
<find_panel_settings/>
<vnodes>
<v t="peckj.20140804114044.3756"><vh>@settings</vh>
<v t="peckj.20140804114044.3757"><vh>@plugin nodetags</vh></v>
</v>
<v t="peckj.20140804114044.3759"><vh>@button add-tag</vh></v>
<v t="peckj.20140804114044.3761"><vh>@button rm-tag</vh></v>
<v t="peckj.20140804114044.3763"><vh>@button list-tags</vh></v>
<v t="peckj.20140804114044.3765"><vh>@button add-tag-test</vh></v>
<v t="peckj.20140804114044.3767"><vh>@button get-tagged-nodes-test</vh></v>
<v t="peckj.20140804114044.3769"><vh>@button list-all-tags</vh></v>
<v t="peckj.20140804114044.3770" a="E"><vh>Tag test nodes</vh>
<v t="peckj.20140804114044.3771"><vh>node 1</vh></v>
<v t="peckj.20140804114044.3772"><vh>node 2</vh></v>
<v t="peckj.20140804114044.3773"><vh>node 3</vh></v>
<v t="peckj.20140806094329.3741" a="E"><vh>The two children of this node test identical headlines with differing tag sets</vh>
<v t="peckj.20140806094329.3740"><vh>tag test</vh></v>
<v t="peckj.20140806094329.3743"><vh>tag test</vh></v>
</v>
</v>
</vnodes>
<tnodes>
<t tx="peckj.20140804114044.3756"></t>
<t tx="peckj.20140804114044.3757"></t>
<t tx="peckj.20140804114044.3759">@language python
''' add a random tag to the selected node '''
import string, random
import random
tc = c.theTagController
tag = ''.join(random.choice(string.ascii_uppercase) for _ in range(8))
tc.add_tag(p, tag)
</t>
<t tx="peckj.20140804114044.3761">@language python
''' remove the first tag on the node '''
import random
tc = c.theTagController
tags = tc.get_tags(p)
if len(tags) > 0:
tag = tags[0]
tc.remove_tag(p, tag)
</t>
<t tx="peckj.20140804114044.3763">@language python
''' list all tags on the selected node '''
tc = c.theTagController
g.es('tags: ', tc.get_tags(p))
</t>
<t tx="peckj.20140804114044.3765">@language python
''' add the tag "test" to the node '''
tc = c.theTagController
tag = 'test2'
#g.es('tags before: ', tc.get_tags(p))
tc.add_tag(p, tag)
#g.es('tags after: ', tc.get_tags(p))
</t>
<t tx="peckj.20140804114044.3767">@language python
''' get all nodes tagged "test" '''
tc = c.theTagController
tag = 'test'
nodelist = tc.get_tagged_nodes(tag)
nodelist = [n.h for n in nodelist]
g.es('nodes tagged "test": ', nodelist)
</t>
<t tx="peckj.20140804114044.3769">@language python
''' list all tags in the current outline '''
tc = c.theTagController
g.es('All tags in this outline: ', tc.get_all_tags())</t>
<t tx="peckj.20140804114044.3770"></t>
<t tx="peckj.20140804114044.3771" __node_tags="635f5f6275696c74696e5f5f0a7365740a7100285d7101285504746573747102550574657374327103657471045271052e"></t>
<t tx="peckj.20140804114044.3772"></t>
<t tx="peckj.20140804114044.3773" __node_tags="635f5f6275696c74696e5f5f0a7365740a7100285d7101550574657374327102617471035271042e"></t>
<t tx="peckj.20140806094329.3740" __node_tags="635f5f6275696c74696e5f5f0a7365740a7100285d710128550474616734710255047461673571035504746167337104657471055271062e">c.theTagController.add_tag(p,'tag4')
c.theTagController.add_tag(p,'tag5')
c.theTagController.add_tag(p,'tag3')
</t>
<t tx="peckj.20140806094329.3741"></t>
<t tx="peckj.20140806094329.3743" __node_tags="635f5f6275696c74696e5f5f0a7365740a7100285d710128550474616731710255047461673271035504746167337104657471055271062e">c.theTagController.add_tag(p,'tag1')
c.theTagController.add_tag(p,'tag2')
c.theTagController.add_tag(p,'tag3')</t>
</tnodes>
</leo_file>