Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def run_forever(self, gtk=False, application=None):
"""Run the event loop until stop() is called."""
assert not (gtk and application is not None)
if self._loop_implem is not None:
raise RuntimeError('Event loop is running.')
if application is not None:
assert self._context == GLib.main_context_default()
lh = _GApplicationLoopImplem(self, application)
elif gtk or self._gtk:
lh = _GtkLoopImplem(self)
elif self._application is not None:
lh = _GApplicationLoopImplem(self, self._application)
self._application = None
else:
lh = _GLibLoopImplem(self)
# We do not run the callbacks immediately. We need to call them
# when the Gtk loop is running, in case one callback calls .stop()
self._schedule_dispatch()
try:
self._loop_implem = lh
lh.run()
if self._interrupted: