Package AccessEngine :: Module AEUserInterface
[hide private]
[frames] | no frames]

Source Code for Module AccessEngine.AEUserInterface

 1  ''' 
 2  Defines the base class for all user interface elements (UIEs). 
 3   
 4  @author: Peter Parente 
 5  @organization: IBM Corporation 
 6  @copyright: Copyright (c) 2005, 2007 IBM Corporation 
 7  @license: The BSD License 
 8   
 9  All rights reserved. This program and the accompanying materials are made  
10  available under the terms of the BSD license which accompanies 
11  this distribution, and is available at 
12  U{http://www.opensource.org/licenses/bsd-license.php} 
13  ''' 
14  from AccessEngine import AERegistrar 
15   
16 -class AEUserInterface(object):
17 ''' 18 Most base class for all user interface elements. Subclasses of this class 19 include L{AEOutput}, L{AEInput}, L{AEMonitor}, L{AEChooser}, L{AEScript <AEScript.AEScript>}, and 20 task. Provides methods for getting metadata about a loaded instance of a 21 UIE including its class name, human readable name, description, and path on 22 disk (when applicable). 23 '''
24 - def getClassName(self):
25 ''' 26 @return: Name of this object's class 27 @rtype: string 28 ''' 29 return str(self.__class__.__name__)
30
31 - def getName(self):
32 ''' 33 @return: Human readable name of this object. Defaults to its class name. 34 @rtype: string 35 ''' 36 return self.getClassName()
37
38 - def getPath(self):
39 ''' 40 @return: Absolute path location of the module containing the implementor 41 of this interface 42 @rtype: string 43 ''' 44 return AERegistrar.getPath(self.getClassName())
45
46 - def getDescription(self):
47 ''' 48 @return: Description of this component. Defaults to the first paragraph 49 (all lines up to the first blank line) in its class docstring. 50 @rtype: string 51 ''' 52 desc = [] 53 doc = self.__class__.__doc__ 54 if doc is None: 55 return '' 56 for i, line in enumerate(doc.split('\n')): 57 line = line.strip() 58 if i != 0 and not line: 59 break 60 elif i != 0: 61 desc.append(line) 62 return ' '.join(desc)
63