hp-systray icon does nothing under KDE

Bug #857929 reported by doctordruidphd
16
This bug affects 2 people
Affects Status Importance Assigned to Milestone
hplip (Ubuntu)
Fix Released
High
Unassigned

Bug Description

Description: Ubuntu oneiric (development branch)
Release: 11.10

64-bit

apt-cache policy hplip
hplip:
  Installed: 3.11.7-1ubuntu2
  Candidate: 3.11.7-1ubuntu2
  Version table:
 *** 3.11.7-1ubuntu2 0
        500 http://us.archive.ubuntu.com/ubuntu/ oneiric/main amd64 Packages
        100 /var/lib/dpkg/status

Usually clicking the hp-systray icon brings up the hp-toolbox application.
The problem is that now neither right nor left clicking on the icon brings up anything.
What it does do is start another hp-systray user process.

hp-toolbox application works properly if started from the command line.

Might also be a python (pygtk?) problem, not sure how to determine that.

Related branches

Revision history for this message
Till Kamppeter (till-kamppeter) wrote :
Download full text (6.6 KiB)

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 w...

Read more...

Changed in hplip (Ubuntu):
importance: Undecided → High
milestone: none → ubuntu-11.10
Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in hplip (Ubuntu):
status: New → Confirmed
Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

I have done additional tests and got some debug logs.

I have added

[general]
debug=1

to the end of /etc/xdg/sni-qt.conf to turn on debug logging of sni-qt.

Then I have killed all hp-systray processes (there are usually three) and run

hp-systray --debug > log 2>&1

The icon appeared but clicking on it gives an empty menu (small dark gray rectangle).

The message

/usr/lib/python2.7/dist-packages/gtk-2.0/gtk/__init__.py:127: RuntimeWarning: PyOS_InputHook is not available for interactive use of PyGTK

in the log file makes the impression that GTK is used by hp-systray which would break the automatic use-as-indicator process of sni-qt. So I have searchd for GTK usage in HPLIP and found it only in

/usr/share/hplip/base/utils.py

So I have commented out the appropriate lines (all in the function no_qt_message_gtk()) and added a "return" to the beginning of the function to keep the code in a working state.

Killing all hp-systray processes again andrunning above command line again leads to the exactly same result. Still no menu at the icon and still the GTK message in the log.

Then I went step by step through the code to find what causes the message and it is in

/usr/share/hplip/ui4/systemtray.py

The lines:

try:
    import pynotify
except ImportError:
    have_pynotify = False

cause it. I commented them out and added

have_pynotify = False

after them. This most probably deactivates the notifier. After that and killing and restarting hp-systray the GTK message in the log disappeared, but the indicator icon is still without menu. So this GTK use seems not to have any influence.

The log of this execution is attached to the next comment as log-nogtk.

Revision history for this message
Till Kamppeter (till-kamppeter) wrote :
Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

The problem is probably the following:

I have tried out the bahavior of hp-systray in Natty. If I left-click on the icon nothing happens. If I right-click I get the menu which we want to have, with all printers and the entry for the HP Toolbox. So it seems that sni-qt converts correctly: the non-functional left click is converted to the empty menu and the right-click menu is ignored. So for Oneiric the minimum-invasive solution would be to modify the hp-systray program so that the menu opens on left-click.

In the file

/usr/share/hplip/ui4/systemtray.py

The icon with the menu is made up by the class SystemTrayApp and within this class the menu is built by the method setMenu(). In the end of this method the menu is connected to the right click via

self.tray_icon.setContextMenu(self.menu)

Now I need some Python-Qt expert to patch this code so that the menu opens on the left clcik in Natty and so in Oneiric it appears as the menu of the indicator applet.

Any help is appreciated.

Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

More things I tried:

II found out how to make the menu open on a single left click: In the file

/usr/share/hplip/ui4/systemtray.py

insert the line

        self.menu.popup(QCursor.pos())

right after the commented line '#print "single click"' and before "pass" in the method trayActivated().

On Natty, the menu opens with a single left click then, but on Oneiric still an empty menu opens.

Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

For me it looks like that there is no Activate signal sent from sni-qt to hp-systray.

Revision history for this message
doctordruidphd (doctordruidphd) wrote :

-------------------------------------------
/usr/share/hplip/ui4/systemtray.py

insert the line

        self.menu.popup(QCursor.pos())

right after the commented line '#print "single click"' and before "pass" in the method trayActivated().
------------------------------------------

This fixed it on my oneiric installation.
Left clicking brings up the menu, and clicking items in the menu works as expected.

Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

Seems that I have fixed the bug reported here, but seems that I have also another bug. For me the icon does not appear after login (but hp-systray is running and shows notification pop-ups when I print). Only when I kill hp-systray and start it again from the command line I get the icon. And clicking it gives only the mentioned empty menu, with and without the patch from comment #6.

Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

Reported my problem of the previous comment as bug 860395.

Changed in hplip (Ubuntu):
status: Confirmed → Triaged
Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

doctordruidphd, can you tell us which kind of desktop you are using (Unity, GNOME classic, KDE, ...)?

Revision history for this message
doctordruidphd (doctordruidphd) wrote :

This is kde-4.7.1
64-bit kubuntu oneiric, all current updates applied.

summary: - hp-systray icon does nothing
+ hp-systray icon does nothing under KDE
Changed in hplip (Ubuntu):
status: Triaged → In Progress
Changed in hplip (Ubuntu):
status: In Progress → Fix Committed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package hplip - 3.11.7-1ubuntu3

---------------
hplip (3.11.7-1ubuntu3) oneiric; urgency=low

  * debian/patches/hp-systray-make-menu-title-visible-in-sni-qt-indicator.dpatch:
    Simplified the construction of the title line of the hp-systray applet
    menu, so that the applet-to-indicator converter sni-qt also imports this
    title line (at least the text of it). Thanks to Aurelien Gateau for this
    patch.
  * debian/patches/hp-systray-make-menu-appear-in-sni-qt-indicator-with-kde.dpatch:
    Make the menu of the hp-systray applet appearing when the applet is
    converted to an indicator applet by sni-qt and put into the notification
    area of KDE (LP: #857929).
 -- Till Kamppeter <email address hidden> Tue, 27 Sep 2011 17:13:00 +0200

Changed in hplip (Ubuntu):
status: Fix Committed → Fix Released
Revision history for this message
doctordruidphd (doctordruidphd) wrote :

Fix applied, now it works.

I notice one strange thing: If I LEFT click on the icon, it works normally. If I RIGHT click on the icon, a menu comes up that looks similar, but it does not have the quit, settings, and "HPLIP Service Status" icons that are visible in the left-click version.

No big deal, it works now, but looks a little strange.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.