[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    Re: QDBusContext / sending error replies via DBus
From:       Phil Thompson <phil () riverbankcomputing ! com>
Date:       2022-06-20 16:30:56
Message-ID: a2c663d9d5b18e589b272f0bbab35a1b () riverbankcomputing ! com
[Download RAW message or body]

On 20/06/2022 17:15, Florian Bruhin wrote:
> Hey,
> 
> I currently have this working example of a DBus service implemented via
> PyQt:
> https://github.com/qutebrowser/qutebrowser/blob/master/tests/end2end/fixtures/notificationserver.py#L45
> 
> Now I'd like to return an error reply to the DBus client in certain
> circumstances. How can I do that? With normal Qt code, one would
> apparently inherit from QDBusContext instead of QObject, and use
> sendErrorReply(): https://doc.qt.io/qt-6/qdbuscontext.html
> 
>     When a slot is called in an object due to a signal delivery or due
>     to a remote method call, it is sometimes necessary to know the
>     context in which that happened. In particular, if the slot
>     determines that it wants to send the reply at a later opportunity 
> or
>     if it wants to reply with an error, the context is needed.
> 
> However, that class seems to be missing in both PyQt5 and PyQt6.

The docs suggest inheriting from QDBusContext *and* QObject. That 
suggests creating a QPyDBusQObjectWithContext class in C++ and wrapping 
that. There must be a reason why Qt doesn't contain such a class.

Phil
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic