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' ...@@ -13,38 +13,27 @@ MODIFIER_VIEWPORTS = 'modifier_viewports'
class ViewportModifier(Modifier): class ViewportModifier(Modifier):
"""Modifier to customize the viewport widget of the application. """Customise the viewport, the main application widget.
Attributes: Attributes:
data.default (str): data (gluon.storage.Storage): storage containing the
data.nodes (list): instructions to tune the viewport widget. It has
three keys/attributes:
""" * **extjs** (dict): Ext JS configuration options
for ``Ext.container.Viewport`` widget.
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``.
The keys of the ``data`` structure are: * **default** (list): list of string defining the path of the node
which will be opened at start up. Each node is identify its
* ``default`` (list) list of node defining the path of the node
which will be opened at start up. Each node is identify its
``text`` string. ``text`` string.
* ``extjs`` (dict) Ext JS configuration options for the * **nodes** (list): list of :class:`.Node`
viewport widget. defining the navigation tree.
* ``nodes`` (list) list of :class:`.Node` """
defining the navigation tree
def __init__(self):
"""
Modifier.__init__(self, MODIFIER_VIEWPORTS) Modifier.__init__(self, MODIFIER_VIEWPORTS)
if 'default' not in self.data: if 'default' not in self.data:
...@@ -55,20 +44,17 @@ class ViewportModifier(Modifier): ...@@ -55,20 +44,17 @@ class ViewportModifier(Modifier):
def add_node(self, *args): def add_node(self, *args):
"""Add a list of :class:`.Node` """Add a list of :class:`.Node` to the navigation tree.
to the navigation tree.
Args: Args:
args (list): list of :class:`.Node` args (list): variable list of :class:`.Node`
Note: Note:
Elements of the list equal to ``None`` are ignored. Elements of the list equal to ``None`` are ignored.
This feature is useful when the list of nodes depend on user role.
Raises: Raises:
ViewportModifierException: ViewportModifierException: when at least one element
at least one element of the list of the list is not a :class:`.Node` or ``None``.
is not a ``Node`` or ``None``.
""" """
li = [] li = []
...@@ -90,7 +76,8 @@ class ViewportModifier(Modifier): ...@@ -90,7 +76,8 @@ class ViewportModifier(Modifier):
"""Defined the node which will be opened at start up. """Defined the node which will be opened at start up.
Args: 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 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