diff options
author | Patrick Totzke <patricktotzke@gmail.com> | 2012-02-19 21:49:16 +0000 |
---|---|---|
committer | Patrick Totzke <patricktotzke@gmail.com> | 2012-02-19 21:50:01 +0000 |
commit | 3d90a2d131c581996f8699bcaa2bc856da01f865 (patch) | |
tree | 16a719c20dd92b10c0523910635215194e5f3f3c /docs/source | |
parent | 45fce4a54f4448864525462bc66f5d327c0d8def (diff) |
updated settings docs
Diffstat (limited to 'docs/source')
-rw-r--r-- | docs/source/api/settings.rst | 51 |
1 files changed, 11 insertions, 40 deletions
diff --git a/docs/source/api/settings.rst b/docs/source/api/settings.rst index f7272756..3fea36f5 100644 --- a/docs/source/api/settings.rst +++ b/docs/source/api/settings.rst @@ -7,49 +7,20 @@ There are four types of user settings: notmuchs and alot's config files, the hooks-file for user provided python code and the mailcap, defining shellcomands as handlers for files of certain mime types. -Alot sets up :class:`FallbackConfigParser` objects to access the configs -of alot and notmuch`. -Hooks can be accessed via :meth:`AlotConfigParser.get_hook` -and MIME handlers can be looked up using :func:`alot.settings.get_mime_handler`. - -+----------------+-----------------------------------+------------------------------+ -| What | accessible via | Type | -+================+===================================+==============================+ -| alot config | :obj:`alot.settings.config` | :class:`AlotConfigParser` | -+----------------+-----------------------------------+------------------------------+ -| notmuch config | :obj:`alot.settings.notmuchconfig`| :class:`FallbackConfigParser`| -+----------------+-----------------------------------+------------------------------+ - -Through these objects you can access user settings (or their default values -if unset) in the following manner:: - - from alot.settings import config, notmuchconfig - - # alot config - >>> config.getint('general', 'notify_timeout') - 5 - >>> config.getboolean('general', 'show_statusbar') - True - >>> config.getstringlist('general', 'displayed_headers') - [u'From', u'To', u'Cc', u'Bcc', u'Subject'] - - # notmuch config - >>> notmuchconfig.get('user', 'primary_email') - 'patricktotzke@gmail.com' - >>> notmuchconfig.getboolean('maildir', 'synchronize_flags') - True - -Hooks can be looked up using :meth:`AlotConfigParser.get_hook`. +Alot sets up :class:`SettingsManager` objects to access these user settings uniformly. + +MIME handlers can be looked up via :meth:`SettingsManager.settings.get_mime_handler`, +config values of alot and notmuch's config are accessible using +:meth:`SettingsManager.get` and :meth:`SettingsManager.get_notmuch_setting`. +These methods return either None or the requested value typed as indicated in +the spec files :file:`alot/defaults/*spec`. + + +Hooks can be looked up via :meth:`SettingsManager.get_hook`. They are user defined callables that expect to be called with the following parameters: :ui: :class:`~alot.ui.UI` -- the initialized main component :dbm: :class:`~alot.db.DBManager` -- :obj:`ui.dbman` - :aman: :class:`~alot.account.AccountManager` -- :obj:`ui.accountman` - :log: :class:`~logging.Logger` -- :obj:`ui.logger` - :config: :class:`AlotConfigParser` :obj:`alot.settings.config` -.. autoclass:: FallbackConfigParser - :members: -.. autoclass:: AlotConfigParser +.. autoclass:: SettingsManager :members: -.. autofunction:: get_mime_handler |