diff options
author | Patrick Totzke <patricktotzke@gmail.com> | 2011-11-26 20:00:59 +0000 |
---|---|---|
committer | Patrick Totzke <patricktotzke@gmail.com> | 2011-11-26 20:00:59 +0000 |
commit | 14922b89ef2a737d0edd67f6d29a264560c02b99 (patch) | |
tree | 45f38dece1c4d5c4b45970135dbb0aeee2ed0b58 /docs | |
parent | 1ee219e36cb18a009572624d2d3e6219ce96f0f0 (diff) |
documentation for alot.ui.UI
Diffstat (limited to 'docs')
-rw-r--r-- | docs/conf.py | 3 | ||||
-rw-r--r-- | docs/interaction.rst | 41 |
2 files changed, 40 insertions, 4 deletions
diff --git a/docs/conf.py b/docs/conf.py index 39387c7b..321bd473 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -215,3 +215,6 @@ man_pages = [ ('index', 'alot', u'alot Documentation', [u'Patrick Totzke'], 1) ] + +autodoc_member_order = 'bysource' +intersphinx_mapping = {'python': ('http://docs.python.org/3.2', None)} diff --git a/docs/interaction.rst b/docs/interaction.rst index 2150ac01..57638435 100644 --- a/docs/interaction.rst +++ b/docs/interaction.rst @@ -1,10 +1,43 @@ User Interaction ================================ -.. currentmodule:: alot.ui +In order to keep the interface non-blocking, alot makes use of +twisted's deferred - a framework that makes it easy to deal with callbacks. +See `here <http://twistedmatrix.com/documents/current/core/howto/defer.html>`_ +for an intro. -:class:`alot.ui.UI` +Many commands in alot make use of a construct called +`inline callbacks <http://twistedmatrix.com/documents/8.1.0/api/twisted.internet.defer.html#inlineCallbacks>`_, which allows you to treat deferred-returning functions almost like syncronous functions. Consider the following example of a function that prompts for some input and acts on it: + +.. code-block:: python + + from twisted.internet import defer + + @defer.inlineCallbacks + def greet(ui): # ui is instance of alot.ui.UI + name = yield ui.prompt(prefix='pls enter your name>') + ui.notify('your name is: ' + name) + + + +:class:`UI` --------------------- -.. autoclass:: alot.ui.UI - :members: +.. module:: alot.ui +.. autoclass:: UI + + .. autoattribute:: buffers + .. autoattribute:: current_buffer + .. autoattribute:: dbman + .. autoattribute:: logger + .. autoattribute:: accountman + + .. automethod:: prompt + .. automethod:: choice + .. automethod:: notify + .. automethod:: clear_notify + .. automethod:: buffer_open + .. automethod:: buffer_focus + .. automethod:: buffer_close + .. automethod:: get_buffers_of_type + .. automethod:: get_deep_focus |