Skip to content
Snippets Groups Projects
Commit b81db879 authored by legac's avatar legac
Browse files

None node can be added in the ViewportModifier.

parent 85dc8276
No related branches found
No related tags found
No related merge requests found
...@@ -2,6 +2,11 @@ ...@@ -2,6 +2,11 @@
""" widgets viewport """ widgets viewport
""" """
#
# the CAS node
#
casNode = None
# #
# The form node # The form node
# #
...@@ -48,6 +53,6 @@ reportNode.add_child(T('report_3'), leaf_3) ...@@ -48,6 +53,6 @@ reportNode.add_child(T('report_3'), leaf_3)
viewportModifier = dbui.ViewportModifier() viewportModifier = dbui.ViewportModifier()
viewportModifier.append_plugins('pViewportLogin') viewportModifier.append_plugins('pViewportLogin')
viewportModifier.configure(logged=True) viewportModifier.configure(logged=True)
viewportModifier.add_node(helpNode, formNode, gridNode, reportNode) viewportModifier.add_node(helpNode, casNode, formNode, gridNode, reportNode)
viewportModifier.default_node(T('Tables'), T('publications')) viewportModifier.default_node(T('Tables'), T('publications'))
...@@ -50,17 +50,31 @@ class ViewportModifier(Modifier): ...@@ -50,17 +50,31 @@ class ViewportModifier(Modifier):
def add_node(self, *args): def add_node(self, *args):
"""Add L{Node}s to the navigation tree. """Add a list of L{Node}s to the navigation tree.
@type args: L{Node} @type args: list of L{Node}
@param args: @param args:
@note: Elements of the list equal to C{None} are ignored.
This feature is useful when the list of nodes depend on user role.
@raise ViewportModifierException: at least one element of the list
is not a C{Node} or C{None}.
""" """
li = []
for el in args: for el in args:
if not isinstance(el, Node):
if isinstance(el, Node):
li.append(el)
elif el == None:
continue
else:
raise ViewportModifierException(MSG_INVALID_NODE) raise ViewportModifierException(MSG_INVALID_NODE)
self.data.nodes.extend(args) self.data.nodes.extend(li)
def default_node(self, *args): def default_node(self, *args):
......
...@@ -4,6 +4,7 @@ HEAD ...@@ -4,6 +4,7 @@ HEAD
- The viewport can open a tab at startup. - The viewport can open a tab at startup.
- Automatic loggout when the page is refreshed and closed. - Automatic loggout when the page is refreshed and closed.
- In the App.GridPanel a new record is inserted after the selected one. - In the App.GridPanel a new record is inserted after the selected one.
- None node can be added in the ViewportModifier.
0.4.13.2 (Jul 2013) 0.4.13.2 (Jul 2013)
- Table callback _before_delete, _before_insert and _before_update - Table callback _before_delete, _before_insert and _before_update
......
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