1 # Copyright (c) Twisted Matrix Laboratories.
2 # See LICENSE for details.
5 This module provides support for Twisted to interact with the gtk3 mainloop
6 via Gobject introspection. This is like gi, but slightly slower and requires a
9 In order to use this support, simply do the following::
11 from twisted.internet import gtk3reactor
14 If you wish to use a GApplication, register it with the reactor::
16 from twisted.internet import reactor
17 reactor.registerGApplication(app)
19 Then use twisted.internet APIs as usual.
22 from twisted.internet import gireactor
23 from twisted.python import runtime
26 class Gtk3Reactor(gireactor.GIReactor):
28 A reactor using the gtk3+ event loop.
33 Override init to set the C{useGtk} flag.
35 gireactor.GIReactor.__init__(self, useGtk=True)
39 class PortableGtk3Reactor(gireactor.PortableGIReactor):
41 Portable GTK+ 3.x reactor.
45 Override init to set the C{useGtk} flag.
47 gireactor.PortableGIReactor.__init__(self, useGtk=True)
53 Configure the Twisted mainloop to be run inside the gtk3+ mainloop.
55 if runtime.platform.getType() == 'posix':
56 reactor = Gtk3Reactor()
58 reactor = PortableGtk3Reactor()
60 from twisted.internet.main import installReactor
61 installReactor(reactor)