diff options
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/manual/displaymodules.rst | 35 | ||||
| -rw-r--r-- | docs/manual/encodings.rst (renamed from docs/manual/textencodings.rst) | 6 | ||||
| -rw-r--r-- | docs/manual/eventloops.rst | 62 | ||||
| -rw-r--r-- | docs/manual/index.rst | 5 | ||||
| -rw-r--r-- | docs/manual/mainloop.rst | 64 | ||||
| -rw-r--r-- | docs/manual/userinput.rst | 8 | ||||
| -rw-r--r-- | docs/reference/display_modules.rst | 13 |
7 files changed, 112 insertions, 81 deletions
diff --git a/docs/manual/displaymodules.rst b/docs/manual/displaymodules.rst index 3cb302b..51876cd 100644 --- a/docs/manual/displaymodules.rst +++ b/docs/manual/displaymodules.rst @@ -6,9 +6,6 @@ .. currentmodule:: urwid -Introduction -============ - Urwid's display modules provide a layer of abstraction for drawing to the screen and reading user input. The display module you choose will depend on how you plan to use Urwid. @@ -71,8 +68,11 @@ external event loop support YES no .. [3] when using xterm or gnome-terminal -AJAX-based Web Display Module ``web_display`` -============================================= +Other Display Modules +===================== + +CGI Web Display Module ``web_display`` +-------------------------------------- The :mod:`urwid.web_display` module lets you run your application as a CGI script under Apache instead of running it in a terminal. @@ -82,16 +82,17 @@ that need to be resolved before this module is recommended for production use. The tour.py_ and calc.py_ example programs demonstrate use of this module. -.. _tour.py: http://excess.org/urwid/browser/tour.py -.. _calc.py: http://excess.org/urwid/browser/calc.py +.. _tour.py: http://excess.org/urwid/browser/examples/tour.py +.. _calc.py: http://excess.org/urwid/browser/examples/calc.py Screenshot Display Module ``html_fragment`` -=========================================== +------------------------------------------- Screenshots of Urwid interfaces can be rendered in plain HTML. The :mod:`html_fragment` display module lets you do this by simulating user input -and capturing the screen as fragments of HTML each time :func:`draw_screen` is +and capturing the screen as fragments of HTML each time +:meth:`html_fragemnt.Screen.draw_screen` is called. These fragments may be included in HTML documents. They will be rendered @@ -105,6 +106,22 @@ The `example screenshots`_ are generated with this display module. .. _`example screenshots`: http://excess.org/urwid/examples.html +LCD Display Module ``lcd_display`` +---------------------------------- + +Almost any device that displays characters in a grid can be used as a +screen. The :mod:`lcd_display` module has some base classes for simple +LCD character display devices and a complete implementation of a +:class:`lcd_display.CF635Screen` for Crystal Fontz 635 USB displays with +6 buttons. + +The lcd_cf635.py_ example program demonstrates use of this module. + +.. _lcd_cf635.py: http://excess.org/urwid/browser/examples/lcd_cf635.py + +.. seealso:: `Urwid on a Crystalfontz 635 LCD <http://excess.org/article/2010/03/urwid-crystalfontz-635-lcd/>`_ + + .. _setting-a-palette: Setting a Palette diff --git a/docs/manual/textencodings.rst b/docs/manual/encodings.rst index 6c6ca45..388c2f5 100644 --- a/docs/manual/textencodings.rst +++ b/docs/manual/encodings.rst @@ -2,9 +2,9 @@ .. _text-encodings: -****************** - Text Encodings -****************** +*********************** + Encodings Supported +*********************** .. currentmodule:: urwid diff --git a/docs/manual/eventloops.rst b/docs/manual/eventloops.rst deleted file mode 100644 index ebbec2f..0000000 --- a/docs/manual/eventloops.rst +++ /dev/null @@ -1,62 +0,0 @@ -.. _event-loops: - -*************** - Event Loops -*************** - -Urwid's event loop classes handle waiting for things for the -:class:`~urwid.main_loop.MainLoop`. The different event loops allow you to -integrate with Twisted_ or Glib_ libraries, or use a simple *select*-based -loop. Event loop classes abstract the particulars of waiting for input and -calling functions as a result of timeouts. - -You will typically only have a single event loop in your application, even if -you have more than one :class:`~urwid.main_loop.MainLoop` running. - -You can add your own files to watch to your event loop, with the -:meth:`watch_file` method. Using this interface gives you the special handling -of :exc:`ExitMainLoop` and other exceptions when using Glib_ or Twisted_. - -.. _Twisted: http://twistedmatrix.com/trac/ -.. _Glib: http://developer.gnome.org/glib/stable/ - -``SelectEventLoop`` -=================== - -This event loop is based on ``select.select()``. This is the default event loop -created if none is passed to :class:`~urwid.main_loop.MainLoop`. - -:: - - # same as urwid.MainLoop(widget, event_loop=urwid.SelectEventLoop()) - loop = urwid.MainLoop(widget) - -`SelectEventLoop reference <http://excess.org/urwid/reference.html#SelectEventLoop>`_ - -``TwistedEventLoop`` -==================== - -This event loop uses Twisted's reactor. It has been set up to emulate -:class:`~urwid.main_loop.SelectEventLoop`'s behaviour and will start the -reactor and stop it on an error. This is not the standard way of using -Twisted's reactor, so you may need to modify this behaviour for your -application. - -:: - - loop = urwid.MainLoop(widget, event_loop=urwid.TwistedEventLoop()) - -`TwistedEventLoop reference <http://excess.org/urwid/reference.html#TwistedEventLoop>`_ - -``GLibEventLoop`` -================= - -This event loop uses GLib's event loop. This is useful if you are building an -application that depends on DBus events, but don't want to base your -application on Twisted. - -:: - - loop = urwid.MainLoop(widget, event_loop=urwid.GLibEventLoop()) - -`GLibEventLoop reference <http://excess.org/urwid/reference.html#GLibEventLoop>`_ diff --git a/docs/manual/index.rst b/docs/manual/index.rst index 756ca52..0f32ee7 100644 --- a/docs/manual/index.rst +++ b/docs/manual/index.rst @@ -10,13 +10,12 @@ overview mainloop displaymodules - userinput widgets + userinput textlayout - textencodings + encodings displayattributes listboxcontents canvascache - eventloops diff --git a/docs/manual/mainloop.rst b/docs/manual/mainloop.rst index b78294d..ed55b5b 100644 --- a/docs/manual/mainloop.rst +++ b/docs/manual/mainloop.rst @@ -50,3 +50,67 @@ the widgets that are displayed with your application-specific input handling so that the application's behaviour changes when the widgets change. If all your custom input handling is done from :meth:`MainLoop.unhandled_input`, it will be difficult to extend as your application gets more complicated. + + +.. _event-loops: + +Event Loops +=========== + +Urwid's event loop classes handle waiting for things for the +:class:`MainLoop`. The different event loops allow you to +integrate with Twisted_ or Glib_ libraries, or use a simple ``select``-based +loop. Event loop classes abstract the particulars of waiting for input and +calling functions as a result of timeouts. + +You will typically only have a single event loop in your application, even if +you have more than one :class:`MainLoop` running. + +You can add your own files to watch to your event loop, with the +:meth:`watch_file() <SelectEventLoop.watch_file>` method. +Using this interface gives you the special handling +of :exc:`ExitMainLoop` and other exceptions when using Glib_ or Twisted_. + +.. _Twisted: http://twistedmatrix.com/trac/ +.. _Glib: http://developer.gnome.org/glib/stable/ + +``SelectEventLoop`` +------------------- + +This event loop is based on ``select.select()``. This is the default event loop +created if none is passed to :class:`~urwid.main_loop.MainLoop`. + +:: + + # same as urwid.MainLoop(widget, event_loop=urwid.SelectEventLoop()) + loop = urwid.MainLoop(widget) + +:class:`SelectEventLoop reference <SelectEventLoop>` + +``TwistedEventLoop`` +-------------------- + +This event loop uses Twisted's reactor. It has been set up to emulate +:class:`SelectEventLoop`'s behaviour and will start the +reactor and stop it on an error. This is not the standard way of using +Twisted's reactor, so you may need to modify this behaviour for your +application. + +:: + + loop = urwid.MainLoop(widget, event_loop=urwid.TwistedEventLoop()) + +:class:`TwistedEventLoop reference <TwistedEventLoop>` + +``GLibEventLoop`` +----------------- + +This event loop uses GLib's event loop. This is useful if you are building an +application that depends on DBus events, but don't want to base your +application on Twisted. + +:: + + loop = urwid.MainLoop(widget, event_loop=urwid.GLibEventLoop()) + +:class:`GLibEventLoop reference <GLibEventLoop>` diff --git a/docs/manual/userinput.rst b/docs/manual/userinput.rst index a142bea..9f9be23 100644 --- a/docs/manual/userinput.rst +++ b/docs/manual/userinput.rst @@ -74,7 +74,7 @@ information. If you want the input converted to Unicode in all cases you may create an input filter to do so. Mouse Input ------------ +=========== Mouse input is sent as a ``(event, button, x, y)`` tuple. *event* is a string describing the event. If the SHIFT, ALT or CTRL keys are held when a mouse @@ -87,7 +87,7 @@ terminals and some users don't have a middle mouse button, so these shouldn't be relied on. ``'mouse press'`` Events -======================== +------------------------ A mouse button was pressed. @@ -104,13 +104,13 @@ A mouse button was pressed. .. [#first] typically no corresponding release event is sent ``'mouse release'`` Events -========================== +-------------------------- Mouse release events will often not have information about which button was released. In this case *button* will be set to 0. ``'mouse drag'`` Events -======================= +----------------------- In the rare event that your user is using a terminal that can send these events you can use them to track their mouse dragging from one character cell to the diff --git a/docs/reference/display_modules.rst b/docs/reference/display_modules.rst index 806fd76..6ec31b4 100644 --- a/docs/reference/display_modules.rst +++ b/docs/reference/display_modules.rst @@ -36,3 +36,16 @@ html_fragment .. autofunction:: screenshot_init .. autofunction:: screenshot_collect + +lcd_display +----------- + +.. module:: urwid.lcd_display + +.. autoclass:: LCDScreen + +.. autoclass:: CFLCDScreen + +.. autoclass:: CF635Screen + +.. autoclass:: KeyRepeatSimulator |
