Skip to content
Snippets Groups Projects
widgets_forms.py 3.32 KiB
# -*- coding: utf-8 -*-
""" widgets forms

"""
#
# add plugin to all forms
#
dbui.configure_forms(db, plugins=['pFormToolTip'])

#
# link comboboxes in foo1 selector
#
#formModifier = dbui.FormModifier('foo1')
#formModifier.link_comboboxes(masterName='my_axis',
#                             slaveNames='my_granularity',
#                             storeName='axesStore',
#                             displayFieldMaster='axis_local',
#                             valueFieldMaster='axis',
#                             displayFieldSlaves='granularity_local',
#                             valueFieldSlaves='granularity')

#
# link several comboboxes in harvester selector
#
formModifier = dbui.FormModifier('harvester_selector')
formModifier.link_comboboxes(master=virtdb.harvester_selector.id_projects,
                             slave=virtdb.harvester_selector.controller,
                             masterHasSlaveData='harvesters')

formModifier = dbui.FormModifier('harvester_selector')
formModifier.link_comboboxes(master=virtdb.harvester_selector.id_projects,
                             slave=virtdb.harvester_selector.id_teams,
                             masterHasSlaveData='harvesters')

#
# new fields
#
formModifier = dbui.FormModifier('new_fields')
formModifier.configure(width=400,
                       defaults={'width': 270})


#
# Create fieldSet for the publication form
#
formModifier = dbui.FormModifier('publications')
formModifier.merge_fields('title',
                          'authors',
                          'id_collaborations',
                          'id_publishers',
                          'year',
                          'doi',
                          'volume',
                          'first_page',
                          'e_print',
                          title=T('General'),
                          flex=1)

formModifier.merge_fields('conference_title',
                          'conference_url',
                          'conference_start',
                          'conference_town',
                          'id_countries',
                          'conference_speaker',
                          dbui.Spacer(height=26*3),
                          title=T('Conference'),
                          flex=1)

formModifier.merge_fields('report_numbers', 
                          'id_reports',
                          dbui.Spacer(height=220),
                          title=T('Report'),
                          flex=1)

formModifier.merge_fields('authors_cppm',
                          'id_teams',
                          'id_projects',
                          'id_categories',
                          dbui.Spacer(height=26*5),
                          title='CPPM',
                          flex=1)


#
# Organise fieldSet within a TabPanel embedded in the publication form
#
formModifier.set_mapper(dbui.map_tabpanel)

#
# Polish the look and feel of the publication form
# NOTE: the width/height define the size of the window 
# when running the form from the grid. The defaults defines the height
# of the fieldSet allowing a fine tuning of the form layout.
#
formModifier.configure(buttonAlign='right',
                       labelWidth=100,
                       labelAlign='right',
                       width=400,
                       height=380,
                       defaults={'height': 320})