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

List:       pykde
Subject:    Re: Pass QIcon over D-Bus
From:       Florian Bruhin <me () the-compiler ! org>
Date:       2022-06-15 14:36:25
Message-ID: 20220615143625.toyoqsf2xfvi3apy () aragog
[Download RAW message or body]


Hey,

On Wed, Jun 15, 2022 at 04:12:13PM +0200, JakobDev wrote:
> There is a working C++ implementation but I couldn't get it to work in
> Python.

Qt DBus is still a lot of black magic to me, but I noticed that you do:

    QIcon.fromTheme("utilities-terminal").pixmap(512, 512).save(buffer, "PNG")
    [...]
    message.setArguments(["", "Name", QDBusVariant(buffer), {}])

while the C++ code does:

    QIcon::fromTheme("utilities-terminal").pixmap(maxSize, \
maxSize).save(&buffer,"PNG");  PortalIcon icon {QStringLiteral("bytes"), \
QDBusVariant(buffer.buffer())};

    message << parentWindowId() << QStringLiteral("Patschen")
            << QVariant::fromValue(QDBusVariant(QVariant::fromValue(icon)))
            << ...

You seem to be missing the second step there: creating a PortalIcon
object with the "bytes" string in it, and the actual data from the
QBuffer (as a QByteArray).

I don't know how far it'll get you, but I do something vaguely similar
here:
https://github.com/qutebrowser/qutebrowser/blob/v2.5.1/qutebrowser/browser/webengine/notification.py#L1047-L1048


The data is then added here:
https://github.com/qutebrowser/qutebrowser/blob/v2.5.1/qutebrowser/browser/webengine/notification.py#L1096


Florian

-- 
            me@the-compiler.org | https://www.qutebrowser.org 
       https://bruhin.software/ | https://github.com/sponsors/The-Compiler/
       GPG: 916E B0C8 FD55 A072 | https://the-compiler.org/pubkey.asc
             I love long mails! | https://email.is-not-s.ms/


["signature.asc" (application/pgp-signature)]

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

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