Funktionierender Prototyp des Serious Games zur Vermittlung von Wissen zu Software-Engineering-Arbeitsmodellen.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

glib2reactor.py 1.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. # Copyright (c) Twisted Matrix Laboratories.
  2. # See LICENSE for details.
  3. """
  4. This module provides support for Twisted to interact with the glib mainloop.
  5. This is like gtk2, but slightly faster and does not require a working
  6. $DISPLAY. However, you cannot run GUIs under this reactor: for that you must
  7. use the gtk2reactor instead.
  8. In order to use this support, simply do the following::
  9. from twisted.internet import glib2reactor
  10. glib2reactor.install()
  11. Then use twisted.internet APIs as usual. The other methods here are not
  12. intended to be called directly.
  13. """
  14. from twisted.internet import gtk2reactor
  15. class Glib2Reactor(gtk2reactor.Gtk2Reactor):
  16. """
  17. The reactor using the glib mainloop.
  18. """
  19. def __init__(self):
  20. """
  21. Override init to set the C{useGtk} flag.
  22. """
  23. gtk2reactor.Gtk2Reactor.__init__(self, useGtk=False)
  24. def install():
  25. """
  26. Configure the twisted mainloop to be run inside the glib mainloop.
  27. """
  28. reactor = Glib2Reactor()
  29. from twisted.internet.main import installReactor
  30. installReactor(reactor)
  31. __all__ = ["install"]