Skip to content
Snippets Groups Projects
Commit f337b1b4 authored by LE GAC Renaud's avatar LE GAC Renaud
Browse files

Review viewport.py documentation.

parent f5c96641
No related branches found
No related tags found
No related merge requests found
plugin_dbui.viewportmodifier.ViewportModifier
=============================================
.. currentmodule:: plugin_dbui.viewportmodifier
.. autoclass:: ViewportModifier
:show-inheritance:
.. rubric:: Methods
.. autosummary::
:toctree: viewportmodifier/
~ViewportModifier.add_node
~ViewportModifier.configure
~ViewportModifier.default_node
plugin_dbui.viewportmodifier.ViewportModifier.add_node
======================================================
.. currentmodule:: plugin_dbui.viewportmodifier
.. automethod:: ViewportModifier.add_node
\ No newline at end of file
plugin_dbui.viewportmodifier.ViewportModifier.configure
=======================================================
.. currentmodule:: plugin_dbui.viewportmodifier
.. automethod:: ViewportModifier.configure
\ No newline at end of file
plugin_dbui.viewportmodifier.ViewportModifier.default_node
==========================================================
.. currentmodule:: plugin_dbui.viewportmodifier
.. automethod:: ViewportModifier.default_node
\ No newline at end of file
......@@ -13,38 +13,27 @@ MODIFIER_VIEWPORTS = 'modifier_viewports'
class ViewportModifier(Modifier):
"""Modifier to customize the viewport widget of the application.
"""Customise the viewport, the main application widget.
Attributes:
data.default (str):
data.nodes (list):
data (gluon.storage.Storage): storage containing the
instructions to tune the viewport widget. It has
three keys/attributes:
"""
def __init__(self):
"""Initialize the viewport modifier associated to the application.
The persistent data structure of the viewport modifier can be access
outside the class::
p = PluginManager('dbui')
modifier = p.dbui['modifier_viewports']
or internally via the attribute ``data``.
* **extjs** (dict): Ext JS configuration options
for ``Ext.container.Viewport`` widget.
The keys of the ``data`` structure are:
* ``default`` (list) list of node defining the path of the node
which will be opened at start up. Each node is identify its
* **default** (list): list of string defining the path of the node
which will be opened at start up. Each node is identify its
``text`` string.
* ``extjs`` (dict) Ext JS configuration options for the
viewport widget.
* **nodes** (list): list of :class:`.Node`
defining the navigation tree.
* ``nodes`` (list) list of :class:`.Node`
defining the navigation tree
"""
def __init__(self):
"""
Modifier.__init__(self, MODIFIER_VIEWPORTS)
if 'default' not in self.data:
......@@ -55,20 +44,17 @@ class ViewportModifier(Modifier):
def add_node(self, *args):
"""Add a list of :class:`.Node`
to the navigation tree.
"""Add a list of :class:`.Node` to the navigation tree.
Args:
args (list): list of :class:`.Node`
args (list): variable list of :class:`.Node`
Note:
Elements of the list equal to ``None`` are ignored.
This feature is useful when the list of nodes depend on user role.
Raises:
ViewportModifierException:
at least one element of the list
is not a ``Node`` or ``None``.
ViewportModifierException: when at least one element
of the list is not a :class:`.Node` or ``None``.
"""
li = []
......@@ -90,7 +76,8 @@ class ViewportModifier(Modifier):
"""Defined the node which will be opened at start up.
Args:
args (list): nodes identified by their ``text`` string.
args (list): variable list of string defining the
path of the leaf.
"""
self.data.default = args
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment