tag:blogger.com,1999:blog-34112729.post4233955369513447472..comments2024-01-27T10:21:16.573+01:00Comments on Martin Vidner: KNotify ClientMartin Vidnerhttp://www.blogger.com/profile/08755880808140601974noreply@blogger.comBlogger22125tag:blogger.com,1999:blog-34112729.post-60903106311766455362010-04-16T18:30:56.675+02:002010-04-16T18:30:56.675+02:00The method not works for me.
KDE 4.4.2 | QT 4.6.2
...The method not works for me.<br />KDE 4.4.2 | QT 4.6.2<br /><br />a perl script works for me:<br /><br />#!/usr/bin/perl -w<br /><br />use strict;<br />use Net::DBus;<br /><br />my $bus = Net::DBus->session;<br />my $service = $bus->get_service("org.kde.knotify");<br />my $object = $service->get_object("/Notify", "org.kde.KNotify");<br />$object->event("warning", "kde", [], "message title","message text", [], [], 5*1000, 0);<br /><br /><br />And in QT it looks like:<br /><br /> QDBusInterface knotify("org.kde.knotify", "/Notify", "org.kde.KNotify");<br /> QList args;<br /> args.append(QVariant("warning"));<br /> args.append(QVariant("kde"));<br /> args.append(QVariant(QVariant::List));<br /> args.append(QVariant("Message Title"));<br /> args.append(QVariant("Message Text"));<br /> args.append(QVariant(QVariant::ByteArray));<br /> args.append(QVariant(QVariant::StringList));<br /> args.append(QVariant((int)5000));<br /> args.append(QVariant(QVariant::LongLong));<br /><br /> knotify.callWithArgumentList( QDBus::AutoDetect, "event", args );<br />}sassmanhttp://www.lubico.biznoreply@blogger.comtag:blogger.com,1999:blog-34112729.post-31875159526577958272009-12-31T08:53:44.191+01:002009-12-31T08:53:44.191+01:00thanks for your"KNotify Client"thanks for your"KNotify Client"XG-網頁設計http://webdesign.zoapcon.comnoreply@blogger.comtag:blogger.com,1999:blog-34112729.post-82643627614480836792009-12-15T16:16:52.400+01:002009-12-15T16:16:52.400+01:00a last one - hopefully - do you happen to know how...a last one - hopefully - do you happen to know how to make the notification expire after some time?<br /><br />It does "vanish" from the OSD, but then it is still there and does not expire before one clicks the X...Svennoreply@blogger.comtag:blogger.com,1999:blog-34112729.post-92111952129155617232009-12-14T15:59:21.836+01:002009-12-14T15:59:21.836+01:00got it, it's
(for me): ssavssayasix
(for you)...got it, it's<br />(for me): ssavssayasix<br />(for you): ssavssayasx<br /><br />i=kn.event("warning", "kde", [], 'Notification', text, [0,0,0,0], [], 0, 0, dbus_interface='org.kde.KNotify')<br /><br />(note the second 0 before dbus_interface), then it works.<br /><br />Thanks for helping me to find it.<br /><br />Yep - this API is as broken as undocumented. I guess it is because in KDE4.3+ there are diffrerent kinds of notificationsSvennoreply@blogger.comtag:blogger.com,1999:blog-34112729.post-17560158416087793062009-12-14T15:53:58.834+01:002009-12-14T15:53:58.834+01:00ERROR:dbus.connection:Unable to set arguments (...ERROR:dbus.connection:Unable to set arguments ('warning', 'kde', [], 'Notification', message, [0, 0, 0, 0], [], 0) according to signature u'ssavssayasix': <type 'exceptions.TypeError'>: More items found in D-Bus signature than in Python arguments<br />Traceback (most recent call last):<br /> File "feierabend.py", line 12, in <module><br /> i=kn.event("warning", "kde", [], "Notification", text, [0,0,0,0], [], 0, dbus_interface='org.kde.KNotify')<br /> File "/usr/lib/pymodules/python2.6/dbus/proxies.py", line 68, in __call__<br /> return self._proxy_method(*args, **keywords)<br /> File "/usr/lib/pymodules/python2.6/dbus/proxies.py", line 140, in __call__<br /> **keywords)<br /> File "/usr/lib/pymodules/python2.6/dbus/connection.py", line 610, in call_blocking<br /> message.append(signature=signature, *args)<br />TypeError: More items found in D-Bus signature than in Python arguments<br /><br /><br />cool, that makes it even more broken...<br />I'm using KDE 4.3.2 in Kubuntu 9.10.Svennoreply@blogger.comtag:blogger.com,1999:blog-34112729.post-77298075235395302652009-11-28T08:42:49.619+01:002009-11-28T08:42:49.619+01:00ERROR:dbus.connection:Unable to set arguments (...<i>ERROR:dbus.connection:Unable to set arguments ('warning', 'kde', [], mytext, [0, 0, 0, 0], [], 0) according to signature u'ssavssayasix': <type 'exceptions.TypeError'>: Expected a string or unicode object</i><br /><br />Oh nice, the API has changed in the meantime and now it expects 9 arguments instead of 7. Which KDE release are you using (on which distro)? Even more fun is that on my openSUSE 11.2, with KDE 4.3.1, there are 8 arguments (ssavssayasx).<br /><br />In my case, the change is from one message string to two strings, a header and a message.<br />- kn.event("warning", "kde", [], m, [0,0,0,0], [], 0, ...<br />+ kn.event("warning", "kde", [], "Notification", m, [0,0,0,0], [], 0, ...<br /><br />For me it only proves that this API is hopeless.Martin Vidnerhttps://www.blogger.com/profile/08755880808140601974noreply@blogger.comtag:blogger.com,1999:blog-34112729.post-45981096416447369362009-11-24T15:48:31.392+01:002009-11-24T15:48:31.392+01:00Hi, a year went by and I still seem to have proble...Hi, a year went by and I still seem to have problems with this:<br /><br />ERROR:dbus.connection:Unable to set arguments ('warning', 'kde', [], mytext, [0, 0, 0, 0], [], 0) according to signature u'ssavssayasix': <type 'exceptions.TypeError'>: Expected a string or unicode object<br /><br />I tried to apply the named patch, but that did not change anything. I'm not too much into programming, but I seem to be getting<br /><br />ssavssayasix whereas you state that<br />ssavsayasx is correct<br /><br />Trying td sed one to the other did not help either.<br /><br />Any ideas?<br /><br />This cannot be so difficult...<br /><br />Thanks in advance,<br />SvenSvennoreply@blogger.comtag:blogger.com,1999:blog-34112729.post-81899116506215161802008-11-02T12:33:00.000+01:002008-11-02T12:33:00.000+01:00Hey everyone!try kdebindings/dcoppython :)Hey everyone!<BR/>try kdebindings/dcoppython :)Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-34112729.post-5715144613578431382008-08-21T18:59:00.000+02:002008-08-21T18:59:00.000+02:00Thank you! And thanks to Seli =)Thank you! And thanks to Seli =)Thomas Ahttps://www.blogger.com/profile/15295996665675046172noreply@blogger.comtag:blogger.com,1999:blog-34112729.post-8122169866578525112008-08-20T15:51:00.000+02:002008-08-20T15:51:00.000+02:00> My question is, do you know any documents abo...> <I>My question is, do you know any documents about this? (Google didnt turn up anything)</I><BR/><BR/>So I paid a visit to <A HREF="http://www.kdedevelopers.org/blog/280" REL="nofollow">Seli's</A> desk and got pointed to <A HREF="http://api.kde.org/4.x-api/kdelibs-apidocs/kdeui/html/classKNotification.html" REL="nofollow">KNotification Class Reference</A>.<BR/><BR/>He also <A HREF="http://websvn.kde.org/?view=rev&revision=849931" REL="nofollow">fixed</A> the introspection data, grumbling that it should be autogenerated in the first place.<BR/><BR/>With the <A HREF="http://news.opensuse.org/2008/08/07/announcing-hack-week-iii/" REL="nofollow">Hack Week 3</A> coming, there is some likelihood that we will make a proper command line client (whatever proper means) :-)Martin Vidnerhttps://www.blogger.com/profile/08755880808140601974noreply@blogger.comtag:blogger.com,1999:blog-34112729.post-4718961415036443682008-08-20T10:30:00.000+02:002008-08-20T10:30:00.000+02:00Yes, notice the part "a(ss)" in the traceback. Tha...Yes, notice the part "a(ss)" in the traceback. That is incorrect introspection data (should be "av") and Python gets confused by it. That's why I patched the knotify4 binary.Martin Vidnerhttps://www.blogger.com/profile/08755880808140601974noreply@blogger.comtag:blogger.com,1999:blog-34112729.post-81126890336408555922008-08-18T10:48:00.000+02:002008-08-18T10:48:00.000+02:00Have you tried applying the patch to knotify?Have you tried applying the patch to knotify?Thomas Ahttps://www.blogger.com/profile/15295996665675046172noreply@blogger.comtag:blogger.com,1999:blog-34112729.post-54922646644014053492008-08-18T08:41:00.000+02:002008-08-18T08:41:00.000+02:00I've been playing with this for a while, but when ...I've been playing with this for a while, but when I run either the given python or perl scripts I run into this:<BR/><BR/>python test.py hello<BR/>Traceback (most recent call last):<BR/> File "test.py", line 4, in module<BR/> i = kn.event("warning", "kde", [], 'test', [0,0,0,0], [], 0, dbus_interface="org.kde.KNotify")<BR/> File "/var/lib/python-support/python2.5/dbus/proxies.py", line 68, in __call__<BR/> return self._proxy_method(*args, **keywords)<BR/> File "/var/lib/python-support/python2.5/dbus/proxies.py", line 140, in __call__<BR/> **keywords)<BR/> File "/var/lib/python-support/python2.5/dbus/connection.py", line 622, in call_blocking<BR/> message, timeout)<BR/>dbus.exceptions.DBusException: org.freedesktop.DBus.Error.UnknownMethod: No such method 'event' in interface 'org.kde.KNotify' at object path '/Notify' (signature 'ssa(ss)sayasx')<BR/><BR/><BR/>'qdbus org.kde.knotify /Notify' doesn't show an event method, but if I run dbus-monitor I can watch konsole generating messages with the event method (the watch-for-activity thing)<BR/><BR/>Any guesses?Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-34112729.post-14594497770863668162008-08-05T13:22:00.000+02:002008-08-05T13:22:00.000+02:00I found that there are files called app_name.notif...I found that there are files called app_name.notifyrc in ~/.kde/share/config and ${KDE_PATH}/share/apps/*/<BR/><BR/>I made my own called emacs.notifyrc and added this:<BR/>[Event/erc_nick]<BR/>Action=Sound|Popup|Taskbar<BR/>Sound=KDE-Im-Message-In.ogg<BR/><BR/>and changed "warning" and "kde" to "erc_nick" and "emacs" in the function call.<BR/><BR/>This gives me a notification with the right sound and Emacs icon =D<BR/><BR/>My question is, do you know any documents about this? (Google didnt turn up anything)Thomas Ahttps://www.blogger.com/profile/15295996665675046172noreply@blogger.comtag:blogger.com,1999:blog-34112729.post-15217118999461012572008-08-04T22:50:00.000+02:002008-08-04T22:50:00.000+02:00Good for you. I was just about to point to section...Good for you. I was just about to point to section "3.1 Input parameters" of emacs/info/dbus.<BR/><BR/>Yes, Perl and Python do a better job because they introspect the method call first to learn the expected types. That is also why I originally had to patch the introspection data in the knotify4 binary.Martin Vidnerhttps://www.blogger.com/profile/08755880808140601974noreply@blogger.comtag:blogger.com,1999:blog-34112729.post-14255951038180929092008-08-04T22:38:00.000+02:002008-08-04T22:38:00.000+02:00Yay! I got it! It was hell figuring out without go...Yay! I got it! It was hell figuring out without good docs :P<BR/><BR/>After fiddling with dbus-monitor and seeing the exact same output I started to look at the signature and realized what you meant ;)<BR/><BR/>After trying to combine variant with the strings and arrays until I almost gave up I tried putting it in the first array, and voila!<BR/><BR/> (dbus-call-method :session "org.kde.knotify" "/Notify" "org.kde.KNotify"<BR/> "event"<BR/> "warning" "kde" '(:array (:variant nil)) "message" '(:array :byte 0 :byte 0 :byte 0 :byte 0) '(:array) :int64 0)<BR/><BR/>I must say python and perl are much better guessers.<BR/><BR/>Here is my perl test code for the interested:<BR/>#!/usr/bin/perl<BR/><BR/>use Net::DBus;<BR/><BR/>my $bus = Net::DBus->session;<BR/><BR/>my $service = $bus->get_service("org.kde.knotify");<BR/><BR/>my $object = $service->get_object("/Notify", "org.kde.KNotify");<BR/><BR/>$object->event("warning", "kde", [], "message", [0, 0, 0, 0], [], 0);<BR/><BR/><BR/>(Im axl btw, changed my name on the google settings page ;))Thomas Ahttps://www.blogger.com/profile/15295996665675046172noreply@blogger.comtag:blogger.com,1999:blog-34112729.post-43331113025167579642008-08-04T20:19:00.000+02:002008-08-04T20:19:00.000+02:00"Oh, Emacs :-) Did you have to build it yourself o...<I>"Oh, Emacs :-) Did you have to build it yourself or are there packages with DBus support included?"</I><BR/><BR/>emacs-cvs in Gentoo Portage =)<BR/><BR/><I>"Let's see, the backtrace includes signature 'ssbsaubu' whereas the expected signature is ssavsayasx."</I><BR/><BR/>Rebuilt kde today (svn :P), applied your patch and got this signature now:<BR/>ssassauasu<BR/>(still works with python code)<BR/><BR/><I>"One thing, where you use '() to mean an empty list it gets transformed to nil of type boolean(b)."</I><BR/><BR/>Updated my command:<BR/> (dbus-call-method :session "org.kde.knotify" "/Notify" "org.kde.KNotify"<BR/> "event"<BR/> "warning" "kde" '(:array) "message" '(:array 0 0 0 0) '(:array) 0)<BR/><BR/><I>"Another, the numbers come out as u instead of y and x."</I><BR/><BR/>What do you mean? Please explain ;)<BR/><BR/><BR/>And thanks for the quick response!Thomas Ahttps://www.blogger.com/profile/15295996665675046172noreply@blogger.comtag:blogger.com,1999:blog-34112729.post-26976109665395289032008-08-04T18:09:00.000+02:002008-08-04T18:09:00.000+02:00Oh, Emacs :-) Did you have to build it yourself or...Oh, Emacs :-) Did you have to build it yourself or are there packages with DBus support included?<BR/><BR/>Let's see, the backtrace includes <B>signature 'ssbsaubu'</B> whereas the expected signature is <B>ssavsayasx</B>. One thing, where you use <B>'()</B> to mean an empty list it gets transformed to <B>nil</B> of type boolean(b). Another, the numbers come out as <B>u</B> instead of <B>y</B> and <B>x</B>. You will have to consult (or bugfix) the Emacs DBus binding to get the right types.Martin Vidnerhttps://www.blogger.com/profile/08755880808140601974noreply@blogger.comtag:blogger.com,1999:blog-34112729.post-54153251000035339472008-08-04T17:45:00.000+02:002008-08-04T17:45:00.000+02:00Can't get this to work in Emacs =/ (dbus-call-met...Can't get this to work in Emacs =/<BR/><BR/> (dbus-call-method :session "org.kde.knotify" "/Notify" "org.kde.KNotify"<BR/> "event"<BR/> "warning" "kde" '() "message" '(0 0 0 0) '() 0)<BR/><BR/>renders:<BR/>Debugger entered--Lisp error: (dbus-error "No such method 'event' in interface 'org.kde.KNotify' at object path '/Notify' (signature 'ssbsaubu')")<BR/> dbus-call-method(:session "org.kde.knotify" "/Notify" "org.kde.KNotify" "event" "warning" "kde" nil "message" (0 0 0 0) nil 0)<BR/> eval((dbus-call-method :session "org.kde.knotify" "/Notify" "org.kde.KNotify" "event" "warning" "kde" (quote nil) "message" (quote (0 0 0 0)) (quote nil) 0))<BR/> eval-last-sexp-1(nil)<BR/> eval-last-sexp(nil)<BR/> call-interactively(eval-last-sexp nil nil)<BR/><BR/><BR/>I have patched knotify4 and it works with the python example.Thomas Ahttps://www.blogger.com/profile/15295996665675046172noreply@blogger.comtag:blogger.com,1999:blog-34112729.post-43237501951372964182008-07-17T16:55:00.000+02:002008-07-17T16:55:00.000+02:00I think the command korshak is looking for is kdia...I think the command korshak is looking for is kdialog:<BR/><BR/>$ kdialog --title "This is a passive popup" --passivepopup "It will disappear in about 10 seconds" 2Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-34112729.post-6233687528180237112008-06-11T15:21:00.000+02:002008-06-11T15:21:00.000+02:00No. But IMO such API is overkill and we need a sim...No. But IMO such API is overkill and we need a simpler one.Martin Vidnerhttps://www.blogger.com/profile/08755880808140601974noreply@blogger.comtag:blogger.com,1999:blog-34112729.post-70793878360656367702008-06-11T15:01:00.000+02:002008-06-11T15:01:00.000+02:00Its a bit hacky, but ok. Do you know what these ot...Its a bit hacky, but ok. Do you know what these other parameters are for?Anonymousnoreply@blogger.com