Hi:
When working with a dictionary, some times I really need to "see it", so I 
needed this small script.
It will transform a dictionary into an outline, so you can navigate through 
it.
Just in case its useful for anyone, here it goes:

def dictionary_to_outline(p,dictionary):

    '''

    Transform a dictionary into the subtree outline of the given position 

    '''

    g.app.gui.frameFactory.masterFrame.currentWidget().leo_c


    sorted_keys = sorted([key for key in dictionary])

    for key in sorted_keys:

        new_node = p.insertAsLastChild().copy()

        new_node.h = key

        if "dict" in str(type(dictionary[key])):

            self.dictionary_to_outline(new_node,dictionary[key])

        else:

            new_node.b = str(dictionary[key])

-- 
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