python-notify add_action doesn't work in gtk code

Bug #185262 reported by Andrew
18
This bug affects 3 people
Affects Status Importance Assigned to Milestone
notify-python (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

Binary package hint: python-notify

When I use n.add_action from main I get the callback. However, if I call it from inside of my UI (specifically code using gtk.StatusIcon), I never get the callback.

I am using
gtk.gdk.threads_init()
gtk.gdk.threads_enter()
and
gtk.gdk.threads_leave()

in this application as well, if that makes a difference

When it is working in my main method, the notification is shown before calling gtk.main().

There are no errors and n.show() returns true. The only issue is that the action button never invokes the callback.

It looks like I am not the only one with this issue:
http://<email address hidden>/msg00566.html

In there you see:
#FIXME: following action do not work. the call back function is never called
#notification.add_action("show", "show", self.__action_callback)
#notification.add_action("exit", "exit gPodder", self.__action_callback)
#notification.add_action("ignore", "ignore", self.__action_callback)

Revision history for this message
Andrew (andrew-rw-robinson) wrote :

Found in Xubuntu Gutsy i386

python-notify 0.1.1-1ubuntu2

Revision history for this message
Andrew (andrew-rw-robinson) wrote :

It seems to not work if raised from a method. I have attached a simple test script

Revision history for this message
Matthias Klose (doko) wrote :

please could you recheck with the version in hardy?

Changed in notify-python:
status: New → Incomplete
Revision history for this message
Andrew (andrew-rw-robinson) wrote :

It still does not work in Hardy

Revision history for this message
Andrew (andrew-rw-robinson) wrote :

Tested and still failing in python-notify version 0.1.1-2

Revision history for this message
Jayson Rowe (jayson.rowe) wrote :

Since it's been a very long time since any additional info was added to this bug, I'm just checking to see if this is still an issue, and find out what additional work should be done on this bug.

Revision history for this message
Andrew (andrew-rw-robinson) wrote :

I added a test case for the bug. It is still broken in Intrepid. There is no more additional information needed except for the bug to be fixed. AFAIK, there is nothing more to do except to either (1) remove buttons from the code since they don't work or (2) fix the buttons. See the http://launchpadlibrarian.net/11497923/bug185262.py I uploaded for an easy way to reproduce the issue.

I have no idea why this bug's status is incomplete.

Thanks

Revision history for this message
Jayson Rowe (jayson.rowe) wrote :

Marking as Confirmed.

Changed in notify-python:
status: Incomplete → Confirmed
Revision history for this message
kriomant (kriomant) wrote :

Just add

from dbus.mainloop.glib import DBusGMainLoop
DBusGMainLoop(set_as_default=True)

before importing pynotify, then actions start to work properly.

Revision history for this message
James (purpleidea) wrote :

I just tried adding:
from dbus.mainloop.glib import DBusGMainLoop
DBusGMainLoop(set_as_default=True)
above the imports and unfortunately this doesn't work for me.

I can confirm i have this problem too, anybody upstream have a fix?
cheers!

_J

Revision history for this message
James (purpleidea) wrote :

actually i think this is the answer:
https://bugzilla.redhat.com/show_bug.cgi?id=241531
the n goes out of scope, so that's why the action is never called...
more of a bug in the coding of the test case.

_J

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

Other bug subscribers

Bug attachments

Remote bug watches

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