From 8837483973f4fae64e46c66a490475de0af1433f Mon Sep 17 00:00:00 2001
From: Renaud Le Gac <legac@cppm.in2p3.fr>
Date: Fri, 17 Apr 2015 13:06:03 +0200
Subject: [PATCH] Review navtree.py documentation.

---
 .../plugin_dbui.navtree.Node.add_child.rst    |  6 ++++
 .../plugin_dbui.navtree.Node.add_children.rst |  6 ++++
 .../plugin_dbui.navtree.Node.get_node.rst     |  6 ++++
 ...plugin_dbui.navtree.Node.sort_children.rst |  6 ++++
 .../generated/plugin_dbui.navtree.Node.rst    | 21 ++++++++++++
 docs/api/user_interface.rst                   | 17 ++++++----
 modules/plugin_dbui/navtree.py                | 34 +++++++++++--------
 7 files changed, 74 insertions(+), 22 deletions(-)
 create mode 100644 docs/api/generated/navtree/plugin_dbui.navtree.Node.add_child.rst
 create mode 100644 docs/api/generated/navtree/plugin_dbui.navtree.Node.add_children.rst
 create mode 100644 docs/api/generated/navtree/plugin_dbui.navtree.Node.get_node.rst
 create mode 100644 docs/api/generated/navtree/plugin_dbui.navtree.Node.sort_children.rst
 create mode 100644 docs/api/generated/plugin_dbui.navtree.Node.rst

diff --git a/docs/api/generated/navtree/plugin_dbui.navtree.Node.add_child.rst b/docs/api/generated/navtree/plugin_dbui.navtree.Node.add_child.rst
new file mode 100644
index 00000000..881a3adb
--- /dev/null
+++ b/docs/api/generated/navtree/plugin_dbui.navtree.Node.add_child.rst
@@ -0,0 +1,6 @@
+plugin_dbui.navtree.Node.add_child
+==================================
+
+.. currentmodule:: plugin_dbui.navtree
+
+.. automethod:: Node.add_child
\ No newline at end of file
diff --git a/docs/api/generated/navtree/plugin_dbui.navtree.Node.add_children.rst b/docs/api/generated/navtree/plugin_dbui.navtree.Node.add_children.rst
new file mode 100644
index 00000000..c718da0c
--- /dev/null
+++ b/docs/api/generated/navtree/plugin_dbui.navtree.Node.add_children.rst
@@ -0,0 +1,6 @@
+plugin_dbui.navtree.Node.add_children
+=====================================
+
+.. currentmodule:: plugin_dbui.navtree
+
+.. automethod:: Node.add_children
\ No newline at end of file
diff --git a/docs/api/generated/navtree/plugin_dbui.navtree.Node.get_node.rst b/docs/api/generated/navtree/plugin_dbui.navtree.Node.get_node.rst
new file mode 100644
index 00000000..f188393a
--- /dev/null
+++ b/docs/api/generated/navtree/plugin_dbui.navtree.Node.get_node.rst
@@ -0,0 +1,6 @@
+plugin_dbui.navtree.Node.get_node
+=================================
+
+.. currentmodule:: plugin_dbui.navtree
+
+.. automethod:: Node.get_node
\ No newline at end of file
diff --git a/docs/api/generated/navtree/plugin_dbui.navtree.Node.sort_children.rst b/docs/api/generated/navtree/plugin_dbui.navtree.Node.sort_children.rst
new file mode 100644
index 00000000..47204a79
--- /dev/null
+++ b/docs/api/generated/navtree/plugin_dbui.navtree.Node.sort_children.rst
@@ -0,0 +1,6 @@
+plugin_dbui.navtree.Node.sort_children
+======================================
+
+.. currentmodule:: plugin_dbui.navtree
+
+.. automethod:: Node.sort_children
\ No newline at end of file
diff --git a/docs/api/generated/plugin_dbui.navtree.Node.rst b/docs/api/generated/plugin_dbui.navtree.Node.rst
new file mode 100644
index 00000000..cd958b23
--- /dev/null
+++ b/docs/api/generated/plugin_dbui.navtree.Node.rst
@@ -0,0 +1,21 @@
+plugin_dbui.navtree.Node
+========================
+
+.. currentmodule:: plugin_dbui.navtree
+
+.. autoclass:: Node
+
+   .. rubric:: Methods
+
+   .. autosummary::
+      :toctree: navtree/
+
+      ~Node.add_child
+      ~Node.add_children
+      ~Node.get_node
+      ~Node.sort_children
+
+
+
+
+
diff --git a/docs/api/user_interface.rst b/docs/api/user_interface.rst
index 0e7cdb91..a6051430 100644
--- a/docs/api/user_interface.rst
+++ b/docs/api/user_interface.rst
@@ -43,6 +43,16 @@ Grid
     configure_grids
     GridModifier
 
+Node
+^^^^
+
+.. currentmodule:: plugin_dbui.navtree
+
+.. autosummary::
+    :toctree: generated/
+
+    Node
+
 Store
 ^^^^^
 
@@ -57,13 +67,6 @@ Store
 Viewport
 ^^^^^^^^
 
-.. currentmodule:: plugin_dbui.navtree
-
-.. autosummary::
-    :toctree: generated/
-
-    Node
-
 .. currentmodule:: plugin_dbui.viewportmodifier
 
 .. autosummary::
diff --git a/modules/plugin_dbui/navtree.py b/modules/plugin_dbui/navtree.py
index 66080d92..25c027ed 100644
--- a/modules/plugin_dbui/navtree.py
+++ b/modules/plugin_dbui/navtree.py
@@ -7,23 +7,22 @@ from gluon import current
 
 
 class Node(object):
-    """The ``node`` is the key element of the navigation tree.
+    """The *node* is the key element of the navigation tree.
     It contains children (leaves) which are associated to widgets.
     The widget will be display on the panel of the *Viewport*.
 
+    Args:
+        text (str): name of the node appearing in the viewport
+            navigation tree.
+
     Attributes:
-        text (str)
-        children (list)
-        hidden (list)
+        text (str): name of the node
+        children (list): list of children
+        hidden (list): list of children to be hidden
 
     """
     def __init__(self, text):
-        """Construct the node.
-
-        Args:
-            text (str): name of the node appearing in the viewport
 
-        """
         self.text = text
         self.children = []
         self.hidden = []
@@ -49,14 +48,14 @@ class Node(object):
         """Add children (leaves) to the node.
 
         Args:
-            leaves (list): a list of string
+            leaves (list): names of the leaves
 
             func (function):
-                function translating the leaf name into
+                function mapping the leaf name to
                 the Ext JS configuration options dictionary.
                 The latter defines the associated widget.
 
-            hidden (list): list of children to be hidden.
+            hidden (list): list of children to be ignored.
 
         Note:
             * Leaf names are translated in the current language
@@ -89,9 +88,14 @@ class Node(object):
 
         Returns:
             dict:
-                * ``text`` (str): name of the node
-                * ``children`` (list): list of dictionary containing
-                  Ext JS configuration for the widgets associated to the leaves.
+                * **text** (str): name of the node
+                * **children** (list): list of leaves. Each element is
+                  a dictionary with three keys:
+
+                      * **cfg** (dict): configuration for the widgets
+                        associated to the leaf.
+                      * **leave** (bool): always ``True``.
+                      * **text** (str): name of the leaf
 
         """
         return {'text': self.text, 'children': self.children}
-- 
GitLab