Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
plugin_dbui
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
w2pext
plugin_dbui
Commits
1f5accd1
Commit
1f5accd1
authored
13 years ago
by
tux091
Browse files
Options
Downloads
Patches
Plain Diff
Backport the 0.5.x syntax for the GridModifier.
parent
b927d41c
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
models/db_widgets.py
+34
-29
34 additions, 29 deletions
models/db_widgets.py
modules/plugin_dbui/cfgsvc.py
+1
-1
1 addition, 1 deletion
modules/plugin_dbui/cfgsvc.py
modules/plugin_dbui/gridmodifier.py
+13
-20
13 additions, 20 deletions
modules/plugin_dbui/gridmodifier.py
with
48 additions
and
50 deletions
models/db_widgets.py
+
34
−
29
View file @
1f5accd1
...
...
@@ -111,7 +111,7 @@ formModifier.configure(buttonAlign='right',
defaults
=
{
'
height
'
:
320
})
#
#
Modify
the publications grid
#
Define a column template for
the publications grid
#
tpl
=
[
'
<b>{PublicationsTitle}</b><br>
'
,
'
{PublicationsAuthors}
'
,
...
...
@@ -139,35 +139,40 @@ tpl = ['<b>{PublicationsTitle}</b><br>',
'
<br>Auteurs CPPM : {PublicationsAuthors_cppm}
'
]
gridModifier
=
dbui
.
GridModifier
(
'
publications
'
)
gridModifier
.
merge_columns
(
'
title
'
,
'
authors
'
,
'
id_collaborations
'
,
'
id_publishers
'
,
'
doi
'
,
'
volume
'
,
'
first_page
'
,
'
last_page
'
,
'
e_print
'
,
'
conference_title
'
,
'
conference_url
'
,
'
conference_start
'
,
'
conference_end
'
,
'
conference_town
'
,
'
id_countries
'
,
'
conference_speaker
'
,
'
report_numbers
'
,
'
id_reports
'
,
'
authors_cppm
'
,
autohide
=
True
,
header
=
T
(
'
Publication
'
),
position
=
0
,
tpl
=
tpl
,
width
=
700
)
#
# Setup a filter panel for the publication grid
#
filters
=
[(
'
year
'
,
'
==
'
,
T
(
'
select publication for a given year
'
)),
(
'
id_teams
'
,
'
==
'
,
T
(
'
select publications for a given team
'
)),
(
'
id_projects
'
,
'
==
'
,
T
(
'
select publications for a given project
'
)),
(
'
id_categories_aeres
'
,
'
==
'
,
T
(
'
select publications with a given AERES code
'
)),
(
'
authors_cppm
'
,
'
contains
'
,
T
(
'
select publications for a given CPPM author
'
)),
]
gm
=
dbui
.
GridModifier
(
'
publications
'
)
gm
.
merge_columns
(
'
title
'
,
'
authors
'
,
'
id_collaborations
'
,
'
id_publishers
'
,
'
doi
'
,
'
volume
'
,
'
first_page
'
,
'
last_page
'
,
'
e_print
'
,
'
conference_title
'
,
'
conference_url
'
,
'
conference_start
'
,
'
conference_end
'
,
'
conference_town
'
,
'
id_countries
'
,
'
conference_speaker
'
,
'
report_numbers
'
,
'
id_reports
'
,
'
authors_cppm
'
,
autohide
=
True
,
position
=
0
,
extjs
=
{
'
header
'
:
T
(
'
Publication
'
),
'
tpl
'
:
tpl
,
'
width
'
:
700
})
gm
.
set_filters
(
*
filters
,
extjs
=
{
'
width
'
:
300
})
(
'
authors_cppm
'
,
'
contains
'
,
T
(
'
select publications for a given CPPM author
'
))]
gridModifier
.
set_filters
(
*
filters
,
width
=
300
)
This diff is collapsed.
Click to expand it.
modules/plugin_dbui/cfgsvc.py
+
1
−
1
View file @
1f5accd1
...
...
@@ -362,7 +362,7 @@ class CfgSvc(BaseSvc):
di
[
'
items
'
].
append
(
cfg
)
# user configuration options for Ext.form
;
FieldSet
# user configuration options for Ext.form
.
FieldSet
di
.
update
(
grid_filters
.
extjs
)
return
di
...
...
This diff is collapsed.
Click to expand it.
modules/plugin_dbui/gridmodifier.py
+
13
−
20
View file @
1f5accd1
...
...
@@ -12,7 +12,6 @@ from modifier import Modifier
GRID_MODIFIERS
=
'
grid_modifiers
'
MSG_EXTJS_MISSING
=
'
keyword argument extjs is missing
'
MSG_HEADER_MISSING
=
'
configuration option header is missing in extjs
'
MSG_INVALID_KEYWORD
=
'
invalid keyword %s
'
MSG_POSITION_MISSING
=
'
keyword argument position is missing
'
...
...
@@ -115,27 +114,23 @@ class GridModifier(Modifier):
of the underlying Ext.grid.TemplateColumn
"""
keywords
=
[
'
autohide
'
,
'
extjs
'
,
'
position
'
]
for
el
in
keywords
:
if
el
not
in
keywords
:
raise
GridModifierException
(
MSG_INVALID_KEYWORD
%
el
)
keywords
=
[
'
autohide
'
,
'
position
'
]
extjs
=
dict
(
kwargs
)
for
key
in
keywords
:
if
key
in
extjs
:
del
extjs
[
key
]
if
'
position
'
not
in
kwargs
:
raise
GridModifierException
(
MSG_POSITION_MISSING
)
if
'
extjs
'
not
in
kwargs
:
raise
GridModifierException
(
MSG_EXTJS_MISSING
)
if
'
header
'
not
in
kwargs
[
'
extjs
'
]:
if
'
header
'
not
in
kwargs
:
raise
GridModifierException
(
MSG_HEADER_MISSING
)
if
'
tpl
'
not
in
kwargs
[
'
extjs
'
]
:
if
'
tpl
'
not
in
kwargs
:
raise
GridModifierException
(
MSG_TPL_MISSING
)
di
=
Storage
(
extjs
=
kwargs
[
'
extjs
'
],
position
=
kwargs
[
'
position
'
])
di
=
Storage
(
extjs
=
extjs
,
position
=
kwargs
[
'
position
'
])
self
.
data
.
template_columns
.
append
(
di
)
if
'
autohide
'
in
kwargs
and
kwargs
[
'
autohide
'
]:
...
...
@@ -154,11 +149,9 @@ class GridModifier(Modifier):
the method dbsvc._encode_query
- a string with a comment for the tool tip
The keyword argument extjs is a dictionary containing
the configuration options of the underlying Ext.form.FieldSet.
The keyword argument contains the configuration options for the
underlying Ext.form.FieldSet. For more information see the ExtJS
documentation.
"""
if
'
extjs
'
not
in
kwargs
:
kwargs
[
'
extjs
'
]
=
{}
self
.
data
.
grid_filters
=
Storage
(
filters
=
filters
,
extjs
=
kwargs
[
'
extjs
'
])
self
.
data
.
grid_filters
=
Storage
(
filters
=
filters
,
extjs
=
kwargs
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment