How to use the gbulb.glib_events._LoopImplem function in gbulb

To help you get started, we’ve selected a few gbulb examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github davidedmundson / telepathy-hangups / gbulb / glib_events.py View on Github external
#TODO: move it into unix_events
GLibEventLoop = BaseGLibEventLoop


class _LoopImplem:
    def __init__(self, loop):
        self._loop = loop

    def run(self):
        raise NotImplementedError()

    def stop(self):
        raise NotImplementedError()

class _GLibLoopImplem(_LoopImplem):

    def __init__(self, loop):
        super().__init__(loop)

        # We use the introspected MainLoop object directly, because the
        # override in pygobject tampers with SIGINT
        self._mainloop = GLib._introspection_module.MainLoop.new(self._loop._context, True)

    def run(self):
        self._mainloop.run()

    def stop(self):
        self._mainloop.quit()

if Gtk:
    class _GtkLoopImplem(_LoopImplem):
github davidedmundson / telepathy-hangups / gbulb / glib_events.py View on Github external
def __init__(self, loop):
        super().__init__(loop)

        # We use the introspected MainLoop object directly, because the
        # override in pygobject tampers with SIGINT
        self._mainloop = GLib._introspection_module.MainLoop.new(self._loop._context, True)

    def run(self):
        self._mainloop.run()

    def stop(self):
        self._mainloop.quit()

if Gtk:
    class _GtkLoopImplem(_LoopImplem):
        def run(self):
            Gtk.main()

        def stop(self):
            Gtk.main_quit()

class _GApplicationLoopImplem(_LoopImplem):

    def __init__(self, loop, application):
        super().__init__(loop)

        if not isinstance (application, Gio.Application):
            raise TypeError("application must be a Gio.Application object")

        self._application = application
github davidedmundson / telepathy-hangups / gbulb / glib_events.py View on Github external
def run(self):
        self._mainloop.run()

    def stop(self):
        self._mainloop.quit()

if Gtk:
    class _GtkLoopImplem(_LoopImplem):
        def run(self):
            Gtk.main()

        def stop(self):
            Gtk.main_quit()

class _GApplicationLoopImplem(_LoopImplem):

    def __init__(self, loop, application):
        super().__init__(loop)

        if not isinstance (application, Gio.Application):
            raise TypeError("application must be a Gio.Application object")

        self._application = application

    def run(self):
        self._application.run(None)

    def stop(self):
        self._application.quit()

class GLibEventLoopPolicy(events.AbstractEventLoopPolicy):