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
tev
plugin_event
Commits
2072abf1
Commit
2072abf1
authored
Jun 28, 2012
by
LE GAC Renaud
Browse files
Customize grids by adding filter.
parent
e590b2ed
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
156 additions
and
42 deletions
+156
-42
languages/fr-fr.py
languages/fr-fr.py
+58
-34
models/db.py
models/db.py
+2
-2
models/widgets.py
models/widgets.py
+96
-6
No files found.
languages/fr-fr.py
View file @
2072abf1
# coding: utf8
{
'%Y-%m-%d'
:
'%Y-%m-%d'
,
'Birth Date'
:
'
Birth Dat
e'
,
'Category'
:
'Cat
e
gor
y
'
,
'Birth Date'
:
'
Né l
e'
,
'Category'
:
'Cat
é
gor
ie
'
,
'Code'
:
'Code'
,
'Collections'
:
'Collections'
,
'Controller'
:
'Controller'
,
'Cost'
:
'Cost'
,
'Definition'
:
'Definition'
,
'Demanded'
:
'Demanded'
,
'End Date'
:
'End Date'
,
'Executed'
:
'Executed'
,
'First Name'
:
'First Name'
,
'Forms'
:
'Forms'
,
'Cost'
:
'Coût'
,
'Definition'
:
'Définition'
,
'Demanded'
:
'Demandé'
,
'End Date'
:
'Date de fin'
,
'Executed'
:
'Executé'
,
'Filter budgets'
:
'Filter budgets'
,
'Filter careers'
:
'Filter careers'
,
'Filter hardware'
:
'Filter hardware'
,
'Filter people'
:
'Filter people'
,
'Filter responsabilities'
:
'Filter responsabilities'
,
'First Name'
:
'Nom de famille'
,
'Forms'
:
'Formulaire'
,
'Grade'
:
'Grade'
,
'Hdr'
:
'Hdr'
,
'Hdr Date'
:
'Hdr Date'
,
'Hdr defense date'
:
"Date de soutenace de l'hdr"
,
'Host'
:
'Host'
,
'Id'
:
'Id'
,
'Initials'
:
'Initials'
,
'Last Name'
:
'
Last Name
'
,
'Level'
:
'
Level
'
,
'Line'
:
'Line'
,
'Initials'
:
'Initial
e
s'
,
'Last Name'
:
'
Prénom
'
,
'Level'
:
'
Niveau
'
,
'Line'
:
'Li
g
ne'
,
'Max Records'
:
'Max Records'
,
'Model'
:
'Mode
l
'
,
'Name'
:
'N
ame
'
,
'Model'
:
'Mod
èl
e'
,
'Name'
:
'N
om
'
,
'Note'
:
'Note'
,
'Notified'
:
'Notified'
,
'Organization'
:
'Organization'
,
'Percentage'
:
'Percentage'
,
'Person'
:
'Person'
,
'Notified'
:
'Notifié'
,
'Organization'
:
'Organisation'
,
'Percentage'
:
'Pourcentage'
,
'Period'
:
'Periode'
,
'Person'
:
'Persone'
,
'PhD'
:
'PhD'
,
'Phd'
:
'Phd'
,
'Phd Date'
:
'Phd Date'
,
'Project'
:
'Project'
,
'Phd defense date'
:
'Date de la soutenance de la thèse'
,
'Project'
:
'Projet'
,
'Ratio'
:
'Ratio'
,
'Select'
:
'Select'
,
'Start Date'
:
'
Start Date
'
,
'Select'
:
'Select
ionnez
'
,
'Start Date'
:
'
Date de début
'
,
'Store'
:
'Store'
,
'Tables'
:
'Tables'
,
'Team'
:
'
Team
'
,
'Tools'
:
'
Too
ls'
,
'Year'
:
'
Year
'
,
'Team'
:
'
Équipe
'
,
'Tools'
:
'
Outi
ls'
,
'Year'
:
'
Année
'
,
'Year End'
:
'Year End'
,
'Year Start'
:
'Year Start'
,
'budgets'
:
'budgets'
,
'careers'
:
'car
eer
s'
,
'categories'
:
'cat
e
gories'
,
'careers'
:
'car
rière
s'
,
'categories'
:
'cat
é
gories'
,
'enter a number between %(min)g and %(max)g'
:
'enter a number between %(min)g and %(max)g'
,
'enter an integer between %(min)g and %(max)g'
:
'enter an integer between %(min)g and %(max)g'
,
'hardware'
:
'hardware'
,
'harvesters'
:
'harvesters'
,
'levels'
:
'levels'
,
'organizations'
:
'organizations'
,
'people'
:
'people'
,
'projects'
:
'projects'
,
'responsabilities'
:
'responsabilities'
,
'teams'
:
'teams'
,
'undefined'
:
'undefined'
,
'levels'
:
'niveaux'
,
'organizations'
:
'organisations'
,
'people'
:
'personnel'
,
'projects'
:
'projets'
,
'responsabilities'
:
'responsabilités'
,
'select entries for the category'
:
'select entries for the category'
,
'select entries for the level'
:
'select entries for the level'
,
'select entries for the organization'
:
'select entries for the organization'
,
'select entries for the person'
:
'select entries for the person'
,
'select entries for the project'
:
'select entries for the project'
,
'select entries for the team'
:
'select entries for the team'
,
'select entries for the year'
:
'select entries for the year'
,
'select entries where family name contains'
:
'select entries where family name contains'
,
'select entries where first name contains'
:
'select entries where first name contains'
,
'select entries where initials contains'
:
'select entries where initials contains'
,
'select entries where line contains'
:
'select entries where line contains'
,
'select people for the category'
:
'select people for the category'
,
'select people for the project'
:
'select people for the project'
,
'select people for the team'
:
'select people for the team'
,
'select people with a first name containing'
:
'select people with a first name containing'
,
'teams'
:
'équipes'
,
'undefined'
:
'undéfini'
,
}
models/db.py
View file @
2072abf1
...
...
@@ -73,8 +73,8 @@ db.define_table("people",
Field
(
"birth_date"
,
"date"
),
Field
(
"phd"
,
"boolean"
,
default
=
False
),
Field
(
"hdr"
,
"boolean"
,
default
=
False
),
Field
(
"phd_date"
,
"date"
),
Field
(
"hdr_date"
,
"date"
),
Field
(
"phd_date"
,
"date"
,
comment
=
T
(
"Phd defense date"
)
),
Field
(
"hdr_date"
,
"date"
,
comment
=
T
(
"Hdr defense date"
)
),
migrate
=
"people.table"
)
db
.
define_table
(
"organizations"
,
...
...
models/widgets.py
View file @
2072abf1
...
...
@@ -14,11 +14,101 @@ dbui.configure_grids(db, plugins=['pGridRowEditorConfirmDelete',
dbui
.
configure_forms
(
db
,
plugins
=
[
'pFormToolTip'
])
#
#
The form node of the navigation tree
#
merge date fields in the careers/hardware/responsabilites forms
#
formNode
=
dbui
.
Node
(
T
(
'Forms'
))
configurator
=
lambda
tablename
:
dbui
.
to_formPanel
(
db
[
tablename
])
formNode
.
add_children
(
db
.
tables
,
func
=
configurator
)
for
table
in
(
'careers'
,
'hardware'
,
'responsabilities'
):
fieldsModifier
=
dbui
.
FieldsModifier
(
table
)
fieldsModifier
.
configure_field
(
'start_date'
,
flex
=
1
)
fieldsModifier
.
configure_field
(
'end_date'
,
flex
=
1
)
fieldsModifier
.
merge_fields
(
'start_date'
,
'end_date'
,
fieldLabel
=
T
(
'Period'
))
#
# merge phd and fields
#
fieldsModifier
=
dbui
.
FieldsModifier
(
'people'
)
fieldsModifier
.
configure_field
(
'phd'
,
flex
=
0.1
)
fieldsModifier
.
configure_field
(
'phd_date'
,
flex
=
1
)
fieldsModifier
.
merge_fields
(
'phd'
,
'phd_date'
,
fieldLabel
=
T
(
'Phd'
))
fieldsModifier
.
configure_field
(
'hdr'
,
flex
=
0.1
)
fieldsModifier
.
configure_field
(
'hdr_date'
,
flex
=
1
)
fieldsModifier
.
merge_fields
(
'hdr'
,
'hdr_date'
,
fieldLabel
=
T
(
'Hdr'
))
#
# customized grid budgets
#
gridModifier
=
dbui
.
GridModifier
(
'budgets'
)
gridModifier
.
set_rownumbering
()
filters
=
[(
'year'
,
'=='
,
T
(
'select entries for the year'
)),
(
'id_people'
,
'=='
,
T
(
'select entries for the person'
)),
(
'id_teams'
,
'=='
,
T
(
'select entries for the team'
)),
(
'id_projects'
,
'=='
,
T
(
'select entries for the project'
)),
(
'line'
,
'contains'
,
T
(
'select entries where line contains'
))]
gridModifier
.
set_filters
(
*
filters
,
plugins
=
[
'pFormToolTip'
],
width
=
300
)
#
# customized grid careers
#
gridModifier
=
dbui
.
GridModifier
(
'careers'
)
gridModifier
.
set_rownumbering
()
filters
=
[(
'id_people'
,
'=='
,
T
(
'select entries for the person'
)),
(
'id_teams'
,
'=='
,
T
(
'select entries for the team'
)),
(
'id_projects'
,
'=='
,
T
(
'select entries for the project'
)),
(
'id_categories'
,
'=='
,
T
(
'select entries for the category'
))]
gridModifier
.
set_filters
(
*
filters
,
plugins
=
[
'pFormToolTip'
],
width
=
300
)
#
# customized grid hardware
#
gridModifier
=
dbui
.
GridModifier
(
'hardware'
)
gridModifier
.
set_rownumbering
()
filters
=
[(
'id_people'
,
'=='
,
T
(
'select entries for the person'
)),
(
'id_teams'
,
'=='
,
T
(
'select entries for the team'
)),
(
'id_projects'
,
'=='
,
T
(
'select entries for the project'
))]
gridModifier
.
set_filters
(
*
filters
,
plugins
=
[
'pFormToolTip'
],
width
=
300
)
#
# customized grid people
#
gridModifier
=
dbui
.
GridModifier
(
'people'
)
gridModifier
.
set_rownumbering
()
#filters = [('first_name', 'contains', T('select entries where first name contains')),
#('last_name', 'contains', T('select entries where family name contains')),
#('initials', 'contains', T('select entries where initials contains'))]
#gridModifier.set_filters(*filters,
#plugins=['pFormToolTip'],
#width=300)
#
# customized grid responsabilities
#
gridModifier
=
dbui
.
GridModifier
(
'responsabilities'
)
gridModifier
.
set_rownumbering
()
filters
=
[(
'id_people'
,
'=='
,
T
(
'select entries for the person'
)),
(
'id_teams'
,
'=='
,
T
(
'select entries for the team'
)),
(
'id_projects'
,
'=='
,
T
(
'select entries for the project'
)),
(
'id_organizations'
,
'=='
,
T
(
'select entries for the organization'
)),
(
'id_levels'
,
'=='
,
T
(
'select entries for the level'
))]
gridModifier
.
set_filters
(
*
filters
,
plugins
=
[
'pFormToolTip'
],
width
=
300
)
#
# The grid node of the navigation tree
...
...
@@ -31,10 +121,10 @@ gridNode.add_children(db.tables, func=configurator)
# The tool node of the navigation tree
#
toolNode
=
dbui
.
Node
(
T
(
'Tools'
))
#
toolNode.sort_children()
toolNode
.
sort_children
()
#
# The viewport with its navigation tree
#
viewportModifier
=
dbui
.
ViewportModifier
()
viewportModifier
.
add_node
(
formNode
,
gridNode
,
toolNode
)
viewportModifier
.
add_node
(
gridNode
,
toolNode
)
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