Package: python-notify Version: 0.1.1-2 Severity: normal If I try to create a status icon and then immediately display a notification for it, the notification pops up in the wrong place. If I create a status icon, wait for $SHORT_INTERVAL, and then display a notification, the notification pops up in the right place. (and if $SHORT_INTERVAL is too short, the notification pops up in a *different* incorrect place!) I suspect that there's a race between figuring out the location of the icon and attaching the notification. The notification really ought to wait for the status icon to become ready before it displays itself.
The attached file displays two status icons, each with a notification that's created at the same time as the status icon. The first one pops up in the wrong place (on my computer) -- some distance away from the status tray area. The second one is created after the main loop has run for a full second, and pops up where I would expect it. (note that delaying outside the main loop, or running a single iteration with gtk.main_iteration(), are not sufficient to fix this problem) Daniel -- System Information: Debian Release: lenny/sid APT prefers unstable APT policy: (500, 'unstable'), (500, 'stable') Architecture: i386 (i686) Kernel: Linux 2.6.22-3-686 (SMP w/1 CPU core) Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8) (ignored: LC_ALL set to en_US.UTF-8) Shell: /bin/sh linked to /bin/bash Versions of packages python-notify depends on: ii libatk1.0-0 1.20.0-1 The ATK accessibility toolkit ii libc6 2.7-4 GNU C Library: Shared libraries ii libcairo2 1.4.12-1 The Cairo 2D vector graphics libra ii libdbus-1-3 1.1.2-1 simple interprocess messaging syst ii libdbus-glib-1-2 0.74-1 simple interprocess messaging syst ii libffi4 4.2.2-4 Foreign Function Interface library ii libglib2.0-0 2.14.4-2 The GLib library of C routines ii libgtk2.0-0 2.12.3-2 The GTK+ graphical user interface ii libnotify1 [libnotify1-gtk2.1 0.4.4-3 sends desktop notifications to a n ii libpango1.0-0 1.18.3-1 Layout and rendering of internatio ii python 2.4.4-6 An interactive high-level object-o ii python-gtk2 2.12.0-2 Python bindings for the GTK+ widge ii python-support 0.7.5 automated rebuilding support for p python-notify recommends no packages. -- no debconf information
#!/usr/bin/env python import pygtk pygtk.require('2.0') import gtk import gobject import pynotify import sys if not pynotify.init('Notify'): sys.stderr.write('Unable to initialize pynotify.\n') sys.exit(1) n = pynotify.Notification("Summary", "A brief message from our sponsor.", None) n.connect('closed', gtk.main_quit) trayicon = gtk.status_icon_new_from_icon_name('info') n.attach_to_status_icon(trayicon) if not n.show(): sys.stderr.write('Error showing the notification.\n') sys.exit(1) try: gtk.main() finally: n.close() del trayicon trayicon = gtk.status_icon_new_from_icon_name('info') def setup_notification(*args): n = pynotify.Notification("Summary", "A brief message from our sponsor.", None) n.connect('closed', gtk.main_quit) n.attach_to_status_icon(trayicon) if not n.show(): sys.stderr.write('Error showing the notification.\n') gtk.main_quit() return False gobject.timeout_add(1000, setup_notification) try: gtk.main() finally: n.close() del trayicon