diff --git a/languages/fr-fr.py b/languages/fr-fr.py index d8f6234019c7352b79a834ef0718f0af8f3e9c40..f1a502287cdee95147df86a9e47f38af9e2abf3e 100644 --- a/languages/fr-fr.py +++ b/languages/fr-fr.py @@ -26,6 +26,10 @@ 'Id': 'Id', 'Last Page': 'Dernière Page', 'Max Records': 'Max Records', +'My Date': 'My Date', +'My Int': 'My Int', +'My List': 'My List', +'My String': 'My String', 'Pages': 'Pages', 'Project': 'Projet', 'Projects': 'Projets', @@ -57,6 +61,7 @@ 'publications': 'publications', 'publishers': 'éditeur', 'report_1': 'report_1', +'report_2': 'report_2', 'reports': 'rapports', 'select publication for a given year': 'selectionne les publication pour une année', 'select publications for a given CPPM author': 'selectionne les publications pour un auteur du CPPM', diff --git a/models/widgets.py b/models/widgets.py index b754a334cb5939feefd9653b0381ac4a728099e6..71d67aba53b7327c5586f8883b8518527903a8aa 100755 --- a/models/widgets.py +++ b/models/widgets.py @@ -185,8 +185,10 @@ formNode = dbui.Node(T('Forms'), db.tables, cfgSvc.get_form) gridNode = dbui.Node(T('Tables'), db.tables, cfgSvc.get_grid) reportNode = dbui.Node(T('Reports'), - {'report_1': URL(c="reports", f="report_1")}, - dbui.cfg_configurable_url_panel) + {'report_1': URL(c="reports", f="report_1"), + 'report_2': URL(c="reports", f="report_1")}, + dbui.cfg_url_panel, + configurators={'report_2': dbui.cfg_configurable_url_panel}) viewportModifier = dbui.ViewportModifier() viewportModifier.add_node(formNode, gridNode, reportNode) diff --git a/modules/plugin_dbui/navtree.py b/modules/plugin_dbui/navtree.py index cab398ab5c641c2fb07bbead21582384956a7c44..4be6abe41c2b2b356d37f73d1d66fce4a93b81bc 100644 --- a/modules/plugin_dbui/navtree.py +++ b/modules/plugin_dbui/navtree.py @@ -70,8 +70,9 @@ class Node(object): target widget. It is a function getting the leave names, its attributes (dictionary value) and returning a dictionary. + Dedicated configurator can be setup for each node if needed. """ - def __init__(self, text, leaves, configurator, hidden=[]): + def __init__(self, text, leaves, configurator, configurators={}, hidden=[]): """Constructor of the node text @@ -82,11 +83,16 @@ class Node(object): will be used as leaf names configurator + The default configurator apply to all leaves. Reference to a function accepting either a leave name or a leave name and the dictionary value. The function return the configuration dictionary for the ExtJS widget. The function defines the type of widget. - + + configurators + A dictionary with references to configurator. + It can be used to associate a different configurator to + each leaf. The key is the leaf name. hidden List of leaves to be hidden. It contains leaves names @@ -111,15 +117,19 @@ class Node(object): leaf = cvt[tr_leaf] if leaf in hidden: continue + + func = configurator + if leaf in configurators: + func = configurators[leaf] if isinstance(leaves, (list, tuple)): - self.add_children(tr_leaf, configurator(leaf)) + self._add_children(tr_leaf, func(leaf)) elif isinstance(leaves, dict): - self.add_children(tr_leaf, configurator(leaf, leaves[leaf])) + self._add_children(tr_leaf, func(leaf, leaves[leaf])) - def add_children(self, text, cfg): + def _add_children(self, text, cfg): """ Add a child (leaf) to the node. text