[Python-modules-commits] [python-urwidtrees] 01/01: Imported Upstream version 1.0

ChangZhuo Chen czchen at moszumanska.debian.org
Sun Feb 7 17:58:09 UTC 2016


This is an automated email from the git hooks/post-receive script.

czchen pushed a commit to branch master
in repository python-urwidtrees.

commit 264ab1d69b49495d3183fd990afd426114faf97e
Author: ChangZhuo Chen (陳昌倬) <czchen at debian.org>
Date:   Mon Feb 8 01:52:29 2016 +0800

    Imported Upstream version 1.0
---
 README.md                                         |  16 +
 docs/Makefile                                     | 177 ++++++++
 docs/examples/__pycache__/example1.cpython-34.pyc | Bin 0 -> 2462 bytes
 docs/examples/example1.py                         |  89 ++++
 docs/examples/example1.pyc                        | Bin 0 -> 3080 bytes
 docs/examples/example2.arrows.py                  |  29 ++
 docs/examples/example3.collapse.py                |  44 ++
 docs/examples/example4.filesystem.py              | 131 ++++++
 docs/examples/example5.nested.py                  |  84 ++++
 docs/source/.ropeproject/config.py                |  85 ++++
 docs/source/.ropeproject/globalnames              |   8 +
 docs/source/.ropeproject/history                  |   1 +
 docs/source/.ropeproject/objectdb                 |   1 +
 docs/source/conf.py                               | 301 +++++++++++++
 docs/source/containers.rst                        |  20 +
 docs/source/decoration.rst                        |  39 ++
 docs/source/examples.rst                          |  41 ++
 docs/source/index.rst                             |  41 ++
 docs/source/structure.rst                         |  36 ++
 setup.py                                          |  17 +
 urwidtrees/__init__.py                            |  15 +
 urwidtrees/decoration.py                          | 512 ++++++++++++++++++++++
 urwidtrees/lru_cache.py                           | 141 ++++++
 urwidtrees/nested.py                              | 366 ++++++++++++++++
 urwidtrees/tree.py                                | 252 +++++++++++
 urwidtrees/widgets.py                             | 244 +++++++++++
 26 files changed, 2690 insertions(+)

