dbus-python icon indicating copy to clipboard operation
dbus-python copied to clipboard

Help about usage of add_signal_receiver

Open gteti opened this issue 1 year ago • 0 comments

Hello, I'd like to have some help about the use of the function add_signal_receiver. I've read the documentation and seen the example provided here but I still can't quite get a correct signal reading.

Here's my code:

def catchall_hello_signals_handler(self, hello_string):
        print("Received a signal and it says: ", hello_string)

self.bus.add_signal_receiver(
                    self.catchall_hello_signals_handler,        
                    dbus_interface="com.mybus.DBus.Donald",    
                    signal_name="execCommandSent",              
                    path="/Donald"                             
                )

My bus name is com.mybus The object is called Donald/ The interface under the object is com.mybus.DBus.Donald The signal here is execCommandSent from which I want to ear what is says.

What I read in the qdbusviewer app when I connect to this signal is something like: `Received signal from :1.10, path /Donald, interface com.mybus.DBus.Donald, member execCommandSent Arguments: [Argument: a{sv} {"file_path0" = [Variant(QString): "/home/exports/upload/update.tgz"],"has_recovery_point" = [Variant(QString): "[email protected]_update@true"], "name" = [Variant(QString):"update_remote_prj"]}]

I'd like to read the same through my python code and interpret it. For now I've been able to read this through the method execCommand and not from the signal execCommandSent.

Can anyone help me? Thank you very much.

gteti avatar Feb 13 '24 14:02 gteti