DocumentationTools/APIGenerator.py

branch
Py2 comp.
changeset 3057
10516539f238
parent 2538
b2642e7a4c18
parent 2989
7efa8b8b6903
child 3060
5883ce99ee12
equal deleted inserted replaced
3056:9986ec0e559a 3057:10516539f238
3 # Copyright (c) 2004 - 2013 Detlev Offenbach <detlev@die-offenbachs.de> 3 # Copyright (c) 2004 - 2013 Detlev Offenbach <detlev@die-offenbachs.de>
4 # 4 #
5 5
6 """ 6 """
7 Module implementing the builtin API generator. 7 Module implementing the builtin API generator.
8
9 """ 8 """
10 9
11 10
12 from __future__ import unicode_literals # __IGNORE_WARNING__ 11 from __future__ import unicode_literals # __IGNORE_WARNING__
13 12
26 25
27 def genAPI(self, newStyle, basePackage, includePrivate): 26 def genAPI(self, newStyle, basePackage, includePrivate):
28 """ 27 """
29 Public method to generate the API information. 28 Public method to generate the API information.
30 29
31 @param newStyle flag indicating the api generation for QScintilla 1.7 and 30 @param newStyle flag indicating the api generation for QScintilla 1.7
32 newer (boolean) (ignored) 31 and newer (boolean) (ignored)
33 @param basePackage name of the base package (string) 32 @param basePackage name of the base package (string)
34 @param includePrivate flag indicating to include 33 @param includePrivate flag indicating to include
35 private methods/functions (boolean) 34 private methods/functions (boolean)
36 @return API information (list of strings) 35 @return API information (list of strings)
37 """ 36 """
50 49
51 def genBases(self, includePrivate): 50 def genBases(self, includePrivate):
52 """ 51 """
53 Public method to generate the base classes information. 52 Public method to generate the base classes information.
54 53
55 @param includePrivate flag indicating to include private classes (boolean) 54 @param includePrivate flag indicating to include private classes
55 (boolean)
56 @return base classes information (dictionary of list of strings) 56 @return base classes information (dictionary of list of strings)
57 """ 57 """
58 bases = {} 58 bases = {}
59 self.includePrivate = includePrivate 59 self.includePrivate = includePrivate
60 classNames = sorted(list(self.module.classes.keys())) 60 classNames = sorted(list(self.module.classes.keys()))
90 id = Editor.AttributeID 90 id = Editor.AttributeID
91 elif self.module.globals[globalName].isProtected(): 91 elif self.module.globals[globalName].isProtected():
92 id = Editor.AttributeProtectedID 92 id = Editor.AttributeProtectedID
93 else: 93 else:
94 id = Editor.AttributePrivateID 94 id = Editor.AttributePrivateID
95 self.api.append("{0}{1}?{2:d}".format(moduleNameStr, globalName, id)) 95 self.api.append("{0}{1}?{2:d}".format(
96 moduleNameStr, globalName, id))
96 97
97 def __addClassesAPI(self): 98 def __addClassesAPI(self):
98 """ 99 """
99 Private method to generate the api section for classes. 100 Private method to generate the api section for classes.
100 """ 101 """
106 107
107 def __addMethodsAPI(self, className): 108 def __addMethodsAPI(self, className):
108 """ 109 """
109 Private method to generate the api section for class methods. 110 Private method to generate the api section for class methods.
110 111
111 @param classname Name of the class containing the method. (string) 112 @param className name of the class containing the method (string)
112 """ 113 """
113 from QScintilla.Editor import Editor 114 from QScintilla.Editor import Editor
114 115
115 _class = self.module.classes[className] 116 _class = self.module.classes[className]
116 methods = sorted(list(_class.methods.keys())) 117 methods = sorted(list(_class.methods.keys()))
141 142
142 def __addClassVariablesAPI(self, className): 143 def __addClassVariablesAPI(self, className):
143 """ 144 """
144 Private method to generate class api section for class variables. 145 Private method to generate class api section for class variables.
145 146
146 @param classname Name of the class containing the class variables. (string) 147 @param className name of the class containing the class variables
148 (string)
147 """ 149 """
148 from QScintilla.Editor import Editor 150 from QScintilla.Editor import Editor
149 151
150 _class = self.module.classes[className] 152 _class = self.module.classes[className]
151 classNameStr = "{0}{1}.".format(self.moduleName, className) 153 classNameStr = "{0}{1}.".format(self.moduleName, className)
155 id = Editor.AttributeID 157 id = Editor.AttributeID
156 elif _class.globals[variable].isProtected(): 158 elif _class.globals[variable].isProtected():
157 id = Editor.AttributeProtectedID 159 id = Editor.AttributeProtectedID
158 else: 160 else:
159 id = Editor.AttributePrivateID 161 id = Editor.AttributePrivateID
160 self.api.append('{0}{1}?{2:d}'.format(classNameStr, variable, id)) 162 self.api.append('{0}{1}?{2:d}'.format(
163 classNameStr, variable, id))
161 164
162 def __addFunctionsAPI(self): 165 def __addFunctionsAPI(self):
163 """ 166 """
164 Private method to generate the api section for functions. 167 Private method to generate the api section for functions.
165 """ 168 """

eric ide

mercurial