diff --git a/README.md b/README.md
new file mode 100644
index 0000000..35e8cbc
--- /dev/null
+++ b/README.md
@@ -0,0 +1,16 @@
+Urwid Tree Container API
+========================
+
+This is a Widget Container API for the [urwid][urwid] toolkit.
+It uses a MVC approach and allows to build trees of widgets.
+Its design goals are
+
+* clear separation classes that define, decorate and display trees of widgets
+* representation of trees by local operations on node positions
+* easy to use default implementation for simple trees
+* Collapses are considered decoration
+
+See the `docs/` subdirectory for autogenetated API docs.
+[![rtfd docs build status](https://readthedocs.org/projects/urwidtrees/badge/)](https://urwidtrees.readthedocs.org/en/latest/)
+
+[urwid]: http://excess.org/urwid/
diff --git a/docs/Makefile b/docs/Makefile
new file mode 100644
index 0000000..00da0a0
--- /dev/null
+++ b/docs/Makefile
@@ -0,0 +1,177 @@
+# Makefile for Sphinx documentation
+#
+
+# You can set these variables from the command line.
+SPHINXOPTS    =
+SPHINXBUILD   = sphinx-build
+PAPER         =
+BUILDDIR      = build
+
+# User-friendly check for sphinx-build
+ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1)
+$(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/)
+endif
+
+# Internal variables.
+PAPEROPT_a4     = -D latex_paper_size=a4
+PAPEROPT_letter = -D latex_paper_size=letter
+ALLSPHINXOPTS   = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source
+# the i18n builder cannot share the environment and doctrees with the others
+I18NSPHINXOPTS  = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source
+
+.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext
+
+help:
+	@echo "Please use \`make <target>' where <target> is one of"
+	@echo "  html       to make standalone HTML files"
+	@echo "  dirhtml    to make HTML files named index.html in directories"
+	@echo "  singlehtml to make a single large HTML file"
+	@echo "  pickle     to make pickle files"
+	@echo "  json       to make JSON files"
+	@echo "  htmlhelp   to make HTML files and a HTML help project"
+	@echo "  qthelp     to make HTML files and a qthelp project"
+	@echo "  devhelp    to make HTML files and a Devhelp project"
+	@echo "  epub       to make an epub"
+	@echo "  latex      to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
+	@echo "  latexpdf   to make LaTeX files and run them through pdflatex"
+	@echo "  latexpdfja to make LaTeX files and run them through platex/dvipdfmx"
+	@echo "  text       to make text files"
+	@echo "  man        to make manual pages"
+	@echo "  texinfo    to make Texinfo files"
+	@echo "  info       to make Texinfo files and run them through makeinfo"
+	@echo "  gettext    to make PO message catalogs"
+	@echo "  changes    to make an overview of all changed/added/deprecated items"
+	@echo "  xml        to make Docutils-native XML files"
+	@echo "  pseudoxml  to make pseudoxml-XML files for display purposes"
+	@echo "  linkcheck  to check all external links for integrity"
+	@echo "  doctest    to run all doctests embedded in the documentation (if enabled)"
+
+clean:
+	rm -rf $(BUILDDIR)/*
+
+html:
+	$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
+	@echo
+	@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
+
+dirhtml:
+	$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
+	@echo
+	@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
+
+singlehtml:
+	$(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
+	@echo
+	@echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
+
+pickle:
+	$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
+	@echo
+	@echo "Build finished; now you can process the pickle files."
+
+json:
+	$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
+	@echo
+	@echo "Build finished; now you can process the JSON files."
+
+htmlhelp:
+	$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
+	@echo
+	@echo "Build finished; now you can run HTML Help Workshop with the" \
+	      ".hhp project file in $(BUILDDIR)/htmlhelp."
+
+qthelp:
+	$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
+	@echo
+	@echo "Build finished; now you can run "qcollectiongenerator" with the" \
+	      ".qhcp project file in $(BUILDDIR)/qthelp, like this:"
+	@echo "# qcollectiongenerator $(BUILDDIR)/qthelp/urwidtrees.qhcp"
+	@echo "To view the help file:"
+	@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/urwidtrees.qhc"
+
+devhelp:
+	$(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
+	@echo
+	@echo "Build finished."
+	@echo "To view the help file:"
+	@echo "# mkdir -p $$HOME/.local/share/devhelp/urwidtrees"
+	@echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/urwidtrees"
+	@echo "# devhelp"
+
+epub:
+	$(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
+	@echo
+	@echo "Build finished. The epub file is in $(BUILDDIR)/epub."
+
+latex:
+	$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
+	@echo
+	@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
+	@echo "Run \`make' in that directory to run these through (pdf)latex" \
+	      "(use \`make latexpdf' here to do that automatically)."
+
+latexpdf:
+	$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
+	@echo "Running LaTeX files through pdflatex..."
+	$(MAKE) -C $(BUILDDIR)/latex all-pdf
+	@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
+
+latexpdfja:
+	$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
+	@echo "Running LaTeX files through platex and dvipdfmx..."
+	$(MAKE) -C $(BUILDDIR)/latex all-pdf-ja
+	@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
+
+text:
+	$(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
+	@echo
+	@echo "Build finished. The text files are in $(BUILDDIR)/text."
+
+man:
+	$(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
+	@echo
+	@echo "Build finished. The manual pages are in $(BUILDDIR)/man."
+
+texinfo:
+	$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
+	@echo
+	@echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo."
+	@echo "Run \`make' in that directory to run these through makeinfo" \
+	      "(use \`make info' here to do that automatically)."
+
+info:
+	$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
+	@echo "Running Texinfo files through makeinfo..."
+	make -C $(BUILDDIR)/texinfo info
+	@echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo."
+
+gettext:
+	$(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale
+	@echo
+	@echo "Build finished. The message catalogs are in $(BUILDDIR)/locale."
+
+changes:
+	$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
+	@echo
+	@echo "The overview file is in $(BUILDDIR)/changes."
+
+linkcheck:
+	$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
+	@echo
+	@echo "Link check complete; look for any errors in the above output " \
+	      "or in $(BUILDDIR)/linkcheck/output.txt."
+
+doctest:
+	$(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
+	@echo "Testing of doctests in the sources finished, look at the " \
+	      "results in $(BUILDDIR)/doctest/output.txt."
+
+xml:
+	$(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml
+	@echo
+	@echo "Build finished. The XML files are in $(BUILDDIR)/xml."
+
+pseudoxml:
+	$(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml
+	@echo
+	@echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml."
diff --git a/docs/examples/__pycache__/example1.cpython-34.pyc b/docs/examples/__pycache__/example1.cpython-34.pyc
new file mode 100644
index 0000000..bff948b
Binary files /dev/null and b/docs/examples/__pycache__/example1.cpython-34.pyc differ
diff --git a/docs/examples/example1.py b/docs/examples/example1.py
new file mode 100755
index 0000000..68a67f9
--- /dev/null
+++ b/docs/examples/example1.py
@@ -0,0 +1,89 @@
+#!/usr/bin/python
+# Copyright (C) 2013  Patrick Totzke <patricktotzke at gmail.com>
+# This file is released under the GNU GPL, version 3 or a later revision.
+
+import urwid
+from urwidtrees.tree import SimpleTree
+from urwidtrees.widgets import TreeBox
+
+
+# define some colours
+palette = [
+    ('body', 'black', 'light gray'),
+    ('focus', 'light gray', 'dark blue', 'standout'),
+    ('bars', 'dark blue', 'light gray', ''),
+    ('arrowtip', 'light blue', 'light gray', ''),
+    ('connectors', 'light red', 'light gray', ''),
+]
+
+# We use selectable Text widgets for our example..
+
+
+class FocusableText(urwid.WidgetWrap):
+    """Selectable Text used for nodes in our example"""
+    def __init__(self, txt):
+        t = urwid.Text(txt)
+        w = urwid.AttrMap(t, 'body', 'focus')
+        urwid.WidgetWrap.__init__(self, w)
+
+    def selectable(self):
+        return True
+
+    def keypress(self, size, key):
+        return key
+
+# define a test tree in the format accepted by SimpleTree. Essentially, a
+# tree is given as (nodewidget, [list, of, subtrees]). SimpleTree accepts
+# lists of such trees.
+
+
+def construct_example_simpletree_structure(selectable_nodes=True, children=3):
+
+    Text = FocusableText if selectable_nodes else urwid.Text
+
+    # define root node
+    tree = (Text('ROOT'), [])
+
+    # define some children
+    c = g = gg = 0  # counter
+    for i in range(children):
+        subtree = (Text('Child %d' % c), [])
+        # and grandchildren..
+        for j in range(children):
+            subsubtree = (Text('Grandchild %d' % g), [])
+            for k in range(children):
+                leaf = (Text('Grand Grandchild %d' % gg), None)
+                subsubtree[1].append(leaf)
+                gg += 1  # inc grand-grandchild counter
+            subtree[1].append(subsubtree)
+            g += 1  # inc grandchild counter
+        tree[1].append(subtree)
+        c += 1
+    return tree
+
+
+def construct_example_tree(selectable_nodes=True, children=2):
+    # define a list of tree structures to be passed on to SimpleTree
+    forrest = [construct_example_simpletree_structure(selectable_nodes,
+                                                      children)]
+
+    # stick out test tree into a SimpleTree and return
+    return SimpleTree(forrest)
+
+def unhandled_input(k):
+    #exit on q
+    if k in ['q', 'Q']: raise urwid.ExitMainLoop()
+
+if __name__ == "__main__":
+    # get example tree
+    stree = construct_example_tree()
+
+    # put the tree into a treebox
+    treebox = TreeBox(stree)
+
+    # add some decoration
+    rootwidget = urwid.AttrMap(treebox, 'body')
+    #add a text footer
+    footer = urwid.AttrMap(urwid.Text('Q to quit'), 'focus')
+    #enclose all in a frame
+    urwid.MainLoop(urwid.Frame(rootwidget, footer=footer), palette, unhandled_input = unhandled_input).run()  # go
diff --git a/docs/examples/example1.pyc b/docs/examples/example1.pyc
new file mode 100644
index 0000000..1d0bfda
Binary files /dev/null and b/docs/examples/example1.pyc differ
diff --git a/docs/examples/example2.arrows.py b/docs/examples/example2.arrows.py
new file mode 100755
index 0000000..607ac21
--- /dev/null
+++ b/docs/examples/example2.arrows.py
@@ -0,0 +1,29 @@
+#!/usr/bin/python
+# Copyright (C) 2013  Patrick Totzke <patricktotzke at gmail.com>
+# This file is released under the GNU GPL, version 3 or a later revision.
+
+from example1 import construct_example_tree, palette, unhandled_input # example data
+from urwidtrees.decoration import ArrowTree  # for Decoration
+from urwidtrees.widgets import TreeBox
+import urwid
+
+if __name__ == "__main__":
+    # get example tree
+    stree = construct_example_tree()
+    # Here, we add some decoration by wrapping the tree using ArrowTree.
+    atree = ArrowTree(stree,
+                      # customize at will..
+                      # arrow_hbar_char=u'\u2550',
+                      # arrow_vbar_char=u'\u2551',
+                      # arrow_tip_char=u'\u25B7',
+                      # arrow_connector_tchar=u'\u2560',
+                      # arrow_connector_lchar=u'\u255A',
+                      )
+
+    # put the into a treebox
+    treebox = TreeBox(atree)
+    rootwidget = urwid.AttrMap(treebox, 'body')
+    #add a text footer
+    footer = urwid.AttrMap(urwid.Text('Q to quit'), 'focus')
+    #enclose in a frame
+    urwid.MainLoop(urwid.Frame(rootwidget, footer=footer), palette, unhandled_input = unhandled_input).run()  # go
diff --git a/docs/examples/example3.collapse.py b/docs/examples/example3.collapse.py
new file mode 100755
index 0000000..f4fa47b
--- /dev/null
+++ b/docs/examples/example3.collapse.py
@@ -0,0 +1,44 @@
+#!/usr/bin/python
+# Copyright (C) 2013  Patrick Totzke <patricktotzke at gmail.com>
+# This file is released under the GNU GPL, version 3 or a later revision.
+
+from example1 import construct_example_tree, palette, unhandled_input # example data
+from urwidtrees.decoration import CollapsibleIndentedTree  # for Decoration
+from urwidtrees.widgets import TreeBox
+import urwid
+
+if __name__ == "__main__":
+    # get some SimpleTree
+    stree = construct_example_tree()
+
+    # Use (subclasses of) the wrapper decoration.CollapsibleTree to construct a
+    # tree where collapsible subtrees. Apart from the original tree, these take
+    # a callable `is_collapsed` that defines initial collapsed-status if a
+    # given position.
+
+    # We want all grandchildren collapsed initially
+    if_grandchild = lambda pos: stree.depth(pos) > 1
+
+    # We use CollapsibleIndentedTree around the original example tree.
+    # This uses Indentation to indicate the tree structure and squeezes in
+    # text-icons to indicate the collapsed status.
+    # Also try CollapsibleTree or CollapsibleArrowTree..
+    tree = CollapsibleIndentedTree(stree,
+                                   is_collapsed=if_grandchild,
+                                   icon_focussed_att='focus',
+                                   # indent=6,
+                                   # childbar_offset=1,
+                                   # icon_frame_left_char=None,
+                                   # icon_frame_right_char=None,
+                                   # icon_expanded_char='-',
+                                   # icon_collapsed_char='+',
+                                   )
+
+    # put the tree into a treebox
+    treebox = TreeBox(tree)
+    rootwidget = urwid.AttrMap(treebox, 'body')
+    #add a text footer
+    footer = urwid.AttrMap(urwid.Text('Q to quit'), 'focus')
+    #enclose all in a frame
+    urwid.MainLoop(urwid.Frame(rootwidget, footer=footer), palette, unhandled_input = unhandled_input).run() # go
+
diff --git a/docs/examples/example4.filesystem.py b/docs/examples/example4.filesystem.py
new file mode 100755
index 0000000..f65226b
--- /dev/null
+++ b/docs/examples/example4.filesystem.py
@@ -0,0 +1,131 @@
+#!/usr/bin/python
+# Copyright (C) 2013  Patrick Totzke <patricktotzke at gmail.com>
+# This file is released under the GNU GPL, version 3 or a later revision.
+
+import urwid
+import os
+from example1 import palette, unhandled_input  # example data
+from urwidtrees.widgets import TreeBox
+from urwidtrees.tree import Tree
+from urwidtrees.decoration import CollapsibleArrowTree
+
+
+# define selectable urwid.Text widgets to display paths
+class FocusableText(urwid.WidgetWrap):
+    """Widget to display paths lines"""
+    def __init__(self, txt):
+        t = urwid.Text(txt)
+        w = urwid.AttrMap(t, 'body', 'focus')
+        urwid.WidgetWrap.__init__(self, w)
+
+    def selectable(self):
+        return True
+
+    def keypress(self, size, key):
+        return key
+
+# define Tree that can walk your filesystem
+
+
+class DirectoryTree(Tree):
+    """
+    A custom Tree representing our filesystem structure.
+    This implementation is rather inefficient: basically every position-lookup
+    will call `os.listdir`.. This makes navigation in the tree quite slow.
+    In real life you'd want to do some caching.
+
+    As positions we use absolute path strings.
+    """
+    # determine dir separator and form of root node
+    pathsep = os.path.sep
+    drive, _ = os.path.splitdrive(pathsep)
+
+    # define root node This is part of the Tree API!
+    root = drive + pathsep
+
+    def __getitem__(self, pos):
+        return FocusableText(pos)
+
+    # generic helper
+    def _list_dir(self, path):
+        """returns absolute paths for all entries in a directory"""
+        try:
+            elements = [os.path.join(
+                path, x) for x in os.listdir(path) if os.path.isdir(path)]
+            elements.sort()
+        except OSError:
+            elements = None
+        return elements
+
+    def _get_siblings(self, pos):
+        """lists the parent directory of pos """
+        parent = self.parent_position(pos)
+        siblings = [pos]
+        if parent is not None:
+            siblings = self._list_dir(parent)
+        return siblings
+
+    # Tree API
+    def parent_position(self, pos):
+        parent = None
+        if pos != '/':
+            parent = os.path.split(pos)[0]
+        return parent
+
+    def first_child_position(self, pos):
+        candidate = None
+        if os.path.isdir(pos):
+            children = self._list_dir(pos)
+            if children:
+                candidate = children[0]
+        return candidate
+
+    def last_child_position(self, pos):
+        candidate = None
+        if os.path.isdir(pos):
+            children = self._list_dir(pos)
+            if children:
+                candidate = children[-1]
+        return candidate
+
+    def next_sibling_position(self, pos):
+        candidate = None
+        siblings = self._get_siblings(pos)
+        myindex = siblings.index(pos)
+        if myindex + 1 < len(siblings):  # pos is not the last entry
+            candidate = siblings[myindex + 1]
+        return candidate
+
+    def prev_sibling_position(self, pos):
+        candidate = None
+        siblings = self._get_siblings(pos)
+        myindex = siblings.index(pos)
+        if myindex > 0:  # pos is not the first entry
+            candidate = siblings[myindex - 1]
+        return candidate
+
+
+if __name__ == "__main__":
+    cwd = os.getcwd()  # get current working directory
+    dtree = DirectoryTree()  # get a directory walker
+
+    # Use CollapsibleArrowTree for decoration.
+    # define initial collapse:
+    as_deep_as_cwd = lambda pos: dtree.depth(pos) >= dtree.depth(cwd)
+
+    # We hide the usual arrow tip and use a customized collapse-icon.
+    decorated_tree = CollapsibleArrowTree(dtree,
+                                          is_collapsed=as_deep_as_cwd,
+                                          arrow_tip_char=None,
+                                          icon_frame_left_char=None,
+                                          icon_frame_right_char=None,
+                                          icon_collapsed_char=u'\u25B6',
+                                          icon_expanded_char=u'\u25B7',)
+
+    # stick it into a TreeBox and use 'body' color attribute for gaps
+    tb = TreeBox(decorated_tree, focus=cwd)
+    root_widget = urwid.AttrMap(tb, 'body')
+    #add a text footer
+    footer = urwid.AttrMap(urwid.Text('Q to quit'), 'focus')
+    #enclose all in a frame
+    urwid.MainLoop(urwid.Frame(root_widget, footer=footer), palette, unhandled_input = unhandled_input).run() # go
diff --git a/docs/examples/example5.nested.py b/docs/examples/example5.nested.py
new file mode 100755
index 0000000..92bb5fc
--- /dev/null
+++ b/docs/examples/example5.nested.py
@@ -0,0 +1,84 @@
+#!/usr/bin/python
+# Copyright (C) 2013  Patrick Totzke <patricktotzke at gmail.com>
+# This file is released under the GNU GPL, version 3 or a later revision.
+
+from example1 import palette, construct_example_tree  # example data
+from example1 import FocusableText, unhandled_input  # Selectable Text used for nodes
+from urwidtrees.widgets import TreeBox
+from urwidtrees.tree import SimpleTree
+from urwidtrees.nested import NestedTree
+from urwidtrees.decoration import ArrowTree, CollapsibleArrowTree  # decoration
+import urwid
+import logging
+
+if __name__ == "__main__":
+    #logging.basicConfig(filename='example.log',level=logging.DEBUG)
+    # Take some Arrow decorated Tree that we later stick inside another tree.
+    innertree = ArrowTree(construct_example_tree())
+    # Some collapsible, arrow decorated tree with extra indent
+    anotherinnertree = CollapsibleArrowTree(construct_example_tree(),
+                                            indent=10)
+
+    # A SimpleTree, that contains the two above
+    middletree = SimpleTree(
+        [
+            (FocusableText('Middle ROOT'),
+             [
+                 (FocusableText('Mid Child One'), None),
+                 (FocusableText('Mid Child Two'), None),
+                 (innertree, None),
+                 (FocusableText('Mid Child Three'),
+                  [
+                      (FocusableText('Mid Grandchild One'), None),
+                      (FocusableText('Mid Grandchild Two'), None),
+                  ]
+                  ),
+                 (anotherinnertree,
+                  # middletree defines a childnode here. This is usually
+                  # covered by the tree 'anotherinnertree', unless the
+                  # interepreting NestedTree's constructor gets parameter
+                  # interpret_covered=True..
+                  [
+                      (FocusableText('XXX I\'m invisible!'), None),
+
+                  ]),
+             ]
+             )
+        ]
+    )  # end SimpleTree constructor for middletree
+    # use customized arrow decoration for middle tree
+    middletree = ArrowTree(middletree,
+                           arrow_hbar_char=u'\u2550',
+                           arrow_vbar_char=u'\u2551',
+                           arrow_tip_char=u'\u25B7',
+                           arrow_connector_tchar=u'\u2560',
+                           arrow_connector_lchar=u'\u255A')
+
+    # define outmost tree
+    outertree = SimpleTree(
+        [
+            (FocusableText('Outer ROOT'),
+             [
+                 (FocusableText('Child One'), None),
+                 (middletree, None),
+                 (FocusableText('last outer child'), None),
+             ]
+             )
+        ]
+    )  # end SimpleTree constructor
+
+    # add some Arrow decoration
+    outertree = ArrowTree(outertree)
+    # wrap the whole thing into a Nested Tree
+    outertree = NestedTree(outertree,
+                           # show covered nodes like  XXX
+                           interpret_covered=False
+                           )
+
+    # put it into a treebox and run
+    treebox = TreeBox(outertree)
+    rootwidget = urwid.AttrMap(treebox, 'body')
+    #add a text footer
+    footer = urwid.AttrMap(urwid.Text('Q to quit'), 'focus')
+    #enclose all in a frame
+    urwid.MainLoop(urwid.Frame(rootwidget, footer=footer), palette, unhandled_input = unhandled_input).run() # go
diff --git a/docs/source/.ropeproject/config.py b/docs/source/.ropeproject/config.py
new file mode 100644
index 0000000..ffebcd4
--- /dev/null
+++ b/docs/source/.ropeproject/config.py
@@ -0,0 +1,85 @@
+# The default ``config.py``
+
+
+def set_prefs(prefs):
+    """This function is called before opening the project"""
+
+    # Specify which files and folders to ignore in the project.
+    # Changes to ignored resources are not added to the history and
+    # VCSs.  Also they are not returned in `Project.get_files()`.
+    # Note that ``?`` and ``*`` match all characters but slashes.
+    # '*.pyc': matches 'test.pyc' and 'pkg/test.pyc'
+    # 'mod*.pyc': matches 'test/mod1.pyc' but not 'mod/1.pyc'
+    # '.svn': matches 'pkg/.svn' and all of its children
+    # 'build/*.o': matches 'build/lib.o' but not 'build/sub/lib.o'
+    # 'build//*.o': matches 'build/lib.o' and 'build/sub/lib.o'
+    prefs['ignored_resources'] = ['*.pyc', '*~', '.ropeproject',
+                                  '.hg', '.svn', '_svn', '.git']
+
+    # Specifies which files should be considered python files.  It is
+    # useful when you have scripts inside your project.  Only files
+    # ending with ``.py`` are considered to be python files by
+    # default.
+    #prefs['python_files'] = ['*.py']
+
+    # Custom source folders:  By default rope searches the project
+    # for finding source folders (folders that should be searched
+    # for finding modules).  You can add paths to that list.  Note
+    # that rope guesses project source folders correctly most of the
+    # time; use this if you have any problems.
+    # The folders should be relative to project root and use '/' for
+    # separating folders regardless of the platform rope is running on.
+    # 'src/my_source_folder' for instance.
+    #prefs.add('source_folders', 'src')
+
+    # You can extend python path for looking up modules
+    #prefs.add('python_path', '~/python/')
+
+    # Should rope save object information or not.
+    prefs['save_objectdb'] = True
+    prefs['compress_objectdb'] = False
+
+    # If `True`, rope analyzes each module when it is being saved.
+    prefs['automatic_soa'] = True
+    # The depth of calls to follow in static object analysis
+    prefs['soa_followed_calls'] = 0
+
+    # If `False` when running modules or unit tests "dynamic object
+    # analysis" is turned off.  This makes them much faster.
+    prefs['perform_doa'] = True
+
+    # Rope can check the validity of its object DB when running.
+    prefs['validate_objectdb'] = True
+
+    # How many undos to hold?
+    prefs['max_history_items'] = 32
+
+    # Shows whether to save history across sessions.
+    prefs['save_history'] = True
+    prefs['compress_history'] = False
+
+    # Set the number spaces used for indenting.  According to
+    # :PEP:`8`, it is best to use 4 spaces.  Since most of rope's
+    # unit-tests use 4 spaces it is more reliable, too.
+    prefs['indent_size'] = 4
+
+    # Builtin and c-extension modules that are allowed to be imported
+    # and inspected by rope.
+    prefs['extension_modules'] = []
+
+    # Add all standard c-extensions to extension_modules list.
+    prefs['import_dynload_stdmods'] = True
+
+    # If `True` modules with syntax errors are considered to be empty.
+    # The default value is `False`; When `False` syntax errors raise
+    # `rope.base.exceptions.ModuleSyntaxError` exception.
+    prefs['ignore_syntax_errors'] = False
+
+    # If `True`, rope ignores unresolvable imports.  Otherwise, they
+    # appear in the importing namespace.
+    prefs['ignore_bad_imports'] = False
+
+
+def project_opened(project):
+    """This function is called after opening the project"""
+    # Do whatever you like here!
diff --git a/docs/source/.ropeproject/globalnames b/docs/source/.ropeproject/globalnames
new file mode 100644
index 0000000..ef74498
--- /dev/null
+++ b/docs/source/.ropeproject/globalnames
@@ -0,0 +1,8 @@
+�}q(Uexample3.collapse]q(U
+rootwidgetqUunhandled_inputqU
if_grandchildqUfooterqUtreeqUstreeqUtreeboxq	eUdatetimeq
+]q
(U	timedeltaq
UMAXYEARq
UdateqU
datetime_CAPIqUtzinfoqUtimeqUMINYEARqUdatetimeqeUexample4.filesystem]q(U
FocusableTextqUdtreeqUdecorated_treeqU
root_widgetqhUtbqUas_deep_as_cwdqU
DirectoryTreeqhUcwdq
eUexample2.arrows]q
(Uatreeq
hhh	hheUconf]q(Upygments_styleq Uhtmlhelp_basenameq!U
+html_themeq"U
+master_docq#U
source_suffixq$Utexinfo_documentsq%U	copyrightq&Uexclude_patternsq'Uversionq(U	man_pagesq)Utemplates_pathq*Ulatex_documentsq+Uhtml_static_pathq,Uintersphinx_mappingq-Ulatex_elementsq.Uprojectq/U
+extensionsq0Ureleaseq1eUexample1]q2(hUpaletteq3hhh	hhUconstruct_example_treeq4U&construct_example_simpletree_structureq5eUexample5.nested]q6(hhU	outertreeq7hUanotherinnertreeq8U	innertreeq9h	U
+middletreeq:eUshutilq;]q<(Ucopyfileq=Uignore_patternsq>Ucopytreeq?Uget_archive_formatsq at U
copyfileobjqAUregister_archive_formatqBUcopymodeqCU
make_archiveqDUmoveqEUunregister_archive_formatqFUrmtreeqGUErrorqHUcopyqIU	ExecErrorqJUcopy2qKUSpecialFileErrorqLUcopystatqMU
WindowsErrorqNeUosqO]qP(Upopen4qQUexecleqRUpopen3qSUSEEK_CURqTUspawnlpqUUexeclpqVUenvironqWUspawnvpqXUspawnlqYUexecvpqZUmakedirsq[Ulinesepq\UP_WAITq]Uspawnvq^Uspawnveq_Uexecvpeq`UunsetenvqaU [...]
+removedirsqmUrenamesqnUspawnvpeqoUexeclpeqpeu.
\ No newline at end of file
diff --git a/docs/source/.ropeproject/history b/docs/source/.ropeproject/history
new file mode 100644
index 0000000..fcd9c96
--- /dev/null
+++ b/docs/source/.ropeproject/history
@@ -0,0 +1 @@
+�]q(]q]qe.
\ No newline at end of file
diff --git a/docs/source/.ropeproject/objectdb b/docs/source/.ropeproject/objectdb
new file mode 100644
index 0000000..29c40cd
--- /dev/null
+++ b/docs/source/.ropeproject/objectdb
@@ -0,0 +1 @@
+�}q.
\ No newline at end of file
diff --git a/docs/source/conf.py b/docs/source/conf.py
new file mode 100644
index 0000000..ebff4ac
--- /dev/null
+++ b/docs/source/conf.py
@@ -0,0 +1,301 @@
+# -*- coding: utf-8 -*-
+#
+# urwidtrees documentation build configuration file, created by
+# sphinx-quickstart on Sun Feb 15 12:24:59 2015.
+#
+# This file is execfile()d with the current directory set to its
+# containing dir.
+#
+# Note that not all possible configuration values are present in this
+# autogenerated file.
+#
+# All configuration values have a default; values that are commented out
+# serve to show the default.
+
+import sys
+import os
+
+
+###############################
+# readthedocs.org hack,
+# needed to use autodocs on their build-servers:
+# http://readthedocs.org/docs/read-the-docs/en/latest/faq.html?highlight=autodocs#where-do-i-need-to-put-my-docs-for-rtd-to-find-it
+
+class Mock(object):
+    def __init__(self, *args, **kwargs):
+        pass
+
+    def __call__(self, *args, **kwargs):
+        return Mock()
+
+    @classmethod
+    def __getattr__(self, name):
+        return Mock() if name not in ('__file__', '__path__') else '/dev/null'
+
+class MockModule(object):
+    @classmethod
+    def __getattr__(self, name):
+        return Mock if name not in ('__file__', '__path__') else '/dev/null'
+
+MOCK_MODULES = [ 'urwid', ]
+MOCK_DIRTY = []
+
+for mod_name in MOCK_MODULES:
+    sys.modules[mod_name] = MockModule()
+for mod_name in MOCK_DIRTY:
+    sys.modules[mod_name] = Mock()
+
+##################################
+
+# If extensions (or modules to document with autodoc) are in another directory,
+# add these directories to sys.path here. If the directory is relative to the
+# documentation root, use os.path.abspath to make it absolute, like shown here.
+#sys.path.insert(0, os.path.abspath('.'))
+sys.path.insert(0, os.path.abspath(os.path.join('..','..')))
+from urwidtrees import __version__,__author__
+
+# -- General configuration ------------------------------------------------
+
+# If your documentation needs a minimal Sphinx version, state it here.
+#needs_sphinx = '1.0'
+
+# Add any Sphinx extension module names here, as strings. They can be
+# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
+# ones.
+extensions = [
+    'sphinx.ext.autodoc',
+    'sphinx.ext.todo',
+    'sphinx.ext.coverage',
+    'sphinx.ext.viewcode',
+    'sphinx.ext.intersphinx',
+]
+
+# Add any paths that contain templates here, relative to this directory.
+templates_path = ['_templates']
+
+# The suffix of source filenames.
+source_suffix = '.rst'
+
+# The encoding of source files.
+#source_encoding = 'utf-8-sig'
+
+# The master toctree document.
+master_doc = 'index'
+
+# General information about the project.
+project = u'urwidtrees'
+copyright = u'2015, Patrick Totzke'
+
+# The version info for the project you're documenting, acts as replacement for
+# |version| and |release|, also used in various other places throughout the
+# built documents.
+#
+# The short X.Y version.
+version = __version__
+# The full version, including alpha/beta/rc tags.
+release = __version__
+
+# The language for content autogenerated by Sphinx. Refer to documentation
+# for a list of supported languages.
+#language = None
+
+# There are two options for replacing |today|: either, you set today to some
+# non-false value, then it is used:
+#today = ''
+# Else, today_fmt is used as the format for a strftime call.
+#today_fmt = '%B %d, %Y'
+
+# List of patterns, relative to source directory, that match files and
+# directories to ignore when looking for source files.
+exclude_patterns = []
+
+# The reST default role (used for this markup: `text`) to use for all
+# documents.
+#default_role = None
+
+# If true, '()' will be appended to :func: etc. cross-reference text.
+#add_function_parentheses = True
+
+# If true, the current module name will be prepended to all description
+# unit titles (such as .. function::).
+#add_module_names = True
+
+# If true, sectionauthor and moduleauthor directives will be shown in the
+# output. They are ignored by default.
+#show_authors = False
+
+# The name of the Pygments (syntax highlighting) style to use.
+pygments_style = 'sphinx'
+
+# A list of ignored prefixes for module index sorting.
+#modindex_common_prefix = []
+
+# If true, keep warnings as "system message" paragraphs in the built documents.
+#keep_warnings = False
+
+
+# -- Options for HTML output ----------------------------------------------
+
+# The theme to use for HTML and HTML Help pages.  See the documentation for
+# a list of builtin themes.
+html_theme = 'default'
+
+# Theme options are theme-specific and customize the look and feel of a theme
+# further.  For a list of options available for each theme, see the
+# documentation.
+#html_theme_options = {}
+
+# Add any paths that contain custom themes here, relative to this directory.
+#html_theme_path = []
+
+# The name for this set of Sphinx documents.  If None, it defaults to
+# "<project> v<release> documentation".
+#html_title = None
+
+# A shorter title for the navigation bar.  Default is the same as html_title.
+#html_short_title = None
+
+# The name of an image file (relative to this directory) to place at the top
+# of the sidebar.
+#html_logo = None
+
+# The name of an image file (within the static path) to use as favicon of the
+# docs.  This file should be a Windows icon file (.ico) being 16x16 or 32x32
+# pixels large.
+#html_favicon = None
+
+# Add any paths that contain custom static files (such as style sheets) here,
+# relative to this directory. They are copied after the builtin static files,
+# so a file named "default.css" will overwrite the builtin "default.css".
+html_static_path = ['_static']
+
+# Add any extra paths that contain custom files (such as robots.txt or
+# .htaccess) here, relative to this directory. These files are copied
+# directly to the root of the documentation.
+#html_extra_path = []
+
+# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
+# using the given strftime format.
+#html_last_updated_fmt = '%b %d, %Y'
+
+# If true, SmartyPants will be used to convert quotes and dashes to
+# typographically correct entities.
+#html_use_smartypants = True
+
+# Custom sidebar templates, maps document names to template names.
+#html_sidebars = {}
+
+# Additional templates that should be rendered to pages, maps page names to
+# template names.
+#html_additional_pages = {}
+
+# If false, no module index is generated.
+#html_domain_indices = True
+
+# If false, no index is generated.
+#html_use_index = True
+
+# If true, the index is split into individual pages for each letter.
+#html_split_index = False
+
+# If true, links to the reST sources are added to the pages.
+#html_show_sourcelink = True
+
+# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
+#html_show_sphinx = True
+
+# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
+#html_show_copyright = True
+
+# If true, an OpenSearch description file will be output, and all pages will
+# contain a <link> tag referring to it.  The value of this option must be the
+# base URL from which the finished HTML is served.
... 1885 lines suppressed ...

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/python-urwidtrees.git



More information about the Python-modules-commits mailing list