root/trunk/twisted/internet/glib2reactor.py

Revision 24441, 1.2 KB (checked in by thijs, 2 years ago)

Merge maintainer-email-2438: Get rid of references to maintainer email addresses from code.

Author: thijs
Reviewer: exarkun
Fixes: #2438

Line 
1
2"""
3This module provides support for Twisted to interact with the glib mainloop.
4This is like gtk2, but slightly faster and does not require a working
5$DISPLAY. However, you cannot run GUIs under this reactor: for that you must
6use the gtk2reactor instead.
7
8In order to use this support, simply do the following::
9
10    |  from twisted.internet import glib2reactor
11    |  glib2reactor.install()
12
13Then use twisted.internet APIs as usual.  The other methods here are not
14intended to be called directly.
15
16When installing the reactor, you can choose whether to use the glib
17event loop or the GTK+ event loop which is based on it but adds GUI
18integration.
19
20Maintainer: Itamar Shtull-Trauring
21"""
22
23from twisted.internet import gtk2reactor
24
25
26
27class Glib2Reactor(gtk2reactor.Gtk2Reactor):
28    """
29    The reactor using the glib mainloop.
30    """
31
32    def __init__(self):
33        """
34        Override init to set the C{useGtk} flag.
35        """
36        gtk2reactor.Gtk2Reactor.__init__(self, useGtk=False)
37
38
39
40def install():
41    """
42    Configure the twisted mainloop to be run inside the glib mainloop.
43    """
44    reactor = Glib2Reactor()
45    from twisted.internet.main import installReactor
46    installReactor(reactor)
47   
48__all__ = ['install']
Note: See TracBrowser for help on using the browser.