Colin/Thiago,<br><br>Thank you very much for the detailed responses, this will point me in the right direction.<br><br>BTW, Thiago, you are correct, HPLIP's GUIs are written in Python/PyQt3. Part of the move to dbus is also to move from PyQt3 to PyQt4. Fortunately, there are Qt compatible dbus bindings now including a Qt mainloop, so writing the GUI code should be relatively straightforward. I will still need to make use of C/C++ dbus libraries for the CUPS backend, SANE backend, etc. that are not written in Python. The most complicated portion of HPLIP that will make use of dbus is the PC send fax subsystem, and it is written entirely in Python, so I am lucky there.
<br><br>Regards,<br><br>Don<br><br><br><div class="gmail_quote">On Dec 13, 2007 11:48 PM, Thiago Macieira <<a href="mailto:thiago@kde.org">thiago@kde.org</a>> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="Ih2E3d">dwelch91 wrote:<br>>1. If the system tray applet is running as a regular user (and there<br>> could be multiple copies running in a multiuser scenario), I assume<br>> that there is some prohibition to communicating with processes that are
<br>> running as root, lp, lpadmin, etc? <br><br></div>No, there should be no problem.<br><div class="Ih2E3d"><br>> Would the System bus be the required bus to use?<br><br></div>Yes, you need to use the System bus, because:
<br><div class="Ih2E3d"><br>> Or, can processes that are running as different<br>> users from the logged on user communicate on the user's Session bus?<br><br></div>You cannot connect to another user's session bus. dbus-daemon enforces a
<br>matching UID. That includes root.<br><div class="Ih2E3d"><br>>2. It seems that using a 1:n signal makes the most sense to broadcast<br>> status updates to all running system tray applets? Each applet would<br>> have to have a unique bus name?
<br><br></div>Yes, a simple signal from the privileged service to all system tray<br>applets would be enough for status updates. The receivers do not require<br>anything special to listen for signals, not even unique bus names. The
<br>service, however, should have a unique name.<br><div class="Ih2E3d"><br>>3. I understand that it is possible to have dbus launch processes<br>>automatically in response to a message. Would it be possible to have the
<br>>system tray applet launch a, for example, a fax send GUI in response to<br>> a message from the fax CUPS backend (hpfax:)?<br><br></div>Yes, but only in not-yet-released versions of D-Bus. If you intend on<br>supporting currently existing Linux distributions, I recommend you don't
<br>depend on that feature. Instead, make the privileged service launch it as<br>needed.<br><br>By privileged service, I mean whatever is started by root during system<br>initialisation. It doesn't have to stay running as root if it doesn't
<br>have to. In fact, if it can drop privileges, it would be much better.<br><div class="Ih2E3d"><br>>4. The processes that will be simply sending events to the applet will<br>> not have to run a dbus mainloop, correct?
<br><br></div>Correct. But the "processes that will be simply sending events to the<br>applet" is generally the privileged service. That one should be running<br>an event loop to receive requests from applets and user programs --
<br>like, "give me the printer status".<br><br>On the system bus, we generally enforce some extra policy rules, meaning<br>that we allow certain messages only to come from some users. If you're<br>planning on having an ephemeral process connect to the bus, send a
<br>message to all listeners and disconnect (which means it doesn't require a<br>mainloop), be sure that said process runs under the correct user ID.<br><div class="Ih2E3d"><br>>5. Any other considerations or gotchas I need to be aware of?
<br><br></div>IIRC, hplip had its GUI written in PyQt. I have no idea how the support<br>for D-Bus is in PyQt, but I know that other Qt language bindings like C#<br>and Ruby have it. It's notably missing from QtJambi though, but there's
<br>the Java bindings there. Then again, there's a native Python binding<br>there as well.<br><br>There are a couple of things I could do to QtDBus to make it even easier<br>to bind with, but I have not heard from PyQt developers, so I have no
<br>idea if they have some difficulty or not. But you can refer them to me if<br>they need anything in order to support something for you.<br><br>Another suggestion: using libdbus-1 directly will make your life<br>considerably more difficult. If you can use a binding, do it.
<br><font color="#888888"><br>--<br> Thiago Macieira - thiago (AT) <a href="http://macieira.info" target="_blank">macieira.info</a> - thiago (AT) <a href="http://kde.org" target="_blank">kde.org</a><br> PGP/GPG: 0x6EF45358; fingerprint:
<br> E067 918B B660 DBD1 105C 966C 33F5 F005 6EF4 5358<br></font></blockquote></div><br>