How to use the udiskie.async_.Coroutine function in udiskie

To help you get started, we’ve selected a few udiskie 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 coldfix / udiskie / udiskie / dbus.py View on Github external
@Coroutine.from_generator_function
def connect_service(bus_name, object_path, interface):
    """
    Connect to the service object on DBus.

    :returns: new proxy object for the service
    :rtype: InterfaceProxy
    :raises BusException: if unable to connect to service.
    """
    proxy = yield DBusProxyNewForBus(
        Gio.BusType.SYSTEM,
        Gio.DBusProxyFlags.DO_NOT_LOAD_PROPERTIES |
        Gio.DBusProxyFlags.DO_NOT_CONNECT_SIGNALS,
        info=None,
        name=bus_name,
        object_path=object_path,
        interface_name=interface,
github coldfix / udiskie / udiskie / udisks1.py View on Github external
    @Coroutine.from_generator_function
    def create(cls):
        service = (cls.BusName, cls.ObjectPath, cls.Interface)
        proxy = yield connect_service(*service)
        version = yield cls.get_version()
        daemon = cls(proxy, version)
        yield daemon._sync()
        yield Return(daemon)
github coldfix / udiskie / udiskie / dbus.py View on Github external
    @Coroutine.from_generator_function
    def get_interface(self, name):
        """
        Get an interface proxy for this Dbus object.

        :param str name: interface name
        :returns: a proxy object for the other interface
        :rtype: InterfaceProxy
        """
        proxy = yield self._get_interface(name)
        yield Return(InterfaceProxy(proxy))
github coldfix / udiskie / udiskie / udisks1.py View on Github external
def pop(self, *_ignored):
        """Start executing the next event handler."""
        if not self._waiting:
            self._execing = False
            return
        self._execing = True
        func, args, kwargs = self._waiting.pop()
        coroutine = Coroutine(func(*args, **kwargs))
        coroutine.errbacks.append(self.pop)
        coroutine.callbacks.append(self.pop)