All pastes #237123 Raw Edit

Nagappan

public python v1 · immutable
·published 2006-11-04 10:24 UTC
rendered paste body
REGISTRY_IID = "OAFIID:Accessibility_Registry:1.0"TYPELIB_NAME = "Accessibility"# import ORBit and bonobo first (required)import ORBit, bonobo# initialize the ORBorb = ORBit.CORBA.ORB_init()# get a reference to the gnome Accessibility registrydata = 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 IDLORBit.load_typelib(TYPELIB_NAME)# import the generated Accessibility moduleimport Accessibility# print all the application namesdesktop = 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'