File: preferences.rst

package info (click to toggle)
python-envisagecore 3.1.2-1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 1,096 kB
  • ctags: 1,063
  • sloc: python: 4,115; makefile: 7; sh: 5
file content (48 lines) | stat: -rw-r--r-- 1,552 bytes parent folder | download | duplicates (2)
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       = 'enthought.envisage.preferences'

  * PREFERENCES_PAGES = 'enthought.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.