PySide6.QtDBus.QDBusAbstractInterface¶
- class QDBusAbstractInterface¶
The
QDBusAbstractInterface
class is the base class for all D-Bus interfaces in the Qt D-Bus binding, allowing access to remote interfaces. More…Inherited by:
QDBusInterface
,QDBusConnectionInterface
Synopsis¶
Methods¶
def
__init__()
def
asyncCall()
def
call()
def
connection()
def
interface()
def
isValid()
def
lastError()
def
path()
def
service()
def
setTimeout()
def
timeout()
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
Detailed Description¶
Generated-code classes also derive from
QDBusAbstractInterface
, all methods described here are also valid for generated-code classes. In addition to those described here, generated-code classes provide member functions for the remote methods, which allow for compile-time checking of the correct parameters and return values, as well as property type-matching and signal parameter-matching.See also
- __init__(service, path, interface, connection, parent)¶
- Parameters:
service – str
path – str
interface – str
connection –
QDBusConnection
parent –
QObject
- asyncCall(method)¶
- Parameters:
method – str
- Return type:
- asyncCallWithArgumentList(method, args)¶
- Parameters:
method – str
args – .list of QVariant
- Return type:
Places a call to the remote method specified by
method
on this interface, usingargs
as arguments. This function returns aQDBusPendingCall
object that can be used to track the status of the reply and access its contents once it has arrived.Normally, you should place calls using
asyncCall()
.Note
Method calls to objects registered by the application itself are never asynchronous due to implementation limitations.
- call(method)¶
- Parameters:
method – str
- Return type:
- call(mode, method)
- Parameters:
mode –
CallMode
method – str
- Return type:
Warning
This section contains snippets that were automatically translated from C++ to Python and may contain errors.
Calls the method
method
on this interface and passesargs
to the method. Allargs
must be convertible to QVariant.The parameters to
call
are passed on to the remote function via D-Bus as input arguments. Output arguments are returned in theQDBusMessage
reply. If the reply is an error reply,lastError()
will also be set to the contents of the error message.It can be used the following way:
value = retrieveValue() reply = QDBusMessage() api = interface.call("GetAPIVersion") if api >= 14: reply = interface.call("ProcessWorkUnicode", value) else: reply = interface.call("ProcessWork", "UTF-8", value.toUtf8())
This example illustrates function calling with 0, 1 and 2 parameters and illustrates different parameter types passed in each (the first call to
"ProcessWorkUnicode"
will contain one Unicode string, the second call to"ProcessWork"
will contain one string and one byte array). SeeasyncCall()
for the same example in non-blocking (asynchronous) calls.Note
Before Qt 5.14, this function accepted a maximum of just eight (8) arguments.
See also
- call(method, args)
- Parameters:
method – str
args – object
- Return type:
Warning
This section contains snippets that were automatically translated from C++ to Python and may contain errors.
Calls the method
method
on this interface and passesargs
to the method. Allargs
must be convertible to QVariant.The parameters to
call
are passed on to the remote function via D-Bus as input arguments. Output arguments are returned in theQDBusMessage
reply. If the reply is an error reply,lastError()
will also be set to the contents of the error message.It can be used the following way:
value = retrieveValue() reply = QDBusMessage() api = interface.call("GetAPIVersion") if api >= 14: reply = interface.call("ProcessWorkUnicode", value) else: reply = interface.call("ProcessWork", "UTF-8", value.toUtf8())
This example illustrates function calling with 0, 1 and 2 parameters and illustrates different parameter types passed in each (the first call to
"ProcessWorkUnicode"
will contain one Unicode string, the second call to"ProcessWork"
will contain one string and one byte array). SeeasyncCall()
for the same example in non-blocking (asynchronous) calls.Note
Before Qt 5.14, this function accepted a maximum of just eight (8) arguments.
See also
- call(mode, method, args)
- Parameters:
mode –
CallMode
method – str
args – object
- Return type:
This is an overloaded function.
Calls the method
method
on this interface and passesargs
to the method. Allargs
must be convertible to QVariant.If
mode
isNoWaitForReply
, then this function will return immediately after placing the call, without waiting for a reply from the remote method. Otherwise,mode
indicates whether this function should activate the Qt Event Loop while waiting for the reply to arrive.If this function reenters the Qt event loop in order to wait for the reply, it will exclude user input. During the wait, it may deliver signals and other method calls to your application. Therefore, it must be prepared to handle a reentrancy whenever a call is placed with
call()
.Note
Before Qt 5.14, this function accepted a maximum of just eight (8) arguments.
See also
- call(mode, method, args)
- Parameters:
mode – str
method – object
args – object
- Return type:
This is an overloaded function.
Calls the method
method
on this interface and passesargs
to the method. Allargs
must be convertible to QVariant.If
mode
isNoWaitForReply
, then this function will return immediately after placing the call, without waiting for a reply from the remote method. Otherwise,mode
indicates whether this function should activate the Qt Event Loop while waiting for the reply to arrive.If this function reenters the Qt event loop in order to wait for the reply, it will exclude user input. During the wait, it may deliver signals and other method calls to your application. Therefore, it must be prepared to handle a reentrancy whenever a call is placed with
call()
.Note
Before Qt 5.14, this function accepted a maximum of just eight (8) arguments.
See also
- call(arg__1, arg__2, arg__3, arg__4)
- Parameters:
arg__1 –
CallMode
arg__2 – str
arg__3 – object
arg__4 – object
- Return type:
- call(arg__1, arg__2, arg__3, arg__4)
- Parameters:
arg__1 – str
arg__2 – object
arg__3 – object
arg__4 – object
- Return type:
- call(arg__1, arg__2, arg__3, arg__4, arg__5)
- Parameters:
arg__1 –
CallMode
arg__2 – str
arg__3 – object
arg__4 – object
arg__5 – object
- Return type:
- call(arg__1, arg__2, arg__3, arg__4, arg__5)
- Parameters:
arg__1 – str
arg__2 – object
arg__3 – object
arg__4 – object
arg__5 – object
- Return type:
- call(arg__1, arg__2, arg__3, arg__4, arg__5, arg__6)
- Parameters:
arg__1 –
CallMode
arg__2 – str
arg__3 – object
arg__4 – object
arg__5 – object
arg__6 – object
- Return type:
- call(arg__1, arg__2, arg__3, arg__4, arg__5, arg__6, arg__7)
- Parameters:
arg__1 –
CallMode
arg__2 – str
arg__3 – object
arg__4 – object
arg__5 – object
arg__6 – object
arg__7 – object
- Return type:
- call(arg__1, arg__2, arg__3, arg__4, arg__5, arg__6, arg__7, arg__8)
- Parameters:
arg__1 –
CallMode
arg__2 – str
arg__3 – object
arg__4 – object
arg__5 – object
arg__6 – object
arg__7 – object
arg__8 – object
- Return type:
- call(arg__1, arg__2, arg__3, arg__4, arg__5, arg__6, arg__7, arg__8, arg__9)
- Parameters:
arg__1 –
CallMode
arg__2 – str
arg__3 – object
arg__4 – object
arg__5 – object
arg__6 – object
arg__7 – object
arg__8 – object
arg__9 – object
- Return type:
- call(arg__1, arg__2, arg__3, arg__4, arg__5, arg__6, arg__7, arg__8, arg__9, arg__10)
- Parameters:
arg__1 –
CallMode
arg__2 – str
arg__3 – object
arg__4 – object
arg__5 – object
arg__6 – object
arg__7 – object
arg__8 – object
arg__9 – object
arg__10 – object
- Return type:
- callWithArgumentList(mode, method, args)¶
- Parameters:
mode –
CallMode
method – str
args – .list of QVariant
- Return type:
Places a call to the remote method specified by
method
on this interface, usingargs
as arguments. This function returns the message that was received as a reply, which can be a normalReplyMessage
(indicating success) orErrorMessage
(if the call failed). Themode
parameter specifies how this call should be placed.If the call succeeds,
lastError()
will be cleared; otherwise, it will contain the error this call produced.Normally, you should place calls using
call()
.Warning
If you use
UseEventLoop
, your code must be prepared to deal with any reentrancy: other method calls and signals may be delivered before this function returns, as well as other Qt queued signals and events.- callWithCallback(method, args, receiver, member)¶
- Parameters:
method – str
args – .list of QVariant
receiver –
QObject
member – str
- Return type:
bool
This is an overloaded function.
This function is deprecated. Please use the overloaded version.
Places a call to the remote method specified by
method
on this interface, usingargs
as arguments. This function returns immediately after queueing the call. The reply from the remote function or any errors emitted by it are delivered to theslot
slot on objectreceiver
.This function returns
true
if the queueing succeeded: it does not indicate that the call succeeded. If it failed, the slot will be called with an error message.lastError()
will not be set under those circumstances.See also
- callWithCallback(method, args, receiver, member, errorSlot)
- Parameters:
method – str
args – .list of QVariant
receiver –
QObject
member – str
errorSlot – str
- Return type:
bool
Places a call to the remote method specified by
method
on this interface, usingargs
as arguments. This function returns immediately after queueing the call. The reply from the remote function is delivered to thereturnMethod
on objectreceiver
. If an error occurs, theerrorMethod
on objectreceiver
is called instead.This function returns
true
if the queueing succeeds. It does not indicate that the executed call succeeded. If it fails, theerrorMethod
is called. If the queueing failed, this function returnsfalse
and no slot will be called.The
returnMethod
must have as its parameters the types returned by the function call. Optionally, it may have aQDBusMessage
parameter as its last or only parameter. TheerrorMethod
must have aQDBusError
as its only parameter.Note
Method calls to objects registered by the application itself are never asynchronous due to implementation limitations.
See also
- connection()¶
- Return type:
Returns the connection this interface is associated with.
- interface()¶
- Return type:
str
Returns the name of this interface.
- internalConstCall(mode, method[, args=list()])¶
- Parameters:
mode –
CallMode
method – str
args – .list of QVariant
- Return type:
- internalPropGet(propname)¶
- Parameters:
propname – str
- Return type:
object
- internalPropSet(propname, value)¶
- Parameters:
propname – str
value – object
- isInteractiveAuthorizationAllowed()¶
- Return type:
bool
Returns whether, for asynchronous calls, the caller is prepared to wait for interactive authorization.
The default is
false
.- isValid()¶
- Return type:
bool
Returns
true
if this is a valid reference to a remote object. It returnsfalse
if there was an error during the creation of this interface (for instance, if the remote application does not exist).Note: when dealing with remote objects, it is not always possible to determine if it exists when creating a
QDBusInterface
.- lastError()¶
- Return type:
Returns the error the last operation produced, or an invalid error if the last operation did not produce an error.
- path()¶
- Return type:
str
Returns the object path that this interface is associated with.
- service()¶
- Return type:
str
Returns the name of the service this interface is associated with.
- setInteractiveAuthorizationAllowed(enable)¶
- Parameters:
enable – bool
Configures whether, for asynchronous calls, the caller is prepared to wait for interactive authorization.
If
enable
is set totrue
, the D-Bus messages generated for asynchronous calls via this interface will set theALLOW_INTERACTIVE_AUTHORIZATION
flag.This flag is only useful when unprivileged code calls a more privileged method call, and an authorization framework is deployed that allows possibly interactive authorization.
The default is
false
.- setTimeout(timeout)¶
- Parameters:
timeout – int
Sets the timeout in milliseconds for all future DBus calls to
timeout
. -1 means the default DBus timeout (usually 25 seconds).See also
- timeout()¶
- Return type:
int
Returns the current value of the timeout in milliseconds. -1 means the default DBus timeout (usually 25 seconds).
See also