maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Development (https://talk.maemo.org/forumdisplay.php?f=13)
-   -   QT Message boxes (PyQT) like hildon note? (https://talk.maemo.org/showthread.php?t=46341)

noobmonkey 2010-03-03 08:33

Re: QT Message boxes (PyQT) like hildon note?
 
Quote:

Originally Posted by attila77 (Post 553262)
You could cheat, too... Here's a snippet (in C++, but I'd say your a pro enough by now to convert it to Python without any problems :) ). Ugly, but works in Qt4.5, too.

Code:

void MyClass::notify(QString text)
{
    QDBusMessage msg = QDBusMessage::createMethodCall("org.freedesktop.Notifications",
      "/org/freedesktop/Notifications",
      "org.freedesktop.Notifications",
      "SystemNoteDialog");

    QList<QVariant> args;
    args.append(text);
    args.append(static_cast<quint32>(0));
    args.append("ok");

    msg.setArguments(args);

    QDBusConnection::systemBus().call(msg);
}


ahhhh thats the way ;) - nothing wrong with a good bit of cheating :D

Thank you very much Attila :D

noobmonkey 2010-03-03 08:52

Re: QT Message boxes (PyQT) like hildon note?
 
Quote:

Originally Posted by attila77 (Post 553262)
You could cheat, too... Here's a snippet (in C++, but I'd say your a pro enough by now to convert it to Python without any problems :) ).


Well, it's not quite a function yet, but it is quite sexy i'd say...

Code:

bus = dbus.SessionBus()
        proxy = bus.get_object('org.freedesktop.Notifications', '/org/freedesktop/Notifications')
        interface = dbus.Interface(proxy,dbus_interface='org.freedesktop.Notifications')


        interface.Notify('Healthcheck', 0, '', 'W0000p', 'I R Sexy', [], {}, 2000)


noobmonkey 2010-03-03 10:03

Re: QT Message boxes (PyQT) like hildon note?
 
Working fine, apart from an odd icon picture, think i need to get the application title part correct to fix that, not sure :) - but does what i wanted it too! :D

Yay with cherries on top!!!

AlphaX2 2011-07-15 07:29

Re: QT Message boxes (PyQT) like hildon note?
 
Hildon Banner is also available for PyQt. You have to:

Code:

from QtMaemo5 import QMaemo5InformationBox
and than for showing them, for example:

Code:

QMaemo5InformationBox.information(None, QString(warning), 2500)
2500 - how long to show it (in milliseconds). If it's 0 you have to click.

Hope it will help you! :D


All times are GMT. The time now is 23:26.

vBulletin® Version 3.8.8