def _on_interfaces_removed(self, object_path, interfaces): """ Internal callback that is called by DBus This function is responsible for firing the public signal """ # Convert from dbus types object_path = drop_dbus_type(object_path) interfaces = drop_dbus_type(interfaces) # Log what's going on logging.debug("The object %r has lost the following interfaces: %r", object_path, interfaces) # Call the signal handler self.on_interfaces_removed(object_path, interfaces)
def _on_properties_changed(self, interface_name, changed_properties, invalidated_properties, sender=None): # XXX: This is a workaround the fact that we cannot # properly track changes to all properties :-( self._managed_objects = drop_dbus_type( self._observer._udisks2_obj_manager.GetManagedObjects()) # Fire the change signal() self.on_change()
def _on_properties_changed(self, interface_name, changed_properties, invalidated_properties, sender=None): """ Internal callback that is called by DBus This function is responsible for firing the public signal """ # Convert from dbus types interface_name = drop_dbus_type(interface_name) changed_properties = drop_dbus_type(changed_properties) invalidated_properties = drop_dbus_type(invalidated_properties) sender = drop_dbus_type(sender) # Log what's going on logging.debug("Some object with the interface %r has changed " "properties: %r and invalidated properties %r " "(sender: %s)", interface_name, changed_properties, invalidated_properties, sender) # Call the signal handler self.on_properties_changed(interface_name, changed_properties, invalidated_properties, sender)
def _on_properties_changed(self, interface_name, changed_properties, invalidated_properties, sender=None): """ Internal callback that is called by DBus This function is responsible for firing the public signal """ # Convert from dbus types interface_name = drop_dbus_type(interface_name) changed_properties = drop_dbus_type(changed_properties) invalidated_properties = drop_dbus_type(invalidated_properties) sender = drop_dbus_type(sender) # Log what's going on logging.debug( "Some object with the interface %r has changed " "properties: %r and invalidated properties %r " "(sender: %s)", interface_name, changed_properties, invalidated_properties, sender) # Call the signal handler self.on_properties_changed(interface_name, changed_properties, invalidated_properties, sender)
def _get_initial_objects(self): """ Get the initial collection of objects. Needs to be called before the first signals from DBus are observed. Requires a working connection to UDisks2. """ # Having this interface we can now peek at the existing objects. # We can use the standard method GetManagedObjects() to do that logging.debug("Accessing GetManagedObjects() on UDisks2 object") managed_objects = self._udisks2_obj_manager.GetManagedObjects() managed_objects = drop_dbus_type(managed_objects) # Fire the public signal for getting initial objects self.on_initial_objects(managed_objects) # Connect our internal handles to the DBus signal handlers logging.debug("Setting up DBus signal handler for InterfacesAdded") self._udisks2_obj_manager.connect_to_signal("InterfacesAdded", self._on_interfaces_added) logging.debug("Setting up DBus signal handler for InterfacesRemoved") self._udisks2_obj_manager.connect_to_signal( "InterfacesRemoved", self._on_interfaces_removed)
def _get_initial_objects(self): """ Get the initial collection of objects. Needs to be called before the first signals from DBus are observed. Requires a working connection to UDisks2. """ # Having this interface we can now peek at the existing objects. # We can use the standard method GetManagedObjects() to do that logging.debug("Accessing GetManagedObjects() on UDisks2 object") managed_objects = self._udisks2_obj_manager.GetManagedObjects() managed_objects = drop_dbus_type(managed_objects) # Fire the public signal for getting initial objects self.on_initial_objects(managed_objects) # Connect our internal handles to the DBus signal handlers logging.debug("Setting up DBus signal handler for InterfacesAdded") self._udisks2_obj_manager.connect_to_signal( "InterfacesAdded", self._on_interfaces_added) logging.debug("Setting up DBus signal handler for InterfacesRemoved") self._udisks2_obj_manager.connect_to_signal( "InterfacesRemoved", self._on_interfaces_removed)
def _on_initial_objects(self, managed_objects): """ Internal callback called when we get the initial collection of objects """ self._managed_objects = drop_dbus_type(managed_objects)