83 |
83 |
84 def __addGlobalsAPI(self): |
84 def __addGlobalsAPI(self): |
85 """ |
85 """ |
86 Private method to generate the api section for global variables. |
86 Private method to generate the api section for global variables. |
87 """ |
87 """ |
88 from eric7.QScintilla.Editor import Editor |
88 from eric7.QScintilla.Editor import EditorIconId |
89 |
89 |
90 moduleNameStr = "{0}".format(self.moduleName) |
90 moduleNameStr = "{0}".format(self.moduleName) |
91 |
91 |
92 for globalName in sorted(self.module.globals): |
92 for globalName in sorted(self.module.globals): |
93 if not self.__isPrivate(self.module.globals[globalName]): |
93 if not self.__isPrivate(self.module.globals[globalName]): |
94 if self.module.globals[globalName].isPublic(): |
94 if self.module.globals[globalName].isPublic(): |
95 iconId = Editor.AttributeID |
95 iconId = EditorIconId.Attribute |
96 elif self.module.globals[globalName].isProtected(): |
96 elif self.module.globals[globalName].isProtected(): |
97 iconId = Editor.AttributeProtectedID |
97 iconId = EditorIconId.AttributeProtected |
98 else: |
98 else: |
99 iconId = Editor.AttributePrivateID |
99 iconId = EditorIconId.AttributePrivate |
100 self.api.append( |
100 self.api.append( |
101 "{0}{1}?{2:d}".format(moduleNameStr, globalName, iconId) |
101 "{0}{1}?{2:d}".format(moduleNameStr, globalName, iconId) |
102 ) |
102 ) |
103 |
103 |
104 def __addClassesAPI(self): |
104 def __addClassesAPI(self): |
116 Private method to generate the api section for class methods. |
116 Private method to generate the api section for class methods. |
117 |
117 |
118 @param className name of the class containing the method |
118 @param className name of the class containing the method |
119 @type str |
119 @type str |
120 """ |
120 """ |
121 from eric7.QScintilla.Editor import Editor |
121 from eric7.QScintilla.Editor import EditorIconId |
122 |
122 |
123 _class = self.module.classes[className] |
123 _class = self.module.classes[className] |
124 methods = sorted(_class.methods) |
124 methods = sorted(_class.methods) |
125 if "__init__" in methods: |
125 if "__init__" in methods: |
126 methods.remove("__init__") |
126 methods.remove("__init__") |
127 if _class.isPublic(): |
127 if _class.isPublic(): |
128 iconId = Editor.ClassID |
128 iconId = EditorIconId.Class |
129 elif _class.isProtected(): |
129 elif _class.isProtected(): |
130 iconId = Editor.ClassProtectedID |
130 iconId = EditorIconId.ClassProtected |
131 else: |
131 else: |
132 iconId = Editor.ClassPrivateID |
132 iconId = EditorIconId.ClassPrivate |
133 self.api.append( |
133 self.api.append( |
134 "{0}{1}?{2:d}({3})".format( |
134 "{0}{1}?{2:d}({3})".format( |
135 self.moduleName, |
135 self.moduleName, |
136 _class.name, |
136 _class.name, |
137 iconId, |
137 iconId, |
141 |
141 |
142 classNameStr = "{0}{1}.".format(self.moduleName, className) |
142 classNameStr = "{0}{1}.".format(self.moduleName, className) |
143 for method in methods: |
143 for method in methods: |
144 if not self.__isPrivate(_class.methods[method]): |
144 if not self.__isPrivate(_class.methods[method]): |
145 if _class.methods[method].isPublic(): |
145 if _class.methods[method].isPublic(): |
146 iconId = Editor.MethodID |
146 iconId = EditorIconId.Method |
147 elif _class.methods[method].isProtected(): |
147 elif _class.methods[method].isProtected(): |
148 iconId = Editor.MethodProtectedID |
148 iconId = EditorIconId.MethodProtected |
149 else: |
149 else: |
150 iconId = Editor.MethodPrivateID |
150 iconId = EditorIconId.MethodPrivate |
151 self.api.append( |
151 self.api.append( |
152 "{0}{1}?{2:d}({3})".format( |
152 "{0}{1}?{2:d}({3})".format( |
153 classNameStr, |
153 classNameStr, |
154 method, |
154 method, |
155 iconId, |
155 iconId, |
162 Private method to generate class api section for class variables. |
162 Private method to generate class api section for class variables. |
163 |
163 |
164 @param className name of the class containing the class variables |
164 @param className name of the class containing the class variables |
165 @type str |
165 @type str |
166 """ |
166 """ |
167 from eric7.QScintilla.Editor import Editor |
167 from eric7.QScintilla.Editor import EditorIconId |
168 |
168 |
169 _class = self.module.classes[className] |
169 _class = self.module.classes[className] |
170 classNameStr = "{0}{1}.".format(self.moduleName, className) |
170 classNameStr = "{0}{1}.".format(self.moduleName, className) |
171 for variable in sorted(_class.globals): |
171 for variable in sorted(_class.globals): |
172 if not self.__isPrivate(_class.globals[variable]): |
172 if not self.__isPrivate(_class.globals[variable]): |
173 if _class.globals[variable].isPublic(): |
173 if _class.globals[variable].isPublic(): |
174 iconId = Editor.AttributeID |
174 iconId = EditorIconId.Attribute |
175 elif _class.globals[variable].isProtected(): |
175 elif _class.globals[variable].isProtected(): |
176 iconId = Editor.AttributeProtectedID |
176 iconId = EditorIconId.AttributeProtected |
177 else: |
177 else: |
178 iconId = Editor.AttributePrivateID |
178 iconId = EditorIconId.AttributePrivate |
179 self.api.append("{0}{1}?{2:d}".format(classNameStr, variable, iconId)) |
179 self.api.append("{0}{1}?{2:d}".format(classNameStr, variable, iconId)) |
180 |
180 |
181 def __addFunctionsAPI(self): |
181 def __addFunctionsAPI(self): |
182 """ |
182 """ |
183 Private method to generate the api section for functions. |
183 Private method to generate the api section for functions. |
184 """ |
184 """ |
185 from eric7.QScintilla.Editor import Editor |
185 from eric7.QScintilla.Editor import EditorIconId |
186 |
186 |
187 funcNames = sorted(self.module.functions) |
187 funcNames = sorted(self.module.functions) |
188 for funcName in funcNames: |
188 for funcName in funcNames: |
189 if not self.__isPrivate(self.module.functions[funcName]): |
189 if not self.__isPrivate(self.module.functions[funcName]): |
190 if self.module.functions[funcName].isPublic(): |
190 if self.module.functions[funcName].isPublic(): |
191 iconId = Editor.MethodID |
191 iconId = EditorIconId.Method |
192 elif self.module.functions[funcName].isProtected(): |
192 elif self.module.functions[funcName].isProtected(): |
193 iconId = Editor.MethodProtectedID |
193 iconId = EditorIconId.MethodProtected |
194 else: |
194 else: |
195 iconId = Editor.MethodPrivateID |
195 iconId = EditorIconId.MethodPrivate |
196 self.api.append( |
196 self.api.append( |
197 "{0}{1}?{2:d}({3})".format( |
197 "{0}{1}?{2:d}({3})".format( |
198 self.moduleName, |
198 self.moduleName, |
199 self.module.functions[funcName].name, |
199 self.module.functions[funcName].name, |
200 iconId, |
200 iconId, |