[Gtk-osx-users] Notes on handling Apple events with gtk_osxapplication and PyGTK



Hi everyone,

I thought I'd share my experiences in listening for OS X events with  
PyGTK and gtk_osxapplication.

- When OS X starts a new application process in response to the user  
clicking on an associated document file,
   there is a race condition when listening for 'Open Documents' events.

   My application had been calling OSXApplication.ready() just before  
gtk.main(), having set up its menus, etc.
   However my callback on the OSXApplication::NSApplicationOpenFile  
signal was not invoked unless I shifted this
   call right up to the start of my main python file. I thought this  
might mess with the menubar synching but it
   seems to work ok.

- If there are multiple instances of the process, only the oldest  
remaining version emits the
   OSXApplication::NSApplicationOpenFile signal, irrespective of the  
signal handler boolean return value.

cheers,
Richard.

I was testing this via

#!/bin/python
import gtk_osxapplication
macapp = gtk_osxapplication.OSXApplication()

def foo(*args):
     print "Callback!", args
     return True

h = macapp.connect("NSApplicationOpenFile", foo)
macapp.ready()

[...]

Versions: ige-mac-integration version 0.9.4, python 2.5.2, OS X  
10.5.3, PyGTK 2.16.0, GTK 2.18.8.





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]