1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
|
Preferences with Envisage
=========================
Envisage presents preferences with two different extension points::
PREFERENCES = 'envisage.preferences'
PREFERENCES_PAGES = 'envisage.ui.workbench.preferences_pages'
The first one is only model-related and is for programmatic access to
preferences, whereas the second one is for displaying UIs to the user in
the workbench plugin.
Preferences
------------
The contribution point is simply a list of URLs to the preference file, e.g.::
preferences_pages = List(
['pkgfile://acme.acmelab/preferences.ini'],
contributes_to=PREFERENCES_PAGES,
)
where acme.acmelab is the python-module-like path to the package in which
the default preferences.ini is stored.
A plugin usually needs only one preferences file, regardless of how many
preference pages or settings it has.
Preferences pages
------------------
The preference pages are a Traits UI view to wrap the preferences and
allow the user to modify them. A preference page is defined as in the
preference_manager example in the AppTools examples. It can than be
contributed to the workbench, as in::
preferences_pages = List(contributes_to=PREFERENCES_PAGES)
def _preferences_pages_default(self):
""" Trait initializer. """
from acme.preference_pages import ACMEPreferencePages
return [ACMEPreferencePages]
A plugin needs to contribute a preferences pages class for each category
of preferences it contributes.
|