85 moduleNameStr = "{0}".format(self.moduleName) |
85 moduleNameStr = "{0}".format(self.moduleName) |
86 |
86 |
87 for globalName in sorted(self.module.globals.keys()): |
87 for globalName in sorted(self.module.globals.keys()): |
88 if not self.__isPrivate(self.module.globals[globalName]): |
88 if not self.__isPrivate(self.module.globals[globalName]): |
89 if self.module.globals[globalName].isPublic(): |
89 if self.module.globals[globalName].isPublic(): |
90 id = Editor.AttributeID |
90 iconId = Editor.AttributeID |
91 elif self.module.globals[globalName].isProtected(): |
91 elif self.module.globals[globalName].isProtected(): |
92 id = Editor.AttributeProtectedID |
92 iconId = Editor.AttributeProtectedID |
93 else: |
93 else: |
94 id = Editor.AttributePrivateID |
94 iconId = Editor.AttributePrivateID |
95 self.api.append("{0}{1}?{2:d}".format( |
95 self.api.append("{0}{1}?{2:d}".format( |
96 moduleNameStr, globalName, id)) |
96 moduleNameStr, globalName, iconId)) |
97 |
97 |
98 def __addClassesAPI(self): |
98 def __addClassesAPI(self): |
99 """ |
99 """ |
100 Private method to generate the api section for classes. |
100 Private method to generate the api section for classes. |
101 """ |
101 """ |
116 _class = self.module.classes[className] |
116 _class = self.module.classes[className] |
117 methods = sorted(list(_class.methods.keys())) |
117 methods = sorted(list(_class.methods.keys())) |
118 if '__init__' in methods: |
118 if '__init__' in methods: |
119 methods.remove('__init__') |
119 methods.remove('__init__') |
120 if _class.isPublic(): |
120 if _class.isPublic(): |
121 id = Editor.ClassID |
121 iconId = Editor.ClassID |
122 elif _class.isProtected(): |
122 elif _class.isProtected(): |
123 id = Editor.ClassProtectedID |
123 iconId = Editor.ClassProtectedID |
124 else: |
124 else: |
125 id = Editor.ClassPrivateID |
125 iconId = Editor.ClassPrivateID |
126 self.api.append( |
126 self.api.append( |
127 '{0}{1}?{2:d}({3})'.format( |
127 '{0}{1}?{2:d}({3})'.format( |
128 self.moduleName, _class.name, id, |
128 self.moduleName, _class.name, iconId, |
129 ', '.join(_class.methods['__init__'].parameters[1:]))) |
129 ', '.join(_class.methods['__init__'].parameters[1:]))) |
130 |
130 |
131 classNameStr = "{0}{1}.".format(self.moduleName, className) |
131 classNameStr = "{0}{1}.".format(self.moduleName, className) |
132 for method in methods: |
132 for method in methods: |
133 if not self.__isPrivate(_class.methods[method]): |
133 if not self.__isPrivate(_class.methods[method]): |
134 if _class.methods[method].isPublic(): |
134 if _class.methods[method].isPublic(): |
135 id = Editor.MethodID |
135 iconId = Editor.MethodID |
136 elif _class.methods[method].isProtected(): |
136 elif _class.methods[method].isProtected(): |
137 id = Editor.MethodProtectedID |
137 iconId = Editor.MethodProtectedID |
138 else: |
138 else: |
139 id = Editor.MethodPrivateID |
139 iconId = Editor.MethodPrivateID |
140 self.api.append( |
140 self.api.append( |
141 '{0}{1}?{2:d}({3})'.format( |
141 '{0}{1}?{2:d}({3})'.format( |
142 classNameStr, method, id, |
142 classNameStr, method, iconId, |
143 ', '.join(_class.methods[method].parameters[1:]))) |
143 ', '.join(_class.methods[method].parameters[1:]))) |
144 |
144 |
145 def __addClassVariablesAPI(self, className): |
145 def __addClassVariablesAPI(self, className): |
146 """ |
146 """ |
147 Private method to generate class api section for class variables. |
147 Private method to generate class api section for class variables. |
154 _class = self.module.classes[className] |
154 _class = self.module.classes[className] |
155 classNameStr = "{0}{1}.".format(self.moduleName, className) |
155 classNameStr = "{0}{1}.".format(self.moduleName, className) |
156 for variable in sorted(_class.globals.keys()): |
156 for variable in sorted(_class.globals.keys()): |
157 if not self.__isPrivate(_class.globals[variable]): |
157 if not self.__isPrivate(_class.globals[variable]): |
158 if _class.globals[variable].isPublic(): |
158 if _class.globals[variable].isPublic(): |
159 id = Editor.AttributeID |
159 iconId = Editor.AttributeID |
160 elif _class.globals[variable].isProtected(): |
160 elif _class.globals[variable].isProtected(): |
161 id = Editor.AttributeProtectedID |
161 iconId = Editor.AttributeProtectedID |
162 else: |
162 else: |
163 id = Editor.AttributePrivateID |
163 iconId = Editor.AttributePrivateID |
164 self.api.append('{0}{1}?{2:d}'.format( |
164 self.api.append('{0}{1}?{2:d}'.format( |
165 classNameStr, variable, id)) |
165 classNameStr, variable, iconId)) |
166 |
166 |
167 def __addFunctionsAPI(self): |
167 def __addFunctionsAPI(self): |
168 """ |
168 """ |
169 Private method to generate the api section for functions. |
169 Private method to generate the api section for functions. |
170 """ |
170 """ |
172 |
172 |
173 funcNames = sorted(list(self.module.functions.keys())) |
173 funcNames = sorted(list(self.module.functions.keys())) |
174 for funcName in funcNames: |
174 for funcName in funcNames: |
175 if not self.__isPrivate(self.module.functions[funcName]): |
175 if not self.__isPrivate(self.module.functions[funcName]): |
176 if self.module.functions[funcName].isPublic(): |
176 if self.module.functions[funcName].isPublic(): |
177 id = Editor.MethodID |
177 iconId = Editor.MethodID |
178 elif self.module.functions[funcName].isProtected(): |
178 elif self.module.functions[funcName].isProtected(): |
179 id = Editor.MethodProtectedID |
179 iconId = Editor.MethodProtectedID |
180 else: |
180 else: |
181 id = Editor.MethodPrivateID |
181 iconId = Editor.MethodPrivateID |
182 self.api.append( |
182 self.api.append( |
183 '{0}{1}?{2:d}({3})'.format( |
183 '{0}{1}?{2:d}({3})'.format( |
184 self.moduleName, self.module.functions[funcName].name, |
184 self.moduleName, self.module.functions[funcName].name, |
185 id, |
185 iconId, |
186 ', '.join(self.module.functions[funcName].parameters))) |
186 ', '.join(self.module.functions[funcName].parameters))) |