Comment 1 for bug 857929

Revision history for this message
Till Kamppeter (till-kamppeter) wrote : Re: hp-systray icon does nothing

Seems that the only solution is to port hp-systray to be an indicator. Problem is that it is a Python program with Qt GUI, automatic selector between Qt3 and Qt4, a D-Bus server for notifications and fax jobs to pop up hp-sendfax, and the GUI is one thread in a multi-threaded program. The only thing which does not work is the icon. It shows empty menus on clicking and sometimes it does not appear at all. All the D-Bus services for notifications and fax jobs work perfectly.

agateau, tedg, any further help is welcome.

Here is our IRC discussion on #ubuntu-desktop on Freenode on Sep 26, 2001:

<tkamppeter> Anyone of the desktop experts, rodrigo_ seb128, pitti, has an idea about what is happening in bug 857929? It is about the systray icon of HPLIP not working (it should be whitelisted). For me it is even worse, for me the icon does not appear at all.
<ubot2> Launchpad bug 857929 in hplip "hp-systray icon does nothing" [Undecided,New] https://launchpad.net/bugs/857929
<seb128> tkamppeter, do you have sni-qt installed?
<seb128> tkamppeter, we moved away from using the whitelist for qt application to use sni-qt which transform qt systray icons to indicators
<didrocks> tkamppeter: sni-qt should take your systray and convert to an indicator and show it for you
<tkamppeter> seb128, it is installed. How do I make it applying to hp-systray?
<didrocks> tkamppeter: it should appear without the need to do anything
<didrocks> tkamppeter: you can turn some debug on: edit /etc/xdg/sni-qt.conf
<didrocks> then add:
<didrocks> [general]
<didrocks> debug=1
<didrocks> run hplip and send to agateau the output
<tkamppeter> didrocks, first, I have added "hp-systray=1" to the file, this brought me on par with the bug, I get the icon and not the menus. Now I will try the debug mode ...
<didrocks> tkamppeter: please remove hp-systray=1 to the file, this is not needed
<didrocks> tkamppeter: when you click on the icon, there is a menu showing normally, isn't it?
<tkamppeter> When I restarted hp-systray, already before adding the debug mode, I got a message on the terminal: /usr/lib/python2.7/dist-packages/gtk-2.0/gtk/__init__.py: RuntimeWarning: PyOS_InputHook is not available for interactive use of PyGTK set_interactive(1)
<tkamppeter> didrocks, now I will try debug mode and hp-systray removed.
<didrocks> hum? it's using gtk, not Qt?
<tkamppeter> didrocks, I am wondering, too.
<tkamppeter> Now I have restarted hp-systray again. Got an icon again, and empty menus when clicking.
<tkamppeter> I got also this GTK error message again.
<tkamppeter> didrocks, ^^
<didrocks> tkamppeter: try at least to know if it's using Qt or Gtk (try ldd the binary)
<tkamppeter> didrocks, it is a Python program, I cannot ldd that.
<didrocks> ah, ok, does it import Qt or something like that?
<didrocks> tkamppeter: open it then and look if there are some import gtk or import Qt
<tkamppeter> didrocks, I have grepped all .py files in /usr/share/hplip and subdirectories for GTK. There are three which use the string gtk or GTK somewhere.
<didrocks> tkamppeter: so seems you are using GTK. it should have been converted as an indicator then
<didrocks> tkamppeter: well, someone should have done this work
<didrocks> seems not, I don't get why you have the icon sometimes, needs more info and debugging from you I guess
<tkamppeter> didrocks, I did not know that it gets that complicated.
<seb128> didrocks, tkamppeter: it's weird, I'm pretty sure hplip is using qt, that's why we didn't take it on the CD before
<didrocks> seb128: that was my thought as well, I'm really surprised
<didrocks> I guess the one wanting that on the CD should debug this and have a clear story there :)
<seb128> yeah
<seb128> but anyway, I'm out for an hour of sport outside
<seb128> weather is nice and it's still day time
<seb128> bbl
<didrocks> seb128: enjoy!
<seb128> didrocks, thanks ;-)
<tkamppeter> didrocks, I have checked, systray imports only base/utils.py from the three .py files with gtk inside. And utils.py only uses GTK if it does not find Qt, to pop up an error dialog.
<didrocks> tkamppeter: it should never show an indicator then, it's weird you get the icones sometimes. Anyway, you should port it to an indicator
<tkamppeter> didrocks, perhaps systray is not able to find Qt (but hp-toolbox does) and then gives this error, but how does the icon appear then.
<tkamppeter> didrocks, seems to be a major Ubuntu-specific patch needed still for Oneiric.
<didrocks> tkamppeter: yeah, a pity that it wasn't tested before :(
<tkamppeter> didrocks, now I have simply comment out this GTK dialog in base/utils.py. I do not get the GTK message any more but a lot of debug messages of sni-qt.
<didrocks> tkamppeter: something is weird, it's an app mixing gtk and Qt apparently
<tkamppeter> didrocks, http://paste.ubuntu.com/697358/
<tkamppeter> didrocks, clicking the icon (and receiving the empty menu) does not add more debug messages.
<tkamppeter> didrocks, this one error dialog which I have commented out now was the only GTK code in HPLIP.
<tkamppeter> didrocks?
<didrocks> tkamppeter: you need to port to an indicator if the systray usage is not an indicator
<didrocks> as it's in python, it's pretty easy, and you should ask tedg if you need any help (I think he will point you to the classroom he made)
<didrocks> time for some exercice, have a good night everyone!
* didrocks has quit (Quit: WeeChat 0.3.5)
<tkamppeter> tedg, can you point me to a HOWTO to pass a systray icon of a Python program to an indicator applet? Thanks.
<tedg> tkamppeter, You can use the new fancy http://developer.ubuntu.com/ :-)
<tedg> tkamppeter, Specifically these: https://wiki.ubuntu.com/DesktopExperienceTeam/ApplicationIndicators
<tedg> tkamppeter, and: http://developer.ubuntu.com/api/ubuntu-11.04/GIR/python/AppIndicator-0.1.html
<tkamppeter> tedg, thanks. The sample Python program is only GTK, do I have to do the indicator in GTK?
<tkamppeter> I also tried to run this sample program. No icon appeared and the mouse cursor got a cross, like a + and one could not click anything yuntil stopping the applet with Ctrl+C.
<tkamppeter> tedg, ^^
<tkamppeter> tedg, the little program works now. Is there no way to make an indicator-applet in Python with Qt?
<tkamppeter> tedg, and how do I add a different right-click menu?
<tedg> tkamppeter, If it's a KDE application you can just use the KDE libs SNI library.
<tedg> tkamppeter, There is no right click menu. We don't support that. Single menu only.
<tedg> tkamppeter, If you use the Qt status item, and you have qt-sni installed, it should "just work" :-)
<tkamppeter> tedg, what is the qt status item?
<tedg> tkamppeter, I'm not sure, you'll have to ask agateau that one :-)