Commit e43fba37 authored by LE GAC Renaud's avatar LE GAC Renaud
Browse files

Structure the widgets models and use the new filter methods.

parent db808e39
......@@ -15,12 +15,18 @@
'Demanded': 'Demandé',
'End Date': 'Date de fin',
'Executed': 'Executé',
'Filter budgets': 'Filter budgets',
'Filter careers': 'Filter careers',
'Filter hardware': 'Filter hardware',
'Filter history': 'Filter history',
'Filter people': 'Filter people',
'Filter responsabilities': 'Filter responsabilities',
'Filter agencies': 'Filtrer les agences',
'Filter budgets': 'Filtrer les budgets',
'Filter careers': 'Filtrer les carrières',
'Filter categories': 'Filtrer les catégories',
'Filter hardware': 'Filtrer le matérielle',
'Filter history': "Filtrer l'historique",
'Filter levels': 'Filtrer les niveaus',
'Filter organizations': 'Filtrer les organisations',
'Filter people': 'Filtrer les persones',
'Filter projects': 'Filtrer les projets',
'Filter responsabilities': 'Filtrer les responsabilités',
'Filter teams': 'Filtrer les équipes',
'First Name': 'Prénom',
'Forms': 'Formulaire',
'Grade': 'Grade',
......@@ -28,7 +34,6 @@
'Hdr': 'Hdr',
'Hdr Date': 'Hdr Date',
'Hdr defense date': "Date de soutenace de l'hdr",
'Host': 'Host',
'Id': 'Id',
'Initials': 'Initiales',
'Last Name': 'Nom de famille',
......@@ -60,41 +65,27 @@
'Year': 'Année',
'Year End': 'Year End',
'Year Start': 'Year Start',
'agencies': 'agencies',
'agencies': 'agences',
'budgets': 'budgets',
'careers': 'carrières',
'categories': 'catégories',
'database schema': 'database schema',
'contains': 'contiens',
'database schema': 'schéma de la base de données',
'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',
'enter date as %(format)s': 'enter date as %(format)s',
'hardware': 'hardware',
'harvesters': 'harvesters',
'history': 'history',
'greater or equal to': 'plus grand ou égual à',
'hardware': 'matériel',
'history': 'historique',
'is equal to': 'égal à',
'less or equal to': 'inférieur ou égal à',
'levels': 'niveaux',
'organizations': 'organisations',
'people': 'personnel',
'plugin not install': 'plugin not install',
'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 last name contains': 'select entries where last name contains',
'select entries where line contains': 'select entries where line contains',
'select entries where model contains': 'select entries where model 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 family name containing': 'select people with a family name containing',
'select people with a first name containing': 'select people with a first name containing',
'select...': 'selectionner...',
'startswith': 'startswith',
'teams': 'équipes',
'undefined': 'undéfini',
'unknown': 'unknown',
......
# -*- coding: utf-8 -*-
""" widgets
Customize forms and grids widgets
"""
#
# add plugins to all forms and grids
#
dbui.configure_grids(db, plugins=['pGridRowEditorConfirmDelete',
'pGridRowEditorContextMenu',
'pGridRowEditorDblClick',
'pGridExport'])
dbui.configure_forms(db, plugins=['pFormToolTip'])
#
# merge date fields in the history/hardware/responsabilites forms
#
for table in ('hardware', 'history', '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_flag', flex=0.1)
fieldsModifier.configure_field('phd_date', flex=1)
fieldsModifier.merge_fields('phd_flag', 'phd_date', fieldLabel=T('Phd'))
fieldsModifier.configure_field('hdr_flag', flex=0.1)
fieldsModifier.configure_field('hdr_date', flex=1)
fieldsModifier.merge_fields('hdr_flag', 'hdr_date', fieldLabel=T('Hdr'))
#
# customized grid budgets
#
gridModifier = dbui.GridModifier('budgets')
gridModifier.append_plugins('pGridPaging', 'pGridExport')
gridModifier.set_rownumbering()
filters = [('year', '==', T('select entries for the year')),
('people.last_name', 'contains', T('select entries where last name contains')),
('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 categories
#
gridModifier = dbui.GridModifier('categories')
gridModifier.configure_column('code', width=15)
gridModifier.set_rownumbering()
#
# customized grid hardware
#
gridModifier = dbui.GridModifier('hardware')
gridModifier.append_plugins('pGridPaging', 'pGridExport')
gridModifier.set_rownumbering()
filters = [('people.last_name', 'contains', T('select entries where last name contains')),
('id_teams', '==', T('select entries for the team')),
('id_projects', '==', T('select entries for the project')),
('model', 'contains', T('select entries where model contains'))]
gridModifier.set_filters(*filters,
plugins=['pFormToolTip'],
width=300)
#
# customized grid history
#
gridModifier = dbui.GridModifier('history')
gridModifier.append_plugins('pGridPaging', 'pGridExport')
gridModifier.set_rownumbering()
filters = [('people.last_name', 'contains', T('select entries where last name contains')),
('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 people
#
gridModifier = dbui.GridModifier('people')
gridModifier.configure_column('initials', width=40)
gridModifier.configure_column('phd_flag', width=30)
gridModifier.configure_column('hdr_flag', width=30)
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.append_plugins('pGridPaging', 'pGridExport')
gridModifier.set_rownumbering()
filters = [('people.last_name', 'contains', T('select people with a family name containing')),
('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)
#
# Order the store contents for all tables, combobox, ...
#
storeModifier = dbui.StoreModifier('budgets')
storeModifier.orderby(db.teams.team, db.budgets.year, db.budgets.line)
storeModifier = dbui.StoreModifier('categories')
storeModifier.orderby(db.categories.code)
storeModifier = dbui.StoreModifier('hardware')
storeModifier.orderby(db.people.last_name, db.hardware.start_date)
storeModifier = dbui.StoreModifier('history')
storeModifier.orderby(db.people.last_name, db.history.start_date)
storeModifier = dbui.StoreModifier('levels')
storeModifier.orderby(db.levels.level)
storeModifier = dbui.StoreModifier('organizations')
storeModifier.orderby(db.organizations.organization)
storeModifier = dbui.StoreModifier('people')
storeModifier.orderby(db.people.last_name)
storeModifier = dbui.StoreModifier('projects')
storeModifier.orderby(db.projects.project)
storeModifier = dbui.StoreModifier('responsabilities')
storeModifier.orderby(db.people.last_name, db.responsabilities.start_date)
storeModifier = dbui.StoreModifier('teams')
storeModifier.orderby(db.teams.team)
#
# The grid node of the navigation tree
#
gridNode = dbui.Node(T('Tables'))
configurator = lambda tablename: dbui.to_gridPanel(db[tablename])
gridNode.add_children(db.tables, func=configurator)
#
# The tool node of the navigation tree
#
schemaNode = dbui.Panel(autoLoad='/'+request.application+'/default/schema')
versionNode = dbui.Panel(autoLoad='/'+request.application+'/default/versions')
toolNode = dbui.Node(T('Tools'))
toolNode.add_child(T('database schema'), schemaNode)
toolNode.add_child(T('versions'), versionNode)
toolNode.sort_children()
#
# The viewport with its navigation tree
#
viewportModifier = dbui.ViewportModifier()
viewportModifier.add_node(gridNode, toolNode)
# -*- coding: utf-8 -*-
""" fields widgets
"""
#
# hardware
#
fieldsModifier = dbui.FieldsModifier('hardware')
fieldsModifier.configure_field('start_date', flex=1)
fieldsModifier.configure_field('end_date', flex=1)
fieldsModifier.merge_fields('start_date', 'end_date', fieldLabel=T('Period'))
#
# history
#
fieldsModifier = dbui.FieldsModifier('history')
fieldsModifier.configure_field('start_date', flex=1)
fieldsModifier.configure_field('end_date', flex=1)
fieldsModifier.merge_fields('start_date', 'end_date', fieldLabel=T('Period'))
#
# people
#
fieldsModifier = dbui.FieldsModifier('people')
fieldsModifier.configure_field('phd_flag', flex=0.1)
fieldsModifier.configure_field('phd_date', flex=1)
fieldsModifier.merge_fields('phd_flag', 'phd_date', fieldLabel=T('Phd'))
fieldsModifier.configure_field('hdr_flag', flex=0.1)
fieldsModifier.configure_field('hdr_date', flex=1)
fieldsModifier.merge_fields('hdr_flag', 'hdr_date', fieldLabel=T('Hdr'))
#
# responsibilities
#
fieldsModifier = dbui.FieldsModifier('responsabilities')
fieldsModifier.configure_field('start_date', flex=1)
fieldsModifier.configure_field('end_date', flex=1)
fieldsModifier.merge_fields('start_date', 'end_date', fieldLabel=T('Period'))
# -*- coding: utf-8 -*-
""" widgets forms
"""
#
# plugins for all forms
#
dbui.configure_forms(db, plugins=['pFormToolTip'])
\ No newline at end of file
# -*- coding: utf-8 -*-
""" widgets grids
"""
#
# plugins for all grids
#
dbui.configure_grids(db, plugins=['pGridRowEditorConfirmDelete',
'pGridRowEditorContextMenu',
'pGridRowEditorDblClick',
'pGridExport'])
#
# budgets
#
gridModifier = dbui.GridModifier('budgets')
gridModifier.append_plugins('pGridPaging', 'pGridExport')
gridModifier.set_rownumbering()
gridModifier.append_filter(('year', '==', T('is equal to')))
gridModifier.append_filter(('people.last_name', 'contains', T('contains')))
gridModifier.append_filter(('id_teams', '==', T('is equal to')))
gridModifier.append_filter(('id_projects', '==', T('is equal to')))
gridModifier.append_filter(('line', 'contains', T('contains')))
gridModifier.set_filters(plugins=['pFormToolTip'], width=300)
#
# categories
#
gridModifier = dbui.GridModifier('categories')
gridModifier.configure_column('code', width=15)
gridModifier.set_rownumbering()
#
# hardware
#
gridModifier = dbui.GridModifier('hardware')
gridModifier.append_plugins('pGridPaging', 'pGridExport')
gridModifier.set_rownumbering()
gridModifier.append_filter(('people.last_name', 'contains', T('contains')))
gridModifier.append_filter(('id_teams', '==', T('is equal to')))
gridModifier.append_filter(('id_projects', '==', T('is equal to')))
gridModifier.append_filter(('model', 'contains', T('contains')))
gridModifier.set_filters(plugins=['pFormToolTip'], width=300)
#
# history
#
gridModifier = dbui.GridModifier('history')
gridModifier.append_plugins('pGridPaging', 'pGridExport')
gridModifier.set_rownumbering()
gridModifier.append_filter(('people.last_name', 'contains', T('contains')))
gridModifier.append_filter(('id_teams', '==', T('is equal to')))
gridModifier.append_filter(('id_projects', '==', T('is equal to')))
gridModifier.append_filter(('id_categories', '==', T('is equal to')))
gridModifier.append_filter(('start_date', '>=', T('greater or equal to')))
gridModifier.append_filter(('end_date', '<=', T('less or equal to')))
gridModifier.set_filters(plugins=['pFormToolTip'], width=300)
#
# people
#
gridModifier = dbui.GridModifier('people')
gridModifier.configure_column('initials', width=40)
gridModifier.configure_column('phd_flag', width=30)
gridModifier.configure_column('hdr_flag', width=30)
gridModifier.set_rownumbering()
gridModifier.append_filter(('first_name', 'startswith', T('startswith')))
gridModifier.append_filter(('last_name', 'startswith', T('startswith')))
gridModifier.append_filter(('initials', 'startswith', T('startswith')))
gridModifier.set_filters(plugins=['pFormToolTip'], width=300)
#
# responsibilities
#
gridModifier = dbui.GridModifier('responsabilities')
gridModifier.append_plugins('pGridPaging', 'pGridExport')
gridModifier.set_rownumbering()
gridModifier.append_filter(('people.last_name', 'contains', T('contains')))
gridModifier.append_filter(('id_teams', '==', T('is equal to')))
gridModifier.append_filter(('id_projects', '==', T('is equal to')))
gridModifier.append_filter(('id_organizations', '==', T('is equal to')))
gridModifier.append_filter(('id_levels', '==', T('is equal to')))
gridModifier.set_filters(plugins=['pFormToolTip'], width=300)
\ No newline at end of file
# -*- coding: utf-8 -*-
""" widgets stores
"""
#
# Order the store contents for technicall table
#
storeModifier = dbui.StoreModifier('budgets')
storeModifier.orderby(db.teams.team, db.budgets.year, db.budgets.line)
storeModifier = dbui.StoreModifier('categories')
storeModifier.orderby(db.categories.code)
storeModifier = dbui.StoreModifier('hardware')
storeModifier.orderby(db.people.last_name, db.hardware.start_date)
storeModifier = dbui.StoreModifier('history')
storeModifier.orderby(db.people.last_name, db.history.start_date)
storeModifier = dbui.StoreModifier('levels')
storeModifier.orderby(db.levels.level)
storeModifier = dbui.StoreModifier('organizations')
storeModifier.orderby(db.organizations.organization)
storeModifier = dbui.StoreModifier('people')
storeModifier.orderby(db.people.last_name)
storeModifier = dbui.StoreModifier('projects')
storeModifier.orderby(db.projects.project)
storeModifier = dbui.StoreModifier('responsabilities')
storeModifier.orderby(db.people.last_name, db.responsabilities.start_date)
storeModifier = dbui.StoreModifier('teams')
storeModifier.orderby(db.teams.team)
\ No newline at end of file
# -*- coding: utf-8 -*-
""" widgets viewport
"""
#
# The grid node for the navigation tree
#
gridNode = dbui.Node(T('Tables'))
configurator = lambda tablename: dbui.to_gridPanel(db[tablename])
gridNode.add_children(db.tables, func=configurator)
#
# The tool node for the navigation tree
#
schemaNode = dbui.Panel(autoLoad='/'+request.application+'/default/schema')
versionNode = dbui.Panel(autoLoad='/'+request.application+'/default/versions')
toolNode = dbui.Node(T('Tools'))
toolNode.add_child(T('database schema'), schemaNode)
toolNode.add_child(T('versions'), versionNode)
toolNode.sort_children()
#
# The viewport with its navigation tree
#
viewportModifier = dbui.ViewportModifier()
viewportModifier.add_node(gridNode, toolNode)
--------------------------------- CHANGE LOG ----------------------------------
HEAD
- Migrate to plugin_dbui 0.4.9 to develop filter on date.
0.1.0 (July 2012)
- First running version based on dbui 0.4.7.6
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment