REGISTRY_IID = "OAFIID:Accessibility_Registry:1.0" TYPELIB_NAME = "Accessibility" # import ORBit and bonobo first (required) import ORBit, bonobo # initialize the ORB orb = ORBit.CORBA.ORB_init() # get a reference to the gnome Accessibility registry data = bonobo.activation.activate_from_id(REGISTRY_IID) if data is None: raise RuntimeError('Could not activate:', REGISTRY_IID) else: try: Registry = data[0] except IndexError: raise ValueError('Activation received unexpected object: '+str(data)) # generate Python code for the Accessibility module from the compiled IDL ORBit.load_typelib(TYPELIB_NAME) # import the generated Accessibility module import Accessibility # print all the application names desktop = Registry.getDesktop(0) for i in xrange(desktop.childCount): c = desktop.getChildAtIndex(i) if c is not None: print c.name, if c.getRole() == Accessibility.ROLE_APPLICATION: # and do some role checking just to show that the constants are available # in the Accessibility module print 'is an application'