105 if entryName in self.__module.classes: |
105 if entryName in self.__module.classes: |
106 entry = self.__module.classes[entryName] |
106 entry = self.__module.classes[entryName] |
107 elif entryName in self.__module.modules: |
107 elif entryName in self.__module.modules: |
108 entry = self.__module.modules[entryName] |
108 entry = self.__module.modules[entryName] |
109 # step 2.0: add module classes |
109 # step 2.0: add module classes |
110 items = [] |
110 items = {} |
111 for cl in entry.classes.values(): |
111 for cl in entry.classes.values(): |
112 if cl.isPrivate(): |
112 if cl.isPrivate(): |
113 icon = UI.PixmapCache.getIcon("class_private.png") |
113 icon = UI.PixmapCache.getIcon("class_private.png") |
114 elif cl.isProtected(): |
114 elif cl.isProtected(): |
115 icon = UI.PixmapCache.getIcon("class_protected.png") |
115 icon = UI.PixmapCache.getIcon("class_protected.png") |
116 else: |
116 else: |
117 icon = UI.PixmapCache.getIcon("class.png") |
117 icon = UI.PixmapCache.getIcon("class.png") |
118 items.append((cl.name, icon, cl.lineno)) |
118 items[cl.name] = (icon, cl.lineno) |
119 for itm in sorted(items): |
119 for key in sorted(items.keys()): |
120 self.__membersCombo.addItem(itm[1], itm[0], itm[2]) |
120 itm = items[key] |
|
121 self.__membersCombo.addItem(itm[0], key, itm[1]) |
121 else: |
122 else: |
122 return |
123 return |
123 |
124 |
124 # step 2.1: add class methods |
125 # step 2.1: add class methods |
125 items = [] |
126 items = {} |
126 for meth in entry.methods.values(): |
127 for meth in entry.methods.values(): |
127 if meth.modifier == Function.Static: |
128 if meth.modifier == Function.Static: |
128 icon = UI.PixmapCache.getIcon("method_static.png") |
129 icon = UI.PixmapCache.getIcon("method_static.png") |
129 elif meth.modifier == Function.Class: |
130 elif meth.modifier == Function.Class: |
130 icon = UI.PixmapCache.getIcon("method_class.png") |
131 icon = UI.PixmapCache.getIcon("method_class.png") |
132 icon = UI.PixmapCache.getIcon("method_private.png") |
133 icon = UI.PixmapCache.getIcon("method_private.png") |
133 elif meth.isProtected(): |
134 elif meth.isProtected(): |
134 icon = UI.PixmapCache.getIcon("method_protected.png") |
135 icon = UI.PixmapCache.getIcon("method_protected.png") |
135 else: |
136 else: |
136 icon = UI.PixmapCache.getIcon("method.png") |
137 icon = UI.PixmapCache.getIcon("method.png") |
137 items.append((meth.name, icon, meth.lineno)) |
138 items[meth.name] = (icon, meth.lineno) |
138 for itm in sorted(items): |
139 for key in sorted(items.keys()): |
139 self.__membersCombo.addItem(itm[1], itm[0], itm[2]) |
140 itm = items[key] |
|
141 self.__membersCombo.addItem(itm[0], key, itm[1]) |
140 |
142 |
141 # step 2.2: add class instance attributes |
143 # step 2.2: add class instance attributes |
142 items = [] |
144 items = {} |
143 for attr in entry.attributes.values(): |
145 for attr in entry.attributes.values(): |
144 if attr.isPrivate(): |
146 if attr.isPrivate(): |
145 icon = UI.PixmapCache.getIcon("attribute_private.png") |
147 icon = UI.PixmapCache.getIcon("attribute_private.png") |
146 elif attr.isProtected(): |
148 elif attr.isProtected(): |
147 icon = UI.PixmapCache.getIcon("attribute_protected.png") |
149 icon = UI.PixmapCache.getIcon("attribute_protected.png") |
148 else: |
150 else: |
149 icon = UI.PixmapCache.getIcon("attribute.png") |
151 icon = UI.PixmapCache.getIcon("attribute.png") |
150 items.append((attr.name, icon, attr.lineno)) |
152 items[attr.name] = (icon, attr.lineno) |
151 for itm in sorted(items): |
153 for key in sorted(items.keys()): |
152 self.__membersCombo.addItem(itm[1], itm[0], itm[2]) |
154 itm = items[key] |
|
155 self.__membersCombo.addItem(itm[0], key, itm[1]) |
153 |
156 |
154 # step 2.3: add class attributes |
157 # step 2.3: add class attributes |
155 items = [] |
158 items = {} |
156 icon = UI.PixmapCache.getIcon("attribute_class.png") |
159 icon = UI.PixmapCache.getIcon("attribute_class.png") |
157 for glob in entry.globals.values(): |
160 for glob in entry.globals.values(): |
158 items.append((glob.name, icon, glob.lineno)) |
161 items[glob.name] = (icon, glob.lineno) |
159 for itm in sorted(items): |
162 for key in sorted(items.keys()): |
160 self.__membersCombo.addItem(itm[1], itm[0], itm[2]) |
163 itm = items[key] |
|
164 self.__membersCombo.addItem(itm[0], key, itm[1]) |
161 |
165 |
162 def __membersActivated(self, index, moveCursor=True): |
166 def __membersActivated(self, index, moveCursor=True): |
163 """ |
167 """ |
164 Private method to jump to the line of the selected members entry. |
168 Private method to jump to the line of the selected members entry. |
165 |
169 |
203 self.__membersCombo.clear() |
207 self.__membersCombo.clear() |
204 |
208 |
205 self.__globalsCombo.addItem("") |
209 self.__globalsCombo.addItem("") |
206 |
210 |
207 # step 1: add modules |
211 # step 1: add modules |
208 items = [] |
212 items = {} |
209 for module in self.__module.modules.values(): |
213 for module in self.__module.modules.values(): |
210 items.append((module.name, UI.PixmapCache.getIcon("module.png"), |
214 items[module.name] = (UI.PixmapCache.getIcon("module.png"), |
211 module.lineno)) |
215 module.lineno) |
212 for itm in sorted(items): |
216 for key in sorted(items.keys()): |
213 self.__globalsCombo.addItem(itm[1], itm[0], itm[2]) |
217 itm = items[key] |
|
218 self.__globalsCombo.addItem(itm[0], key, itm[1]) |
214 |
219 |
215 # step 2: add classes |
220 # step 2: add classes |
216 items = [] |
221 items = {} |
217 for cl in self.__module.classes.values(): |
222 for cl in self.__module.classes.values(): |
218 if cl.isPrivate(): |
223 if cl.isPrivate(): |
219 icon = UI.PixmapCache.getIcon("class_private.png") |
224 icon = UI.PixmapCache.getIcon("class_private.png") |
220 elif cl.isProtected(): |
225 elif cl.isProtected(): |
221 icon = UI.PixmapCache.getIcon("class_protected.png") |
226 icon = UI.PixmapCache.getIcon("class_protected.png") |
222 else: |
227 else: |
223 icon = UI.PixmapCache.getIcon("class.png") |
228 icon = UI.PixmapCache.getIcon("class.png") |
224 items.append((cl.name, icon, cl.lineno)) |
229 items[cl.name] = (icon, cl.lineno) |
225 for itm in sorted(items): |
230 for key in sorted(items.keys()): |
226 self.__globalsCombo.addItem(itm[1], itm[0], itm[2]) |
231 itm = items[key] |
|
232 self.__globalsCombo.addItem(itm[0], key, itm[1]) |
227 |
233 |
228 # step 3: add functions |
234 # step 3: add functions |
229 items = [] |
235 items = {} |
230 for func in self.__module.functions.values(): |
236 for func in self.__module.functions.values(): |
231 if func.isPrivate(): |
237 if func.isPrivate(): |
232 icon = UI.PixmapCache.getIcon("method_private.png") |
238 icon = UI.PixmapCache.getIcon("method_private.png") |
233 elif func.isProtected(): |
239 elif func.isProtected(): |
234 icon = UI.PixmapCache.getIcon("method_protected.png") |
240 icon = UI.PixmapCache.getIcon("method_protected.png") |
235 else: |
241 else: |
236 icon = UI.PixmapCache.getIcon("method.png") |
242 icon = UI.PixmapCache.getIcon("method.png") |
237 items.append((func.name, icon, func.lineno)) |
243 items[func.name] = (icon, func.lineno) |
238 for itm in sorted(items): |
244 for key in sorted(items.keys()): |
239 self.__globalsCombo.addItem(itm[1], itm[0], itm[2]) |
245 itm = items[key] |
|
246 self.__globalsCombo.addItem(itm[0], key, itm[1]) |
240 |
247 |
241 # step 4: add attributes |
248 # step 4: add attributes |
242 items = [] |
249 items = {} |
243 for glob in self.__module.globals.values(): |
250 for glob in self.__module.globals.values(): |
244 if glob.isPrivate(): |
251 if glob.isPrivate(): |
245 icon = UI.PixmapCache.getIcon("attribute_private.png") |
252 icon = UI.PixmapCache.getIcon("attribute_private.png") |
246 elif glob.isProtected(): |
253 elif glob.isProtected(): |
247 icon = UI.PixmapCache.getIcon("attribute_protected.png") |
254 icon = UI.PixmapCache.getIcon("attribute_protected.png") |
248 else: |
255 else: |
249 icon = UI.PixmapCache.getIcon("attribute.png") |
256 icon = UI.PixmapCache.getIcon("attribute.png") |
250 items.append((glob.name, icon, glob.lineno)) |
257 items[glob.name] = (icon, glob.lineno) |
251 for itm in sorted(items): |
258 for key in sorted(items.keys()): |
252 self.__globalsCombo.addItem(itm[1], itm[0], itm[2]) |
259 itm = items[key] |
|
260 self.__globalsCombo.addItem(itm[0], key, itm[1]) |
253 |
261 |
254 # reset the currently selected entries without moving the text cursor |
262 # reset the currently selected entries without moving the text cursor |
255 index = self.__globalsCombo.findText(self.__selectedGlobal) |
263 index = self.__globalsCombo.findText(self.__selectedGlobal) |
256 if index != -1: |
264 if index != -1: |
257 self.__globalsCombo.setCurrentIndex(index) |
265 self.__globalsCombo.setCurrentIndex(index) |