Module generateComInterfaces
[hide private]
[frames] | no frames]

Source Code for Module generateComInterfaces

 1  #generateComInterfaces.py 
 2  #A part of NonVisual Desktop Access (NVDA) 
 3  #This file is covered by the GNU General Public License. 
 4  #See the file COPYING for more details. 
 5  #Copyright (C) 2006-2010 Michael Curran <mick@kulgan.net>, James Teh <jamie@jantrid.net> 
 6   
 7  """Script to generate Python code for required COM interfaces. 
 8  This script will be run by SCons as appropriate. 
 9  """ 
10   
11  #Bit of a dance to force comtypes generated interfaces in to our directory 
12  import comtypes.client 
13  comtypes.client.gen_dir='.\\comInterfaces' 
14  import sys 
15  sys.modules['comtypes.gen']=comtypes.gen=__import__("comInterfaces",globals(),locals(),[]) 
16   
17  COM_INTERFACES = ( 
18          ("UI Automation", comtypes.client.GetModule, "UIAutomationCore.dll"), 
19          ("IAccessible 2", comtypes.client.GetModule, "typelibs/ia2.tlb"), 
20          ("MS Active Accessibility", comtypes.client.GetModule, "oleacc.dll"), 
21          ("Rich Edit library", comtypes.client.GetModule, "msftedit.dll"), 
22          ("SAPI 5", comtypes.client.CreateObject, "Sapi.SPVoice"), 
23          ("Acrobat Access", comtypes.client.GetModule, "typelibs/AcrobatAccess.tlb"), 
24          ("Flash Accessibility", comtypes.client.GetModule, "typelibs/FlashAccessibility.tlb"), 
25  ) 
26   
27 -def main():
28 print "COM interfaces:" 29 for desc, func, interface in COM_INTERFACES: 30 print "%s:" % desc, 31 try: 32 func(interface) 33 print "done." 34 except: 35 print "not found." 36 print
37 38 if __name__ == "__main__": 39 main() 40