Mon, 07 Nov 2022 17:19:58 +0100
Corrected/acknowledged some bad import style and removed some obsolete code.
1358
c1622c708cd9
Added source navigation function for Python 2, Python 3 and Ruby sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1 | # -*- coding: utf-8 -*- |
c1622c708cd9
Added source navigation function for Python 2, Python 3 and Ruby sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2 | |
8881
54e42bc2437a
Updated copyright for 2022.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
3 | # Copyright (c) 2011 - 2022 Detlev Offenbach <detlev@die-offenbachs.de> |
1358
c1622c708cd9
Added source navigation function for Python 2, Python 3 and Ruby sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4 | # |
c1622c708cd9
Added source navigation function for Python 2, Python 3 and Ruby sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
5 | |
c1622c708cd9
Added source navigation function for Python 2, Python 3 and Ruby sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
6 | """ |
3011
18292228c724
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2768
diff
changeset
|
7 | Module implementing the editor assembly widget containing the navigation |
18292228c724
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2768
diff
changeset
|
8 | combos and the editor widget. |
1358
c1622c708cd9
Added source navigation function for Python 2, Python 3 and Ruby sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
9 | """ |
c1622c708cd9
Added source navigation function for Python 2, Python 3 and Ruby sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
10 | |
8243
cc717c2ae956
Applied some more code simplifications suggested by the new Simplify checker (Y105: use contextlib.suppress) (batch 2).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8220
diff
changeset
|
11 | import contextlib |
cc717c2ae956
Applied some more code simplifications suggested by the new Simplify checker (Y105: use contextlib.suppress) (batch 2).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8220
diff
changeset
|
12 | |
8318
962bce857696
Replaced all imports of PyQt5 to PyQt6 and started to replace code using obsoleted methods and adapt to the PyQt6 enum usage.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8312
diff
changeset
|
13 | from PyQt6.QtCore import QTimer |
9473
3f23dbf37dbe
Resorted the import statements using isort.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9413
diff
changeset
|
14 | from PyQt6.QtWidgets import QComboBox, QGridLayout, QWidget |
1358
c1622c708cd9
Added source navigation function for Python 2, Python 3 and Ruby sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
15 | |
9473
3f23dbf37dbe
Resorted the import statements using isort.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9413
diff
changeset
|
16 | from eric7 import Preferences |
3f23dbf37dbe
Resorted the import statements using isort.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9413
diff
changeset
|
17 | from eric7.EricGui import EricPixmapCache |
9413
80c06d472826
Changed the eric7 import statements to include the package name (i.e. eric7) in order to not fiddle with sys.path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9221
diff
changeset
|
18 | from eric7.EricWidgets.EricApplication import ericApp |
9482
a2bc06a54d9d
Corrected/acknowledged some bad import style and removed some obsolete code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9473
diff
changeset
|
19 | from eric7.Utilities.ModuleParser import Function |
a2bc06a54d9d
Corrected/acknowledged some bad import style and removed some obsolete code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9473
diff
changeset
|
20 | |
a2bc06a54d9d
Corrected/acknowledged some bad import style and removed some obsolete code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9473
diff
changeset
|
21 | from .Editor import Editor |
a2bc06a54d9d
Corrected/acknowledged some bad import style and removed some obsolete code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9473
diff
changeset
|
22 | from .EditorButtonsWidget import EditorButtonsWidget |
a2bc06a54d9d
Corrected/acknowledged some bad import style and removed some obsolete code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9473
diff
changeset
|
23 | from .EditorOutline import EditorOutlineView |
7690
a59680062837
Continued implementing the editor outline widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7685
diff
changeset
|
24 | |
1358
c1622c708cd9
Added source navigation function for Python 2, Python 3 and Ruby sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
25 | |
c1622c708cd9
Added source navigation function for Python 2, Python 3 and Ruby sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
26 | class EditorAssembly(QWidget): |
c1622c708cd9
Added source navigation function for Python 2, Python 3 and Ruby sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
27 | """ |
3011
18292228c724
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2768
diff
changeset
|
28 | Class implementing the editor assembly widget containing the navigation |
18292228c724
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2768
diff
changeset
|
29 | combos and the editor widget. |
1358
c1622c708cd9
Added source navigation function for Python 2, Python 3 and Ruby sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
30 | """ |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
31 | |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
32 | def __init__(self, dbs, fn="", vm=None, filetype="", editor=None, tv=None): |
1358
c1622c708cd9
Added source navigation function for Python 2, Python 3 and Ruby sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
33 | """ |
c1622c708cd9
Added source navigation function for Python 2, Python 3 and Ruby sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
34 | Constructor |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
35 | |
1358
c1622c708cd9
Added source navigation function for Python 2, Python 3 and Ruby sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
36 | @param dbs reference to the debug server object |
7690
a59680062837
Continued implementing the editor outline widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7685
diff
changeset
|
37 | @type DebugServer |
a59680062837
Continued implementing the editor outline widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7685
diff
changeset
|
38 | @param fn name of the file to be opened. If it is None, |
a59680062837
Continued implementing the editor outline widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7685
diff
changeset
|
39 | a new (empty) editor is opened. |
a59680062837
Continued implementing the editor outline widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7685
diff
changeset
|
40 | @type str |
3011
18292228c724
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2768
diff
changeset
|
41 | @param vm reference to the view manager object |
7690
a59680062837
Continued implementing the editor outline widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7685
diff
changeset
|
42 | @type ViewManager.ViewManager |
a59680062837
Continued implementing the editor outline widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7685
diff
changeset
|
43 | @param filetype type of the source file |
a59680062837
Continued implementing the editor outline widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7685
diff
changeset
|
44 | @type str |
1358
c1622c708cd9
Added source navigation function for Python 2, Python 3 and Ruby sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
45 | @param editor reference to an Editor object, if this is a cloned view |
7690
a59680062837
Continued implementing the editor outline widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7685
diff
changeset
|
46 | @type Editor |
1358
c1622c708cd9
Added source navigation function for Python 2, Python 3 and Ruby sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
47 | @param tv reference to the task viewer object |
7690
a59680062837
Continued implementing the editor outline widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7685
diff
changeset
|
48 | @type TaskViewer |
1358
c1622c708cd9
Added source navigation function for Python 2, Python 3 and Ruby sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
49 | """ |
8218
7c09585bd960
Applied some more code simplifications suggested by the new Simplify checker (super(Foo, self) => super()).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8132
diff
changeset
|
50 | super().__init__() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
51 | |
1358
c1622c708cd9
Added source navigation function for Python 2, Python 3 and Ruby sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
52 | self.__layout = QGridLayout(self) |
c1622c708cd9
Added source navigation function for Python 2, Python 3 and Ruby sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
53 | self.__layout.setContentsMargins(0, 0, 0, 0) |
c1622c708cd9
Added source navigation function for Python 2, Python 3 and Ruby sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
54 | self.__layout.setSpacing(1) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
55 | |
7690
a59680062837
Continued implementing the editor outline widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7685
diff
changeset
|
56 | self.__showOutline = Preferences.getEditor("ShowSourceOutline") |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
57 | |
8132
311afc776982
EditorAssembly: fixed an issue causing wrong horizontal scrollbar position when loading a file in the editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8131
diff
changeset
|
58 | self.__editor = Editor(dbs, fn, vm, filetype, editor, tv) |
5408
b67e07566aa1
Fix for the new editor button widget on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5394
diff
changeset
|
59 | self.__buttonsWidget = EditorButtonsWidget(self.__editor, self) |
1358
c1622c708cd9
Added source navigation function for Python 2, Python 3 and Ruby sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
60 | self.__globalsCombo = QComboBox() |
8088
7c454b82b6ed
EditorAssembly: changed code of the navigation selectors to allow duplicate entries (e.g. in case of conditionally defined functions).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
61 | self.__globalsCombo.setDuplicatesEnabled(True) |
1358
c1622c708cd9
Added source navigation function for Python 2, Python 3 and Ruby sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
62 | self.__membersCombo = QComboBox() |
8088
7c454b82b6ed
EditorAssembly: changed code of the navigation selectors to allow duplicate entries (e.g. in case of conditionally defined functions).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
63 | self.__membersCombo.setDuplicatesEnabled(True) |
7690
a59680062837
Continued implementing the editor outline widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7685
diff
changeset
|
64 | self.__sourceOutline = EditorOutlineView( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
65 | self.__editor, populate=self.__showOutline |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
66 | ) |
7690
a59680062837
Continued implementing the editor outline widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7685
diff
changeset
|
67 | self.__sourceOutline.setMaximumWidth( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
68 | Preferences.getEditor("SourceOutlineWidth") |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
69 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
70 | |
5394
b2c6179184f6
Started implementing a format button bar and provider classes for various markup languages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
71 | self.__layout.addWidget(self.__buttonsWidget, 1, 0, -1, 1) |
b2c6179184f6
Started implementing a format button bar and provider classes for various markup languages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
72 | self.__layout.addWidget(self.__globalsCombo, 0, 1) |
b2c6179184f6
Started implementing a format button bar and provider classes for various markup languages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
73 | self.__layout.addWidget(self.__membersCombo, 0, 2) |
7685
0b6e8c0d6403
Started implementing the editor outline widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7533
diff
changeset
|
74 | self.__layout.addWidget(self.__editor, 1, 1, 1, 2) |
0b6e8c0d6403
Started implementing the editor outline widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7533
diff
changeset
|
75 | self.__layout.addWidget(self.__sourceOutline, 0, 3, -1, -1) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
76 | |
7343
e0808393413f
EditorAssembly: fixed an issue causing the assembly widget handling focus instead of the embedded editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7267
diff
changeset
|
77 | self.setFocusProxy(self.__editor) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
78 | |
1358
c1622c708cd9
Added source navigation function for Python 2, Python 3 and Ruby sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
79 | self.__module = None |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
80 | |
6317
e9ec47d52ff2
EditorAssembly: added a guard against shutdownTimer() being called multiple times.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6297
diff
changeset
|
81 | self.__shutdownTimerCalled = False |
1358
c1622c708cd9
Added source navigation function for Python 2, Python 3 and Ruby sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
82 | self.__parseTimer = QTimer(self) |
c1622c708cd9
Added source navigation function for Python 2, Python 3 and Ruby sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
83 | self.__parseTimer.setSingleShot(True) |
c1622c708cd9
Added source navigation function for Python 2, Python 3 and Ruby sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
84 | self.__parseTimer.setInterval(5 * 1000) |
c1622c708cd9
Added source navigation function for Python 2, Python 3 and Ruby sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
85 | self.__editor.textChanged.connect(self.__resetParseTimer) |
1807
9898a95461f1
Added a signal to the editor showing a refresh has happend and connected the editor assembly to it.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1667
diff
changeset
|
86 | self.__editor.refreshed.connect(self.__resetParseTimer) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
87 | |
1567
d03369218b6d
Fixed the editor combo box navigation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1509
diff
changeset
|
88 | self.__selectedGlobal = "" |
d03369218b6d
Fixed the editor combo box navigation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1509
diff
changeset
|
89 | self.__selectedMember = "" |
2768
eab35f6e709f
Added support to show the current class/method name in the combo boxes at the top of the editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2409
diff
changeset
|
90 | self.__globalsBoundaries = {} |
eab35f6e709f
Added support to show the current class/method name in the combo boxes at the top of the editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2409
diff
changeset
|
91 | self.__membersBoundaries = {} |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
92 | |
7690
a59680062837
Continued implementing the editor outline widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7685
diff
changeset
|
93 | self.__activateOutline(self.__showOutline) |
a59680062837
Continued implementing the editor outline widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7685
diff
changeset
|
94 | self.__activateCombos(not self.__showOutline) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
95 | |
8356
68ec9c3d4de5
Renamed the modules and classes of the E5Gui package to have the prefix 'Eric' instead of 'E5'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8318
diff
changeset
|
96 | ericApp().getObject("UserInterface").preferencesChanged.connect( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
97 | self.__preferencesChanged |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
98 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
99 | |
1421
8fead6686d1c
Fixed an issue related to the editor assembly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1358
diff
changeset
|
100 | def shutdownTimer(self): |
8fead6686d1c
Fixed an issue related to the editor assembly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1358
diff
changeset
|
101 | """ |
8fead6686d1c
Fixed an issue related to the editor assembly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1358
diff
changeset
|
102 | Public method to stop and disconnect the timer. |
8fead6686d1c
Fixed an issue related to the editor assembly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1358
diff
changeset
|
103 | """ |
8fead6686d1c
Fixed an issue related to the editor assembly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1358
diff
changeset
|
104 | self.__parseTimer.stop() |
6317
e9ec47d52ff2
EditorAssembly: added a guard against shutdownTimer() being called multiple times.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6297
diff
changeset
|
105 | if not self.__shutdownTimerCalled: |
e9ec47d52ff2
EditorAssembly: added a guard against shutdownTimer() being called multiple times.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6297
diff
changeset
|
106 | self.__editor.textChanged.disconnect(self.__resetParseTimer) |
e9ec47d52ff2
EditorAssembly: added a guard against shutdownTimer() being called multiple times.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6297
diff
changeset
|
107 | self.__editor.refreshed.disconnect(self.__resetParseTimer) |
e9ec47d52ff2
EditorAssembly: added a guard against shutdownTimer() being called multiple times.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6297
diff
changeset
|
108 | self.__shutdownTimerCalled = True |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
109 | |
1358
c1622c708cd9
Added source navigation function for Python 2, Python 3 and Ruby sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
110 | def getEditor(self): |
c1622c708cd9
Added source navigation function for Python 2, Python 3 and Ruby sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
111 | """ |
c1622c708cd9
Added source navigation function for Python 2, Python 3 and Ruby sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
112 | Public method to get the reference to the editor widget. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
113 | |
7690
a59680062837
Continued implementing the editor outline widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7685
diff
changeset
|
114 | @return reference to the editor widget |
a59680062837
Continued implementing the editor outline widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7685
diff
changeset
|
115 | @rtype Editor |
1358
c1622c708cd9
Added source navigation function for Python 2, Python 3 and Ruby sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
116 | """ |
c1622c708cd9
Added source navigation function for Python 2, Python 3 and Ruby sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
117 | return self.__editor |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
118 | |
7690
a59680062837
Continued implementing the editor outline widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7685
diff
changeset
|
119 | def __preferencesChanged(self): |
a59680062837
Continued implementing the editor outline widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7685
diff
changeset
|
120 | """ |
a59680062837
Continued implementing the editor outline widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7685
diff
changeset
|
121 | Private slot handling a change of preferences. |
a59680062837
Continued implementing the editor outline widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7685
diff
changeset
|
122 | """ |
a59680062837
Continued implementing the editor outline widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7685
diff
changeset
|
123 | showOutline = Preferences.getEditor("ShowSourceOutline") |
a59680062837
Continued implementing the editor outline widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7685
diff
changeset
|
124 | if showOutline != self.__showOutline: |
a59680062837
Continued implementing the editor outline widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7685
diff
changeset
|
125 | self.__showOutline = showOutline |
a59680062837
Continued implementing the editor outline widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7685
diff
changeset
|
126 | self.__activateOutline(self.__showOutline) |
a59680062837
Continued implementing the editor outline widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7685
diff
changeset
|
127 | self.__activateCombos(not self.__showOutline) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
128 | |
7690
a59680062837
Continued implementing the editor outline widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7685
diff
changeset
|
129 | ####################################################################### |
a59680062837
Continued implementing the editor outline widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7685
diff
changeset
|
130 | ## Methods dealing with the navigation combos below |
a59680062837
Continued implementing the editor outline widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7685
diff
changeset
|
131 | ####################################################################### |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
132 | |
7690
a59680062837
Continued implementing the editor outline widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7685
diff
changeset
|
133 | def __activateCombos(self, activate): |
a59680062837
Continued implementing the editor outline widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7685
diff
changeset
|
134 | """ |
a59680062837
Continued implementing the editor outline widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7685
diff
changeset
|
135 | Private slot to activate the navigation combo boxes. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
136 | |
7690
a59680062837
Continued implementing the editor outline widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7685
diff
changeset
|
137 | @param activate flag indicating to activate the combo boxes |
a59680062837
Continued implementing the editor outline widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7685
diff
changeset
|
138 | @type bool |
a59680062837
Continued implementing the editor outline widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7685
diff
changeset
|
139 | """ |
a59680062837
Continued implementing the editor outline widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7685
diff
changeset
|
140 | self.__globalsCombo.setVisible(activate) |
a59680062837
Continued implementing the editor outline widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7685
diff
changeset
|
141 | self.__membersCombo.setVisible(activate) |
a59680062837
Continued implementing the editor outline widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7685
diff
changeset
|
142 | if activate: |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
143 | self.__globalsCombo.activated[int].connect(self.__globalsActivated) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
144 | self.__membersCombo.activated[int].connect(self.__membersActivated) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
145 | self.__editor.cursorLineChanged.connect(self.__editorCursorLineChanged) |
7690
a59680062837
Continued implementing the editor outline widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7685
diff
changeset
|
146 | self.__parseTimer.timeout.connect(self.__parseEditor) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
147 | |
7690
a59680062837
Continued implementing the editor outline widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7685
diff
changeset
|
148 | self.__parseEditor() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
149 | |
7690
a59680062837
Continued implementing the editor outline widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7685
diff
changeset
|
150 | line, _ = self.__editor.getCursorPosition() |
a59680062837
Continued implementing the editor outline widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7685
diff
changeset
|
151 | self.__editorCursorLineChanged(line) |
a59680062837
Continued implementing the editor outline widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7685
diff
changeset
|
152 | else: |
8243
cc717c2ae956
Applied some more code simplifications suggested by the new Simplify checker (Y105: use contextlib.suppress) (batch 2).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8220
diff
changeset
|
153 | with contextlib.suppress(TypeError): |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
154 | self.__globalsCombo.activated[int].disconnect(self.__globalsActivated) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
155 | self.__membersCombo.activated[int].disconnect(self.__membersActivated) |
7690
a59680062837
Continued implementing the editor outline widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7685
diff
changeset
|
156 | self.__editor.cursorLineChanged.disconnect( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
157 | self.__editorCursorLineChanged |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
158 | ) |
7690
a59680062837
Continued implementing the editor outline widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7685
diff
changeset
|
159 | self.__parseTimer.timeout.disconnect(self.__parseEditor) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
160 | |
7690
a59680062837
Continued implementing the editor outline widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7685
diff
changeset
|
161 | self.__globalsCombo.clear() |
a59680062837
Continued implementing the editor outline widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7685
diff
changeset
|
162 | self.__membersCombo.clear() |
a59680062837
Continued implementing the editor outline widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7685
diff
changeset
|
163 | self.__globalsBoundaries = {} |
a59680062837
Continued implementing the editor outline widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7685
diff
changeset
|
164 | self.__membersBoundaries = {} |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
165 | |
1567
d03369218b6d
Fixed the editor combo box navigation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1509
diff
changeset
|
166 | def __globalsActivated(self, index, moveCursor=True): |
1358
c1622c708cd9
Added source navigation function for Python 2, Python 3 and Ruby sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
167 | """ |
3011
18292228c724
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2768
diff
changeset
|
168 | Private method to jump to the line of the selected global entry and to |
18292228c724
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2768
diff
changeset
|
169 | populate the members combo box. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
170 | |
7690
a59680062837
Continued implementing the editor outline widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7685
diff
changeset
|
171 | @param index index of the selected entry |
a59680062837
Continued implementing the editor outline widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7685
diff
changeset
|
172 | @type int |
a59680062837
Continued implementing the editor outline widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7685
diff
changeset
|
173 | @param moveCursor flag indicating to move the editor cursor |
a59680062837
Continued implementing the editor outline widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7685
diff
changeset
|
174 | @type bool |
1358
c1622c708cd9
Added source navigation function for Python 2, Python 3 and Ruby sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
175 | """ |
c1622c708cd9
Added source navigation function for Python 2, Python 3 and Ruby sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
176 | # step 1: go to the line of the selected entry |
c1622c708cd9
Added source navigation function for Python 2, Python 3 and Ruby sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
177 | lineno = self.__globalsCombo.itemData(index) |
1439
953d3f95ee4d
Fixed an issue in the editor assembly widget causing it to produce a trackeback.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1421
diff
changeset
|
178 | if lineno is not None: |
1567
d03369218b6d
Fixed the editor combo box navigation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1509
diff
changeset
|
179 | if moveCursor: |
d03369218b6d
Fixed the editor combo box navigation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1509
diff
changeset
|
180 | txt = self.__editor.text(lineno - 1).rstrip() |
d03369218b6d
Fixed the editor combo box navigation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1509
diff
changeset
|
181 | pos = len(txt.replace(txt.strip(), "")) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
182 | self.__editor.gotoLine(lineno, pos if pos == 0 else pos + 1, True) |
1567
d03369218b6d
Fixed the editor combo box navigation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1509
diff
changeset
|
183 | self.__editor.setFocus() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
184 | |
1439
953d3f95ee4d
Fixed an issue in the editor assembly widget causing it to produce a trackeback.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1421
diff
changeset
|
185 | # step 2: populate the members combo, if the entry is a class |
953d3f95ee4d
Fixed an issue in the editor assembly widget causing it to produce a trackeback.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1421
diff
changeset
|
186 | self.__membersCombo.clear() |
2768
eab35f6e709f
Added support to show the current class/method name in the combo boxes at the top of the editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2409
diff
changeset
|
187 | self.__membersBoundaries = {} |
eab35f6e709f
Added support to show the current class/method name in the combo boxes at the top of the editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2409
diff
changeset
|
188 | self.__membersCombo.addItem("") |
eab35f6e709f
Added support to show the current class/method name in the combo boxes at the top of the editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2409
diff
changeset
|
189 | memberIndex = 0 |
1439
953d3f95ee4d
Fixed an issue in the editor assembly widget causing it to produce a trackeback.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1421
diff
changeset
|
190 | entryName = self.__globalsCombo.itemText(index) |
1609
b7717f065282
Added the forgotten code to handle Ruby modules to the EditorAssembly widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1567
diff
changeset
|
191 | if self.__module: |
b7717f065282
Added the forgotten code to handle Ruby modules to the EditorAssembly widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1567
diff
changeset
|
192 | if entryName in self.__module.classes: |
b7717f065282
Added the forgotten code to handle Ruby modules to the EditorAssembly widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1567
diff
changeset
|
193 | entry = self.__module.classes[entryName] |
b7717f065282
Added the forgotten code to handle Ruby modules to the EditorAssembly widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1567
diff
changeset
|
194 | elif entryName in self.__module.modules: |
b7717f065282
Added the forgotten code to handle Ruby modules to the EditorAssembly widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1567
diff
changeset
|
195 | entry = self.__module.modules[entryName] |
b7717f065282
Added the forgotten code to handle Ruby modules to the EditorAssembly widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1567
diff
changeset
|
196 | # step 2.0: add module classes |
8089
e43bf8d7baf9
EditorAssembly: fixed a few issues not detected by the earlier tests performed.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8088
diff
changeset
|
197 | items = [] |
1609
b7717f065282
Added the forgotten code to handle Ruby modules to the EditorAssembly widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1567
diff
changeset
|
198 | for cl in entry.classes.values(): |
b7717f065282
Added the forgotten code to handle Ruby modules to the EditorAssembly widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1567
diff
changeset
|
199 | if cl.isPrivate(): |
9413
80c06d472826
Changed the eric7 import statements to include the package name (i.e. eric7) in order to not fiddle with sys.path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9221
diff
changeset
|
200 | icon = EricPixmapCache.getIcon("class_private") |
1609
b7717f065282
Added the forgotten code to handle Ruby modules to the EditorAssembly widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1567
diff
changeset
|
201 | elif cl.isProtected(): |
9413
80c06d472826
Changed the eric7 import statements to include the package name (i.e. eric7) in order to not fiddle with sys.path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9221
diff
changeset
|
202 | icon = EricPixmapCache.getIcon("class_protected") |
1609
b7717f065282
Added the forgotten code to handle Ruby modules to the EditorAssembly widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1567
diff
changeset
|
203 | else: |
9413
80c06d472826
Changed the eric7 import statements to include the package name (i.e. eric7) in order to not fiddle with sys.path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9221
diff
changeset
|
204 | icon = EricPixmapCache.getIcon("class") |
8089
e43bf8d7baf9
EditorAssembly: fixed a few issues not detected by the earlier tests performed.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8088
diff
changeset
|
205 | items.append((icon, cl.name, cl.lineno, cl.endlineno)) |
e43bf8d7baf9
EditorAssembly: fixed a few issues not detected by the earlier tests performed.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8088
diff
changeset
|
206 | for itm in sorted(items, key=lambda x: (x[1], x[2])): |
e43bf8d7baf9
EditorAssembly: fixed a few issues not detected by the earlier tests performed.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8088
diff
changeset
|
207 | self.__membersCombo.addItem(itm[0], itm[1], itm[2]) |
2768
eab35f6e709f
Added support to show the current class/method name in the combo boxes at the top of the editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2409
diff
changeset
|
208 | memberIndex += 1 |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
209 | self.__membersBoundaries[(itm[2], itm[3])] = memberIndex |
1609
b7717f065282
Added the forgotten code to handle Ruby modules to the EditorAssembly widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1567
diff
changeset
|
210 | else: |
b7717f065282
Added the forgotten code to handle Ruby modules to the EditorAssembly widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1567
diff
changeset
|
211 | return |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
212 | |
1439
953d3f95ee4d
Fixed an issue in the editor assembly widget causing it to produce a trackeback.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1421
diff
changeset
|
213 | # step 2.1: add class methods |
8088
7c454b82b6ed
EditorAssembly: changed code of the navigation selectors to allow duplicate entries (e.g. in case of conditionally defined functions).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
214 | items = [] |
1609
b7717f065282
Added the forgotten code to handle Ruby modules to the EditorAssembly widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1567
diff
changeset
|
215 | for meth in entry.methods.values(): |
1439
953d3f95ee4d
Fixed an issue in the editor assembly widget causing it to produce a trackeback.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1421
diff
changeset
|
216 | if meth.modifier == Function.Static: |
9413
80c06d472826
Changed the eric7 import statements to include the package name (i.e. eric7) in order to not fiddle with sys.path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9221
diff
changeset
|
217 | icon = EricPixmapCache.getIcon("method_static") |
1439
953d3f95ee4d
Fixed an issue in the editor assembly widget causing it to produce a trackeback.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1421
diff
changeset
|
218 | elif meth.modifier == Function.Class: |
9413
80c06d472826
Changed the eric7 import statements to include the package name (i.e. eric7) in order to not fiddle with sys.path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9221
diff
changeset
|
219 | icon = EricPixmapCache.getIcon("method_class") |
1439
953d3f95ee4d
Fixed an issue in the editor assembly widget causing it to produce a trackeback.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1421
diff
changeset
|
220 | elif meth.isPrivate(): |
9413
80c06d472826
Changed the eric7 import statements to include the package name (i.e. eric7) in order to not fiddle with sys.path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9221
diff
changeset
|
221 | icon = EricPixmapCache.getIcon("method_private") |
1439
953d3f95ee4d
Fixed an issue in the editor assembly widget causing it to produce a trackeback.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1421
diff
changeset
|
222 | elif meth.isProtected(): |
9413
80c06d472826
Changed the eric7 import statements to include the package name (i.e. eric7) in order to not fiddle with sys.path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9221
diff
changeset
|
223 | icon = EricPixmapCache.getIcon("method_protected") |
1439
953d3f95ee4d
Fixed an issue in the editor assembly widget causing it to produce a trackeback.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1421
diff
changeset
|
224 | else: |
9413
80c06d472826
Changed the eric7 import statements to include the package name (i.e. eric7) in order to not fiddle with sys.path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9221
diff
changeset
|
225 | icon = EricPixmapCache.getIcon("method") |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
226 | items.append((icon, meth.name, meth.lineno, meth.endlineno)) |
8088
7c454b82b6ed
EditorAssembly: changed code of the navigation selectors to allow duplicate entries (e.g. in case of conditionally defined functions).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
227 | for itm in sorted(items, key=lambda x: (x[1], x[2])): |
7c454b82b6ed
EditorAssembly: changed code of the navigation selectors to allow duplicate entries (e.g. in case of conditionally defined functions).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
228 | self.__membersCombo.addItem(itm[0], itm[1], itm[2]) |
2768
eab35f6e709f
Added support to show the current class/method name in the combo boxes at the top of the editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2409
diff
changeset
|
229 | memberIndex += 1 |
8088
7c454b82b6ed
EditorAssembly: changed code of the navigation selectors to allow duplicate entries (e.g. in case of conditionally defined functions).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
230 | self.__membersBoundaries[(itm[2], itm[3])] = memberIndex |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
231 | |
1439
953d3f95ee4d
Fixed an issue in the editor assembly widget causing it to produce a trackeback.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1421
diff
changeset
|
232 | # step 2.2: add class instance attributes |
8088
7c454b82b6ed
EditorAssembly: changed code of the navigation selectors to allow duplicate entries (e.g. in case of conditionally defined functions).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
233 | items = [] |
1609
b7717f065282
Added the forgotten code to handle Ruby modules to the EditorAssembly widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1567
diff
changeset
|
234 | for attr in entry.attributes.values(): |
1439
953d3f95ee4d
Fixed an issue in the editor assembly widget causing it to produce a trackeback.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1421
diff
changeset
|
235 | if attr.isPrivate(): |
9413
80c06d472826
Changed the eric7 import statements to include the package name (i.e. eric7) in order to not fiddle with sys.path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9221
diff
changeset
|
236 | icon = EricPixmapCache.getIcon("attribute_private") |
1439
953d3f95ee4d
Fixed an issue in the editor assembly widget causing it to produce a trackeback.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1421
diff
changeset
|
237 | elif attr.isProtected(): |
9413
80c06d472826
Changed the eric7 import statements to include the package name (i.e. eric7) in order to not fiddle with sys.path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9221
diff
changeset
|
238 | icon = EricPixmapCache.getIcon("attribute_protected") |
1439
953d3f95ee4d
Fixed an issue in the editor assembly widget causing it to produce a trackeback.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1421
diff
changeset
|
239 | else: |
9413
80c06d472826
Changed the eric7 import statements to include the package name (i.e. eric7) in order to not fiddle with sys.path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9221
diff
changeset
|
240 | icon = EricPixmapCache.getIcon("attribute") |
8088
7c454b82b6ed
EditorAssembly: changed code of the navigation selectors to allow duplicate entries (e.g. in case of conditionally defined functions).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
241 | items.append((icon, attr.name, attr.lineno)) |
7c454b82b6ed
EditorAssembly: changed code of the navigation selectors to allow duplicate entries (e.g. in case of conditionally defined functions).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
242 | for itm in sorted(items, key=lambda x: (x[1], x[2])): |
7c454b82b6ed
EditorAssembly: changed code of the navigation selectors to allow duplicate entries (e.g. in case of conditionally defined functions).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
243 | self.__membersCombo.addItem(itm[0], itm[1], itm[2]) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
244 | |
1439
953d3f95ee4d
Fixed an issue in the editor assembly widget causing it to produce a trackeback.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1421
diff
changeset
|
245 | # step 2.3: add class attributes |
8088
7c454b82b6ed
EditorAssembly: changed code of the navigation selectors to allow duplicate entries (e.g. in case of conditionally defined functions).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
246 | items = [] |
9413
80c06d472826
Changed the eric7 import statements to include the package name (i.e. eric7) in order to not fiddle with sys.path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9221
diff
changeset
|
247 | icon = EricPixmapCache.getIcon("attribute_class") |
8088
7c454b82b6ed
EditorAssembly: changed code of the navigation selectors to allow duplicate entries (e.g. in case of conditionally defined functions).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
248 | for globalVar in entry.globals.values(): |
8089
e43bf8d7baf9
EditorAssembly: fixed a few issues not detected by the earlier tests performed.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8088
diff
changeset
|
249 | items.append((icon, globalVar.name, globalVar.lineno)) |
8088
7c454b82b6ed
EditorAssembly: changed code of the navigation selectors to allow duplicate entries (e.g. in case of conditionally defined functions).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
250 | for itm in sorted(items, key=lambda x: (x[1], x[2])): |
7c454b82b6ed
EditorAssembly: changed code of the navigation selectors to allow duplicate entries (e.g. in case of conditionally defined functions).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
251 | self.__membersCombo.addItem(itm[0], itm[1], itm[2]) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
252 | |
1567
d03369218b6d
Fixed the editor combo box navigation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1509
diff
changeset
|
253 | def __membersActivated(self, index, moveCursor=True): |
1358
c1622c708cd9
Added source navigation function for Python 2, Python 3 and Ruby sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
254 | """ |
c1622c708cd9
Added source navigation function for Python 2, Python 3 and Ruby sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
255 | Private method to jump to the line of the selected members entry. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
256 | |
7690
a59680062837
Continued implementing the editor outline widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7685
diff
changeset
|
257 | @param index index of the selected entry |
a59680062837
Continued implementing the editor outline widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7685
diff
changeset
|
258 | @type int |
a59680062837
Continued implementing the editor outline widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7685
diff
changeset
|
259 | @param moveCursor flag indicating to move the editor cursor |
a59680062837
Continued implementing the editor outline widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7685
diff
changeset
|
260 | @type bool |
1358
c1622c708cd9
Added source navigation function for Python 2, Python 3 and Ruby sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
261 | """ |
c1622c708cd9
Added source navigation function for Python 2, Python 3 and Ruby sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
262 | lineno = self.__membersCombo.itemData(index) |
1567
d03369218b6d
Fixed the editor combo box navigation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1509
diff
changeset
|
263 | if lineno is not None and moveCursor: |
1439
953d3f95ee4d
Fixed an issue in the editor assembly widget causing it to produce a trackeback.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1421
diff
changeset
|
264 | txt = self.__editor.text(lineno - 1).rstrip() |
953d3f95ee4d
Fixed an issue in the editor assembly widget causing it to produce a trackeback.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1421
diff
changeset
|
265 | pos = len(txt.replace(txt.strip(), "")) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
266 | self.__editor.gotoLine( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
267 | lineno, pos if pos == 0 else pos + 1, firstVisible=True, expand=True |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
268 | ) |
1439
953d3f95ee4d
Fixed an issue in the editor assembly widget causing it to produce a trackeback.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1421
diff
changeset
|
269 | self.__editor.setFocus() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
270 | |
1358
c1622c708cd9
Added source navigation function for Python 2, Python 3 and Ruby sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
271 | def __resetParseTimer(self): |
c1622c708cd9
Added source navigation function for Python 2, Python 3 and Ruby sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
272 | """ |
c1622c708cd9
Added source navigation function for Python 2, Python 3 and Ruby sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
273 | Private slot to reset the parse timer. |
c1622c708cd9
Added source navigation function for Python 2, Python 3 and Ruby sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
274 | """ |
c1622c708cd9
Added source navigation function for Python 2, Python 3 and Ruby sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
275 | self.__parseTimer.stop() |
c1622c708cd9
Added source navigation function for Python 2, Python 3 and Ruby sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
276 | self.__parseTimer.start() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
277 | |
1358
c1622c708cd9
Added source navigation function for Python 2, Python 3 and Ruby sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
278 | def __parseEditor(self): |
c1622c708cd9
Added source navigation function for Python 2, Python 3 and Ruby sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
279 | """ |
3011
18292228c724
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2768
diff
changeset
|
280 | Private method to parse the editor source and repopulate the globals |
18292228c724
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2768
diff
changeset
|
281 | combo. |
1358
c1622c708cd9
Added source navigation function for Python 2, Python 3 and Ruby sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
282 | """ |
9413
80c06d472826
Changed the eric7 import statements to include the package name (i.e. eric7) in order to not fiddle with sys.path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9221
diff
changeset
|
283 | from eric7.Utilities.ModuleParser import Module, getTypeFromTypeName |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
284 | |
1358
c1622c708cd9
Added source navigation function for Python 2, Python 3 and Ruby sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
285 | self.__module = None |
c1622c708cd9
Added source navigation function for Python 2, Python 3 and Ruby sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
286 | sourceType = getTypeFromTypeName(self.__editor.determineFileType()) |
c1622c708cd9
Added source navigation function for Python 2, Python 3 and Ruby sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
287 | if sourceType != -1: |
c1622c708cd9
Added source navigation function for Python 2, Python 3 and Ruby sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
288 | src = self.__editor.text() |
c1622c708cd9
Added source navigation function for Python 2, Python 3 and Ruby sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
289 | if src: |
c1622c708cd9
Added source navigation function for Python 2, Python 3 and Ruby sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
290 | fn = self.__editor.getFileName() |
c1622c708cd9
Added source navigation function for Python 2, Python 3 and Ruby sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
291 | if fn is None: |
c1622c708cd9
Added source navigation function for Python 2, Python 3 and Ruby sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
292 | fn = "" |
c1622c708cd9
Added source navigation function for Python 2, Python 3 and Ruby sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
293 | self.__module = Module("", fn, sourceType) |
c1622c708cd9
Added source navigation function for Python 2, Python 3 and Ruby sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
294 | self.__module.scan(src) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
295 | |
1567
d03369218b6d
Fixed the editor combo box navigation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1509
diff
changeset
|
296 | # remember the current selections |
d03369218b6d
Fixed the editor combo box navigation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1509
diff
changeset
|
297 | self.__selectedGlobal = self.__globalsCombo.currentText() |
d03369218b6d
Fixed the editor combo box navigation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1509
diff
changeset
|
298 | self.__selectedMember = self.__membersCombo.currentText() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
299 | |
1358
c1622c708cd9
Added source navigation function for Python 2, Python 3 and Ruby sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
300 | self.__globalsCombo.clear() |
c1622c708cd9
Added source navigation function for Python 2, Python 3 and Ruby sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
301 | self.__membersCombo.clear() |
2768
eab35f6e709f
Added support to show the current class/method name in the combo boxes at the top of the editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2409
diff
changeset
|
302 | self.__globalsBoundaries = {} |
eab35f6e709f
Added support to show the current class/method name in the combo boxes at the top of the editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2409
diff
changeset
|
303 | self.__membersBoundaries = {} |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
304 | |
1358
c1622c708cd9
Added source navigation function for Python 2, Python 3 and Ruby sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
305 | self.__globalsCombo.addItem("") |
2768
eab35f6e709f
Added support to show the current class/method name in the combo boxes at the top of the editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2409
diff
changeset
|
306 | index = 0 |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
307 | |
1609
b7717f065282
Added the forgotten code to handle Ruby modules to the EditorAssembly widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1567
diff
changeset
|
308 | # step 1: add modules |
8088
7c454b82b6ed
EditorAssembly: changed code of the navigation selectors to allow duplicate entries (e.g. in case of conditionally defined functions).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
309 | items = [] |
1609
b7717f065282
Added the forgotten code to handle Ruby modules to the EditorAssembly widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1567
diff
changeset
|
310 | for module in self.__module.modules.values(): |
8088
7c454b82b6ed
EditorAssembly: changed code of the navigation selectors to allow duplicate entries (e.g. in case of conditionally defined functions).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
311 | items.append( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
312 | ( |
9413
80c06d472826
Changed the eric7 import statements to include the package name (i.e. eric7) in order to not fiddle with sys.path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9221
diff
changeset
|
313 | EricPixmapCache.getIcon("module"), |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
314 | module.name, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
315 | module.lineno, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
316 | module.endlineno, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
317 | ) |
8088
7c454b82b6ed
EditorAssembly: changed code of the navigation selectors to allow duplicate entries (e.g. in case of conditionally defined functions).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
318 | ) |
7c454b82b6ed
EditorAssembly: changed code of the navigation selectors to allow duplicate entries (e.g. in case of conditionally defined functions).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
319 | for itm in sorted(items, key=lambda x: (x[1], x[2])): |
7c454b82b6ed
EditorAssembly: changed code of the navigation selectors to allow duplicate entries (e.g. in case of conditionally defined functions).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
320 | self.__globalsCombo.addItem(itm[0], itm[1], itm[2]) |
2768
eab35f6e709f
Added support to show the current class/method name in the combo boxes at the top of the editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2409
diff
changeset
|
321 | index += 1 |
8088
7c454b82b6ed
EditorAssembly: changed code of the navigation selectors to allow duplicate entries (e.g. in case of conditionally defined functions).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
322 | self.__globalsBoundaries[(itm[2], itm[3])] = index |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
323 | |
1609
b7717f065282
Added the forgotten code to handle Ruby modules to the EditorAssembly widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1567
diff
changeset
|
324 | # step 2: add classes |
8088
7c454b82b6ed
EditorAssembly: changed code of the navigation selectors to allow duplicate entries (e.g. in case of conditionally defined functions).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
325 | items = [] |
1358
c1622c708cd9
Added source navigation function for Python 2, Python 3 and Ruby sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
326 | for cl in self.__module.classes.values(): |
c1622c708cd9
Added source navigation function for Python 2, Python 3 and Ruby sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
327 | if cl.isPrivate(): |
9413
80c06d472826
Changed the eric7 import statements to include the package name (i.e. eric7) in order to not fiddle with sys.path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9221
diff
changeset
|
328 | icon = EricPixmapCache.getIcon("class_private") |
1358
c1622c708cd9
Added source navigation function for Python 2, Python 3 and Ruby sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
329 | elif cl.isProtected(): |
9413
80c06d472826
Changed the eric7 import statements to include the package name (i.e. eric7) in order to not fiddle with sys.path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9221
diff
changeset
|
330 | icon = EricPixmapCache.getIcon("class_protected") |
1358
c1622c708cd9
Added source navigation function for Python 2, Python 3 and Ruby sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
331 | else: |
9413
80c06d472826
Changed the eric7 import statements to include the package name (i.e. eric7) in order to not fiddle with sys.path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9221
diff
changeset
|
332 | icon = EricPixmapCache.getIcon("class") |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
333 | items.append((icon, cl.name, cl.lineno, cl.endlineno)) |
8088
7c454b82b6ed
EditorAssembly: changed code of the navigation selectors to allow duplicate entries (e.g. in case of conditionally defined functions).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
334 | for itm in sorted(items, key=lambda x: (x[1], x[2])): |
7c454b82b6ed
EditorAssembly: changed code of the navigation selectors to allow duplicate entries (e.g. in case of conditionally defined functions).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
335 | self.__globalsCombo.addItem(itm[0], itm[1], itm[2]) |
2768
eab35f6e709f
Added support to show the current class/method name in the combo boxes at the top of the editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2409
diff
changeset
|
336 | index += 1 |
8088
7c454b82b6ed
EditorAssembly: changed code of the navigation selectors to allow duplicate entries (e.g. in case of conditionally defined functions).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
337 | self.__globalsBoundaries[(itm[2], itm[3])] = index |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
338 | |
1609
b7717f065282
Added the forgotten code to handle Ruby modules to the EditorAssembly widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1567
diff
changeset
|
339 | # step 3: add functions |
8088
7c454b82b6ed
EditorAssembly: changed code of the navigation selectors to allow duplicate entries (e.g. in case of conditionally defined functions).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
340 | items = [] |
1358
c1622c708cd9
Added source navigation function for Python 2, Python 3 and Ruby sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
341 | for func in self.__module.functions.values(): |
c1622c708cd9
Added source navigation function for Python 2, Python 3 and Ruby sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
342 | if func.isPrivate(): |
9413
80c06d472826
Changed the eric7 import statements to include the package name (i.e. eric7) in order to not fiddle with sys.path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9221
diff
changeset
|
343 | icon = EricPixmapCache.getIcon("method_private") |
1358
c1622c708cd9
Added source navigation function for Python 2, Python 3 and Ruby sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
344 | elif func.isProtected(): |
9413
80c06d472826
Changed the eric7 import statements to include the package name (i.e. eric7) in order to not fiddle with sys.path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9221
diff
changeset
|
345 | icon = EricPixmapCache.getIcon("method_protected") |
1358
c1622c708cd9
Added source navigation function for Python 2, Python 3 and Ruby sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
346 | else: |
9413
80c06d472826
Changed the eric7 import statements to include the package name (i.e. eric7) in order to not fiddle with sys.path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9221
diff
changeset
|
347 | icon = EricPixmapCache.getIcon("method") |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
348 | items.append((icon, func.name, func.lineno, func.endlineno)) |
8088
7c454b82b6ed
EditorAssembly: changed code of the navigation selectors to allow duplicate entries (e.g. in case of conditionally defined functions).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
349 | for itm in sorted(items, key=lambda x: (x[1], x[2])): |
7c454b82b6ed
EditorAssembly: changed code of the navigation selectors to allow duplicate entries (e.g. in case of conditionally defined functions).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
350 | self.__globalsCombo.addItem(itm[0], itm[1], itm[2]) |
2768
eab35f6e709f
Added support to show the current class/method name in the combo boxes at the top of the editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2409
diff
changeset
|
351 | index += 1 |
8088
7c454b82b6ed
EditorAssembly: changed code of the navigation selectors to allow duplicate entries (e.g. in case of conditionally defined functions).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
352 | self.__globalsBoundaries[(itm[2], itm[3])] = index |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
353 | |
1609
b7717f065282
Added the forgotten code to handle Ruby modules to the EditorAssembly widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1567
diff
changeset
|
354 | # step 4: add attributes |
8088
7c454b82b6ed
EditorAssembly: changed code of the navigation selectors to allow duplicate entries (e.g. in case of conditionally defined functions).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
355 | items = [] |
7c454b82b6ed
EditorAssembly: changed code of the navigation selectors to allow duplicate entries (e.g. in case of conditionally defined functions).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
356 | for globalValue in self.__module.globals.values(): |
7c454b82b6ed
EditorAssembly: changed code of the navigation selectors to allow duplicate entries (e.g. in case of conditionally defined functions).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
357 | if globalValue.isPrivate(): |
9413
80c06d472826
Changed the eric7 import statements to include the package name (i.e. eric7) in order to not fiddle with sys.path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9221
diff
changeset
|
358 | icon = EricPixmapCache.getIcon("attribute_private") |
8088
7c454b82b6ed
EditorAssembly: changed code of the navigation selectors to allow duplicate entries (e.g. in case of conditionally defined functions).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
359 | elif globalValue.isProtected(): |
9413
80c06d472826
Changed the eric7 import statements to include the package name (i.e. eric7) in order to not fiddle with sys.path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9221
diff
changeset
|
360 | icon = EricPixmapCache.getIcon("attribute_protected") |
1358
c1622c708cd9
Added source navigation function for Python 2, Python 3 and Ruby sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
361 | else: |
9413
80c06d472826
Changed the eric7 import statements to include the package name (i.e. eric7) in order to not fiddle with sys.path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9221
diff
changeset
|
362 | icon = EricPixmapCache.getIcon("attribute") |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
363 | items.append((icon, globalValue.name, globalValue.lineno)) |
8088
7c454b82b6ed
EditorAssembly: changed code of the navigation selectors to allow duplicate entries (e.g. in case of conditionally defined functions).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
364 | for itm in sorted(items, key=lambda x: (x[1], x[2])): |
7c454b82b6ed
EditorAssembly: changed code of the navigation selectors to allow duplicate entries (e.g. in case of conditionally defined functions).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
365 | self.__globalsCombo.addItem(itm[0], itm[1], itm[2]) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
366 | |
3011
18292228c724
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2768
diff
changeset
|
367 | # reset the currently selected entries without moving the |
18292228c724
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2768
diff
changeset
|
368 | # text cursor |
1567
d03369218b6d
Fixed the editor combo box navigation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1509
diff
changeset
|
369 | index = self.__globalsCombo.findText(self.__selectedGlobal) |
d03369218b6d
Fixed the editor combo box navigation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1509
diff
changeset
|
370 | if index != -1: |
d03369218b6d
Fixed the editor combo box navigation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1509
diff
changeset
|
371 | self.__globalsCombo.setCurrentIndex(index) |
d03369218b6d
Fixed the editor combo box navigation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1509
diff
changeset
|
372 | self.__globalsActivated(index, moveCursor=False) |
d03369218b6d
Fixed the editor combo box navigation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1509
diff
changeset
|
373 | index = self.__membersCombo.findText(self.__selectedMember) |
d03369218b6d
Fixed the editor combo box navigation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1509
diff
changeset
|
374 | if index != -1: |
d03369218b6d
Fixed the editor combo box navigation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1509
diff
changeset
|
375 | self.__membersCombo.setCurrentIndex(index) |
d03369218b6d
Fixed the editor combo box navigation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1509
diff
changeset
|
376 | self.__membersActivated(index, moveCursor=False) |
7175
68f83a144355
EditorAssembly: fixed an issue causing the navigation combos not being populated for MicroPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
377 | else: |
68f83a144355
EditorAssembly: fixed an issue causing the navigation combos not being populated for MicroPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
378 | self.__globalsCombo.clear() |
68f83a144355
EditorAssembly: fixed an issue causing the navigation combos not being populated for MicroPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
379 | self.__membersCombo.clear() |
68f83a144355
EditorAssembly: fixed an issue causing the navigation combos not being populated for MicroPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
380 | self.__globalsBoundaries = {} |
68f83a144355
EditorAssembly: fixed an issue causing the navigation combos not being populated for MicroPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
381 | self.__membersBoundaries = {} |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
382 | |
2768
eab35f6e709f
Added support to show the current class/method name in the combo boxes at the top of the editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2409
diff
changeset
|
383 | def __editorCursorLineChanged(self, lineno): |
eab35f6e709f
Added support to show the current class/method name in the combo boxes at the top of the editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2409
diff
changeset
|
384 | """ |
eab35f6e709f
Added support to show the current class/method name in the combo boxes at the top of the editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2409
diff
changeset
|
385 | Private slot handling a line change of the cursor of the editor. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
386 | |
7690
a59680062837
Continued implementing the editor outline widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7685
diff
changeset
|
387 | @param lineno line number of the cursor |
a59680062837
Continued implementing the editor outline widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7685
diff
changeset
|
388 | @type int |
2768
eab35f6e709f
Added support to show the current class/method name in the combo boxes at the top of the editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2409
diff
changeset
|
389 | """ |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
390 | lineno += 1 # cursor position is zero based, code info one based |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
391 | |
2768
eab35f6e709f
Added support to show the current class/method name in the combo boxes at the top of the editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2409
diff
changeset
|
392 | # step 1: search in the globals |
6188
5a6ae3be31e6
Fixed some loop related coding issues detected by the extended code style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6048
diff
changeset
|
393 | indexFound = 0 |
2768
eab35f6e709f
Added support to show the current class/method name in the combo boxes at the top of the editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2409
diff
changeset
|
394 | for (lower, upper), index in self.__globalsBoundaries.items(): |
eab35f6e709f
Added support to show the current class/method name in the combo boxes at the top of the editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2409
diff
changeset
|
395 | if upper == -1: |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
396 | upper = 1000000 # it is the last line |
2768
eab35f6e709f
Added support to show the current class/method name in the combo boxes at the top of the editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2409
diff
changeset
|
397 | if lower <= lineno <= upper: |
6188
5a6ae3be31e6
Fixed some loop related coding issues detected by the extended code style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6048
diff
changeset
|
398 | indexFound = index |
2768
eab35f6e709f
Added support to show the current class/method name in the combo boxes at the top of the editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2409
diff
changeset
|
399 | break |
6188
5a6ae3be31e6
Fixed some loop related coding issues detected by the extended code style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6048
diff
changeset
|
400 | self.__globalsCombo.setCurrentIndex(indexFound) |
5a6ae3be31e6
Fixed some loop related coding issues detected by the extended code style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6048
diff
changeset
|
401 | self.__globalsActivated(indexFound, moveCursor=False) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
402 | |
2768
eab35f6e709f
Added support to show the current class/method name in the combo boxes at the top of the editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2409
diff
changeset
|
403 | # step 2: search in members |
6188
5a6ae3be31e6
Fixed some loop related coding issues detected by the extended code style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6048
diff
changeset
|
404 | indexFound = 0 |
2768
eab35f6e709f
Added support to show the current class/method name in the combo boxes at the top of the editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2409
diff
changeset
|
405 | for (lower, upper), index in self.__membersBoundaries.items(): |
eab35f6e709f
Added support to show the current class/method name in the combo boxes at the top of the editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2409
diff
changeset
|
406 | if upper == -1: |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
407 | upper = 1000000 # it is the last line |
2768
eab35f6e709f
Added support to show the current class/method name in the combo boxes at the top of the editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2409
diff
changeset
|
408 | if lower <= lineno <= upper: |
6188
5a6ae3be31e6
Fixed some loop related coding issues detected by the extended code style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6048
diff
changeset
|
409 | indexFound = index |
2768
eab35f6e709f
Added support to show the current class/method name in the combo boxes at the top of the editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2409
diff
changeset
|
410 | break |
6188
5a6ae3be31e6
Fixed some loop related coding issues detected by the extended code style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6048
diff
changeset
|
411 | self.__membersCombo.setCurrentIndex(indexFound) |
5a6ae3be31e6
Fixed some loop related coding issues detected by the extended code style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6048
diff
changeset
|
412 | self.__membersActivated(indexFound, moveCursor=False) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
413 | |
7690
a59680062837
Continued implementing the editor outline widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7685
diff
changeset
|
414 | ####################################################################### |
a59680062837
Continued implementing the editor outline widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7685
diff
changeset
|
415 | ## Methods dealing with the source outline below |
a59680062837
Continued implementing the editor outline widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7685
diff
changeset
|
416 | ####################################################################### |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
417 | |
7690
a59680062837
Continued implementing the editor outline widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7685
diff
changeset
|
418 | def __activateOutline(self, activate): |
a59680062837
Continued implementing the editor outline widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7685
diff
changeset
|
419 | """ |
a59680062837
Continued implementing the editor outline widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7685
diff
changeset
|
420 | Private slot to activate the source outline view. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
421 | |
7690
a59680062837
Continued implementing the editor outline widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7685
diff
changeset
|
422 | @param activate flag indicating to activate the source outline view |
a59680062837
Continued implementing the editor outline widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7685
diff
changeset
|
423 | @type bool |
a59680062837
Continued implementing the editor outline widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7685
diff
changeset
|
424 | """ |
a59680062837
Continued implementing the editor outline widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7685
diff
changeset
|
425 | self.__sourceOutline.setActive(activate) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
426 | |
7690
a59680062837
Continued implementing the editor outline widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7685
diff
changeset
|
427 | if activate: |
a59680062837
Continued implementing the editor outline widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7685
diff
changeset
|
428 | self.__sourceOutline.setVisible( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
429 | self.__sourceOutline.isSupportedLanguage(self.__editor.getLanguage()) |
7690
a59680062837
Continued implementing the editor outline widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7685
diff
changeset
|
430 | ) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
431 | |
7690
a59680062837
Continued implementing the editor outline widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7685
diff
changeset
|
432 | self.__parseTimer.timeout.connect(self.__sourceOutline.repopulate) |
a59680062837
Continued implementing the editor outline widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7685
diff
changeset
|
433 | self.__editor.languageChanged.connect(self.__editorChanged) |
a59680062837
Continued implementing the editor outline widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7685
diff
changeset
|
434 | self.__editor.editorRenamed.connect(self.__editorChanged) |
a59680062837
Continued implementing the editor outline widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7685
diff
changeset
|
435 | else: |
a59680062837
Continued implementing the editor outline widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7685
diff
changeset
|
436 | self.__sourceOutline.hide() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
437 | |
8243
cc717c2ae956
Applied some more code simplifications suggested by the new Simplify checker (Y105: use contextlib.suppress) (batch 2).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8220
diff
changeset
|
438 | with contextlib.suppress(TypeError): |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
439 | self.__parseTimer.timeout.disconnect(self.__sourceOutline.repopulate) |
7690
a59680062837
Continued implementing the editor outline widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7685
diff
changeset
|
440 | self.__editor.languageChanged.disconnect(self.__editorChanged) |
a59680062837
Continued implementing the editor outline widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7685
diff
changeset
|
441 | self.__editor.editorRenamed.disconnect(self.__editorChanged) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
442 | |
7690
a59680062837
Continued implementing the editor outline widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7685
diff
changeset
|
443 | def __editorChanged(self): |
a59680062837
Continued implementing the editor outline widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7685
diff
changeset
|
444 | """ |
a59680062837
Continued implementing the editor outline widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7685
diff
changeset
|
445 | Private slot handling changes of the editor language or file name. |
a59680062837
Continued implementing the editor outline widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7685
diff
changeset
|
446 | """ |
a59680062837
Continued implementing the editor outline widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7685
diff
changeset
|
447 | supported = self.__sourceOutline.isSupportedLanguage( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
448 | self.__editor.getLanguage() |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
449 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
450 | |
7690
a59680062837
Continued implementing the editor outline widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7685
diff
changeset
|
451 | self.__sourceOutline.setVisible(supported) |
8220
006ee31b4835
Applied some more code simplifications suggested by the new Simplify checker (Y113: use enumerate()).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8218
diff
changeset
|
452 | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
453 | |
8220
006ee31b4835
Applied some more code simplifications suggested by the new Simplify checker (Y113: use enumerate()).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8218
diff
changeset
|
454 | # |
006ee31b4835
Applied some more code simplifications suggested by the new Simplify checker (Y113: use enumerate()).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8218
diff
changeset
|
455 | # eflag: noqa = Y113 |