PySide6.QtDBus.QDBusInterface¶
- class QDBusInterface¶
- The - QDBusInterfaceclass is a proxy for interfaces on remote objects.- Details- Warning - This section contains snippets that were automatically translated from C++ to Python and may contain errors. - QDBusInterfaceis a generic accessor class that is used to place calls to remote objects, connect to signals exported by remote objects and get/set the value of remote properties. This class is useful for dynamic access to remote objects: that is, when you do not have a generated code that represents the remote interface.- Calls are usually placed by using the - call()function, which constructs the message, sends it over the bus, waits for the reply and decodes the reply. Signals are connected to by using the normal QObject::connect() function. Finally, properties are accessed using the QObject::property() and QObject::setProperty() functions.- The following code snippet demonstrates how to perform a mathematical operation of - "2 + 2"in a remote application called- com.example.Calculator, accessed via the session bus.- QDBusInterface remoteApp( "com.example.Calculator", "/Calculator/Operations", "org.mathematics.RPNCalculator" ) remoteApp.call( "PushOperand", 2 ) remoteApp.call( "PushOperand", 2 ) remoteApp.call( "ExecuteOperation", "+" ) reply = remoteApp.call( "PopOperand" ) if reply.isValid(): printf( "%d", reply.value() ) # prints 4 - See also - Python Language Note - DBus signals can be captured with string-based connections (see Specifying Signals and Slots by Method Signature Strings). - Synopsis¶- Methods¶- def - __init__()
 - Note - This documentation may contain snippets that were automatically translated from C++ to Python. We always welcome contributions to the snippet translation. If you see an issue with the translation, you can also let us know by creating a ticket on https:/bugreports.qt.io/projects/PYSIDE - __init__(service, path[, interface=""[, connection=QDBusConnection.sessionBus()[, parent=None]]])¶
- Parameters:
- service – str 
- path – str 
- interface – str 
- connection – - QDBusConnection
- parent – - QObject
 
 
 - Creates a dynamic - QDBusInterfaceobject associated with the interface- interfaceon object at path- pathon service- service, using the given- connection. If- interfaceis an empty string, the object created will refer to the merging of all interfaces found by introspecting that object. Otherwise if- interfaceis not empty, the- QDBusInterfaceobject will be cached to speedup further creations of the same interface.- parentis passed to the base class constructor.- If the remote service - serviceis not present or if an error occurs trying to obtain the description of the remote interface- interface, the object created will not be valid (see- isValid()).