Package pyLinAcc :: Module Interfaces
[hide private]
[frames] | no frames]

Source Code for Module pyLinAcc.Interfaces

  1  ''' 
  2  Defines functions that make queryInterface more Pythonic. 
  3   
  4  @author: Peter Parente 
  5  @author: Pete Brunet 
  6  @organization: IBM Corporation 
  7  @copyright: Copyright (c) 2005, 2007 IBM Corporation 
  8  @license: The BSD License 
  9   
 10  All rights reserved. This program and the accompanying materials are made  
 11  available under the terms of the BSD license which accompanies 
 12  this distribution, and is available at 
 13  U{http://www.opensource.org/licenses/bsd-license.php} 
 14  ''' 
 15   
 16  import Constants 
 17   
18 -def queryInterface(obj, idl):
19 ''' 20 Queries an object for another interface. 21 22 @param obj: Object to query for another interface 23 @type obj: object 24 @param idl: Desired interface identifier 25 @type idl: string 26 @return: An object with the desired interface 27 @rtype: object 28 @raise NotImplementedError: When the desired interface is not supported 29 ''' 30 try: 31 i = obj.queryInterface(idl) 32 except Exception: 33 raise NotImplementedError 34 if i is None: 35 raise NotImplementedError 36 i = i._narrow(i.__class__) 37 return i
38
39 -def IAccessible(obj):
40 ''' 41 @return: Object with the Accessible interface or None if not supported 42 @rtype: Accessibility.Accessible 43 ''' 44 return queryInterface(obj, Constants.ACCESSIBLE_IDL)
45
46 -def IAction(obj):
47 ''' 48 @return: Object with the Action interface 49 @rtype: Accessibility.Action 50 ''' 51 return queryInterface(obj, Constants.ACTION_IDL)
52
53 -def IApplication(obj):
54 ''' 55 @return: Object with the Application interface or None if not supported 56 @rtype: Accessibility.Application 57 ''' 58 return queryInterface(obj, Constants.APPLICATION_IDL)
59
60 -def ICollection(obj):
61 ''' 62 @return: Object with the Collection interface or None if not supported 63 @rtype: Accessibility.Collection 64 ''' 65 return queryInterface(obj, Constants.COLLECTION_IDL)
66
67 -def IComponent(obj):
68 ''' 69 @return: Object with the Component interface or None if not supported 70 @rtype: Accessibility.Component 71 ''' 72 return queryInterface(obj, Constants.COMPONENT_IDL)
73
74 -def IDesktop(obj):
75 ''' 76 @return: Object with the Desktop interface or None if not supported 77 @rtype: Accessibility.Desktop 78 ''' 79 return queryInterface(obj, Constants.DESKTOP_IDL)
80
81 -def IDocument(obj):
82 ''' 83 @return: Object with the Document interface or None if not supported 84 @rtype: Accessibility.Document 85 ''' 86 return queryInterface(obj, Constants.DOCUMENT_IDL)
87
88 -def IEditableText(obj):
89 ''' 90 @return: Object with the EditableText interface or None if not supported 91 @rtype: Accessibility.EditableText 92 ''' 93 return queryInterface(obj, Constants.EDITABLE_TEXT_IDL)
94 101
102 -def IHypertext(obj):
103 ''' 104 @return: Object with the Hypertext interface or None if not supported 105 @rtype: Accessibility.Hypertext 106 ''' 107 return queryInterface(obj, Constants.HYPERTEXT_IDL)
108
109 -def IImage(obj):
110 ''' 111 @return: Object with the Image interface or None if not supported 112 @rtype: Accessibility.Image 113 ''' 114 return queryInterface(obj, Constants.IMAGE_IDL)
115
116 -def ILoginHelper(obj):
117 ''' 118 @return: Object with the LoginHelper interface or None if not supported 119 @rtype: Accessibility.LoginHelper 120 ''' 121 return queryInterface(obj, Constants.LOGIN_HELPER_IDL)
122
123 -def IStreamableContent(obj):
124 ''' 125 @return: Object with the StreamableContent interface or None if not supported 126 @rtype: Accessibility.StreamableContent 127 ''' 128 return queryInterface(obj, Constants.STREAMABLE_CONTENT_IDL)
129
130 -def ITable(obj):
131 ''' 132 @return: Object with the Table interface or None if not supported 133 @rtype: Accessibility.Table 134 ''' 135 return queryInterface(obj, Constants.TABLE_IDL)
136
137 -def IText(obj):
138 ''' 139 @return: Object with the Text interface or None if not supported 140 @rtype: Accessibility.Text 141 ''' 142 return queryInterface(obj, Constants.TEXT_IDL)
143
144 -def IValue(obj):
145 ''' 146 @return: Object with the Value interface or None if not supported 147 @rtype: Accessibility.Value 148 ''' 149 return queryInterface(obj, Constants.VALUE_IDL)
150
151 -def ISelection(obj):
152 ''' 153 @return: Object with the Selection interface or None if not supported 154 @rtype: Accessibility.Selection 155 ''' 156 return queryInterface(obj, Constants.SELECTION_IDL)
157