Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
w2pext
plugin_dbui
Commits
e178e488
Commit
e178e488
authored
Dec 17, 2011
by
Renaud Le Gac
Browse files
Add the possibility to define individual configurator in Node.
parent
c77a6108
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
7 deletions
+24
-7
languages/fr-fr.py
languages/fr-fr.py
+5
-0
models/widgets.py
models/widgets.py
+4
-2
modules/plugin_dbui/navtree.py
modules/plugin_dbui/navtree.py
+15
-5
No files found.
languages/fr-fr.py
View file @
e178e488
...
...
@@ -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'
,
...
...
models/widgets.py
View file @
e178e488
...
...
@@ -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
)
...
...
modules/plugin_dbui/navtree.py
View file @
e178e488
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment