On Monday, 4 August 2014 16:53:11 UTC+1, Jacob Peck wrote:
>
> Regarding tags, I hacked the nodetags.py plugin together, available at 
> commit b9a764c59de263fbdb47969f1d318759b955c442. 
>
> Attached is a test leo file for playing with it. 
>
> This is only an API for tags, but I feel like it should simplify the 
> process and allow someone to focus on the important bits, i.e. UI hooks, 
> rather than low-level details. Also, it's usable now for scripts. 
>
> Here is the docstring: 
>
> Leo.plugins.nodetags 
>
> Provides an API for manipulating and querying textual tags on nodes 
>
> By Jacob M. Peck 
>
> This plugin registers a controller object to c.theTagController, which 
> provides the following API: 
>
> tc = c.theTagController 
>
> tc.get_all_tags() # return a list of all tags used in the current 
> outline, automatically updated to be consistent 
>
> tc.get_tagged_nodes('foo') # return a list of positions tagged 'foo' 
>
> tc.get_tags(p) # return a list of tags applied to the node at position 
> p; returns [] if node has no tags 
>
> tc.add_tag(p, 'bar') # add the tag 'bar' to the node at position p 
>
> tc.remove_tag(p, 'baz') # remove the tag 'baz' from p if it is in the 
> tag list 
> Internally, tags are stored in p.v.unknownAttributes[‘__node_tags’] as a 
> set. 
>
> -->Jake 
>


Thanks a LOT, Jake, for your work.

I have tried it, but obviously I am missing  something, because when I 
clicked on the add-tage button to add a tag to a node, I get the following 
error messages:

'@script-button-button-btn-bg' from style-sheet comment definition, please 
use regular @string / @color type @settings.
Abbreviations off
reading: C:\Users\User01\Desktop\tagtest.leo
exception executing script
AttributeError: 'Commands' object has no attribute 'theTagController'
--------------------
  line 9: 
* line 10: tc = c.theTagController
  line 11: tag = ''.join(random.choice(string.ascii_uppercase) for _ in 
range(8))
  line 12:

BTW, I also tried the other buttons, and they all give error messages.
I am running Python 3.3 under Windows 8.1.


-- 
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/d/optout.

Reply via email to