48 @param editor reference to the editor containing the source text |
50 @param editor reference to the editor containing the source text |
49 @type Editor |
51 @type Editor |
50 @param populate flag indicating to populate the outline |
52 @param populate flag indicating to populate the outline |
51 @type bool |
53 @type bool |
52 """ |
54 """ |
53 super().__init__(nopopulate=True) |
55 super().__init__(nopopulate=True, modelType=BrowserModelType.EditorOutline) |
54 |
56 |
55 self.__editor = editor |
57 self.__editor = editor |
56 |
58 |
57 self.__populated = False |
59 self.__populated = False |
58 |
60 |
95 with contextlib.suppress(AttributeError): |
97 with contextlib.suppress(AttributeError): |
96 if cl.module == self.__module: |
98 if cl.module == self.__module: |
97 if isinstance( |
99 if isinstance( |
98 cl, (ClbrBaseClasses.Class, ClbrBaseClasses.Module) |
100 cl, (ClbrBaseClasses.Class, ClbrBaseClasses.Module) |
99 ): |
101 ): |
100 node = BrowserClassItem(parentItem, cl, self.__filename) |
102 node = BrowserClassItem( |
|
103 parentItem, |
|
104 cl, |
|
105 self.__filename, |
|
106 modelType=self._modelType, |
|
107 ) |
101 elif isinstance(cl, ClbrBaseClasses.Function): |
108 elif isinstance(cl, ClbrBaseClasses.Function): |
102 node = BrowserMethodItem( |
109 node = BrowserMethodItem( |
103 parentItem, cl, self.__filename |
110 parentItem, |
|
111 cl, |
|
112 self.__filename, |
|
113 modelType=self._modelType, |
104 ) |
114 ) |
105 else: |
115 else: |
106 node = None |
116 node = None |
107 if node: |
117 if node: |
108 self._addItem(node, parentItem) |
118 self._addItem(node, parentItem) |
278 |
288 |
279 @return list of supported programming languages |
289 @return list of supported programming languages |
280 @rtype str |
290 @rtype str |
281 """ |
291 """ |
282 return list(ClassBrowsers.ClassBrowserRegistry) + list(cls.SupportedLanguages) |
292 return list(ClassBrowsers.ClassBrowserRegistry) + list(cls.SupportedLanguages) |
|
293 |
|
294 |
|
295 class EditorOutlineSortFilterProxyModel(BrowserSortFilterProxyModel): |
|
296 """ |
|
297 Class implementing the editor outline sort filter proxy model. |
|
298 """ |
|
299 |
|
300 def __init__(self, parent=None): |
|
301 """ |
|
302 Constructor |
|
303 |
|
304 @param parent reference to the parent object |
|
305 @type QObject |
|
306 """ |
|
307 super().__init__(parent) |
|
308 |
|
309 def filterAcceptsRow(self, _source_row, _source_parent): |
|
310 """ |
|
311 Public method to filter rows. |
|
312 |
|
313 This overrides the filtering of the parent class by always accept |
|
314 the row. |
|
315 |
|
316 @param _source_row row number (in the source model) of item |
|
317 @type int |
|
318 @param _source_parent index of parent item (in the source model) |
|
319 of item |
|
320 @type QModelIndex |
|
321 @return flag indicating, if the item should be shown |
|
322 @rtype bool |
|
323 """ |
|
324 return True |