eric6/Documentation/Source/eric6.UI.PythonAstViewer.html

changeset 7273
391d6b7b1eff
parent 6942
2602857055c5
child 7705
90a9aefd4253
equal deleted inserted replaced
7272:1779dc278077 7273:391d6b7b1eff
16 16
17 a { color: #BA6D36; } 17 a { color: #BA6D36; }
18 18
19 </style> 19 </style>
20 </head> 20 </head>
21 <body><a NAME="top" ID="top"></a> 21 <body>
22 <a NAME="top" ID="top"></a>
22 <h1>eric6.UI.PythonAstViewer</h1> 23 <h1>eric6.UI.PythonAstViewer</h1>
24
23 <p> 25 <p>
24 Module implementing a widget to visualize the Python AST for some Python 26 Module implementing a widget to visualize the Python AST for some Python
25 sources. 27 sources.
26 </p> 28 </p>
27 <h3>Global Attributes</h3> 29 <h3>Global Attributes</h3>
30
28 <table> 31 <table>
29 <tr><td>None</td></tr> 32 <tr><td>None</td></tr>
30 </table> 33 </table>
31 <h3>Classes</h3> 34 <h3>Classes</h3>
32 <table> 35
36 <table>
37
33 <tr> 38 <tr>
34 <td><a href="#PythonAstViewer">PythonAstViewer</a></td> 39 <td><a href="#PythonAstViewer">PythonAstViewer</a></td>
35 <td>Class implementing a widget to visualize the Python AST for some Python sources.</td> 40 <td>Class implementing a widget to visualize the Python AST for some Python sources.</td>
36 </tr> 41 </tr>
37 </table> 42 </table>
38 <h3>Functions</h3> 43 <h3>Functions</h3>
44
39 <table> 45 <table>
40 <tr><td>None</td></tr> 46 <tr><td>None</td></tr>
41 </table> 47 </table>
42 <hr /><hr /> 48 <hr />
49 <hr />
43 <a NAME="PythonAstViewer" ID="PythonAstViewer"></a> 50 <a NAME="PythonAstViewer" ID="PythonAstViewer"></a>
44 <h2>PythonAstViewer</h2> 51 <h2>PythonAstViewer</h2>
52
45 <p> 53 <p>
46 Class implementing a widget to visualize the Python AST for some Python 54 Class implementing a widget to visualize the Python AST for some Python
47 sources. 55 sources.
48 </p> 56 </p>
49 <h3>Derived from</h3> 57 <h3>Derived from</h3>
50 QWidget 58 QWidget
51 <h3>Class Attributes</h3> 59 <h3>Class Attributes</h3>
60
52 <table> 61 <table>
53 <tr><td>EndIndexRole</td></tr><tr><td>EndLineRole</td></tr><tr><td>StartIndexRole</td></tr><tr><td>StartLineRole</td></tr> 62 <tr><td>EndIndexRole</td></tr><tr><td>EndLineRole</td></tr><tr><td>StartIndexRole</td></tr><tr><td>StartLineRole</td></tr>
54 </table> 63 </table>
55 <h3>Class Methods</h3> 64 <h3>Class Methods</h3>
65
56 <table> 66 <table>
57 <tr><td>None</td></tr> 67 <tr><td>None</td></tr>
58 </table> 68 </table>
59 <h3>Methods</h3> 69 <h3>Methods</h3>
60 <table> 70
71 <table>
72
61 <tr> 73 <tr>
62 <td><a href="#PythonAstViewer.__init__">PythonAstViewer</a></td> 74 <td><a href="#PythonAstViewer.__init__">PythonAstViewer</a></td>
63 <td>Constructor</td> 75 <td>Constructor</td>
64 </tr><tr> 76 </tr>
77 <tr>
65 <td><a href="#PythonAstViewer.__astItemClicked">__astItemClicked</a></td> 78 <td><a href="#PythonAstViewer.__astItemClicked">__astItemClicked</a></td>
66 <td>Private slot handling a user click on an AST node item.</td> 79 <td>Private slot handling a user click on an AST node item.</td>
67 </tr><tr> 80 </tr>
81 <tr>
68 <td><a href="#PythonAstViewer.__astViewerStateChanged">__astViewerStateChanged</a></td> 82 <td><a href="#PythonAstViewer.__astViewerStateChanged">__astViewerStateChanged</a></td>
69 <td>Private slot to toggle the display of the AST viewer.</td> 83 <td>Private slot to toggle the display of the AST viewer.</td>
70 </tr><tr> 84 </tr>
85 <tr>
71 <td><a href="#PythonAstViewer.__clearSelection">__clearSelection</a></td> 86 <td><a href="#PythonAstViewer.__clearSelection">__clearSelection</a></td>
72 <td>Private method to clear all selected items.</td> 87 <td>Private method to clear all selected items.</td>
73 </tr><tr> 88 </tr>
89 <tr>
74 <td><a href="#PythonAstViewer.__createErrorItem">__createErrorItem</a></td> 90 <td><a href="#PythonAstViewer.__createErrorItem">__createErrorItem</a></td>
75 <td>Private method to create a top level error item.</td> 91 <td>Private method to create a top level error item.</td>
76 </tr><tr> 92 </tr>
93 <tr>
77 <td><a href="#PythonAstViewer.__editorChanged">__editorChanged</a></td> 94 <td><a href="#PythonAstViewer.__editorChanged">__editorChanged</a></td>
78 <td>Private slot to handle a change of the current editor.</td> 95 <td>Private slot to handle a change of the current editor.</td>
79 </tr><tr> 96 </tr>
97 <tr>
80 <td><a href="#PythonAstViewer.__editorDoubleClicked">__editorDoubleClicked</a></td> 98 <td><a href="#PythonAstViewer.__editorDoubleClicked">__editorDoubleClicked</a></td>
81 <td>Private slot to handle a mouse button double click in the editor.</td> 99 <td>Private slot to handle a mouse button double click in the editor.</td>
82 </tr><tr> 100 </tr>
101 <tr>
83 <td><a href="#PythonAstViewer.__editorSaved">__editorSaved</a></td> 102 <td><a href="#PythonAstViewer.__editorSaved">__editorSaved</a></td>
84 <td>Private slot to reload the AST after the connected editor was saved.</td> 103 <td>Private slot to reload the AST after the connected editor was saved.</td>
85 </tr><tr> 104 </tr>
105 <tr>
86 <td><a href="#PythonAstViewer.__findClosestContainingItem">__findClosestContainingItem</a></td> 106 <td><a href="#PythonAstViewer.__findClosestContainingItem">__findClosestContainingItem</a></td>
87 <td>Private method to search for the tree item that contains a range closest.</td> 107 <td>Private method to search for the tree item that contains a range closest.</td>
88 </tr><tr> 108 </tr>
109 <tr>
89 <td><a href="#PythonAstViewer.__findClosestContainingNode">__findClosestContainingNode</a></td> 110 <td><a href="#PythonAstViewer.__findClosestContainingNode">__findClosestContainingNode</a></td>
90 <td>Private method to search for the AST node that contains a range closest.</td> 111 <td>Private method to search for the AST node that contains a range closest.</td>
91 </tr><tr> 112 </tr>
113 <tr>
92 <td><a href="#PythonAstViewer.__grabFocus">__grabFocus</a></td> 114 <td><a href="#PythonAstViewer.__grabFocus">__grabFocus</a></td>
93 <td>Private method to grab the input focus.</td> 115 <td>Private method to grab the input focus.</td>
94 </tr><tr> 116 </tr>
117 <tr>
95 <td><a href="#PythonAstViewer.__lastEditorClosed">__lastEditorClosed</a></td> 118 <td><a href="#PythonAstViewer.__lastEditorClosed">__lastEditorClosed</a></td>
96 <td>Private slot to handle the last editor closed signal of the view manager.</td> 119 <td>Private slot to handle the last editor closed signal of the view manager.</td>
97 </tr><tr> 120 </tr>
121 <tr>
98 <td><a href="#PythonAstViewer.__loadAST">__loadAST</a></td> 122 <td><a href="#PythonAstViewer.__loadAST">__loadAST</a></td>
99 <td>Private method to generate the AST from the source of the current editor and visualize it.</td> 123 <td>Private method to generate the AST from the source of the current editor and visualize it.</td>
100 </tr><tr> 124 </tr>
125 <tr>
101 <td><a href="#PythonAstViewer.__markTextRanges">__markTextRanges</a></td> 126 <td><a href="#PythonAstViewer.__markTextRanges">__markTextRanges</a></td>
102 <td>Private method to modify the AST nodes with end_lineno and end_col_offset information.</td> 127 <td>Private method to modify the AST nodes with end_lineno and end_col_offset information.</td>
103 </tr><tr> 128 </tr>
129 <tr>
104 <td><a href="#PythonAstViewer.__populateNode">__populateNode</a></td> 130 <td><a href="#PythonAstViewer.__populateNode">__populateNode</a></td>
105 <td>Private method to populate the tree view with a node.</td> 131 <td>Private method to populate the tree view with a node.</td>
106 </tr><tr> 132 </tr>
133 <tr>
107 <td><a href="#PythonAstViewer.__rangeContainsSmaller">__rangeContainsSmaller</a></td> 134 <td><a href="#PythonAstViewer.__rangeContainsSmaller">__rangeContainsSmaller</a></td>
108 <td>Private method to check, if second is contained in first.</td> 135 <td>Private method to check, if second is contained in first.</td>
109 </tr><tr> 136 </tr>
137 <tr>
110 <td><a href="#PythonAstViewer.__rangeContainsSmallerOrEqual">__rangeContainsSmallerOrEqual</a></td> 138 <td><a href="#PythonAstViewer.__rangeContainsSmallerOrEqual">__rangeContainsSmallerOrEqual</a></td>
111 <td>Private method to check, if second is contained in or equal to first.</td> 139 <td>Private method to check, if second is contained in or equal to first.</td>
112 </tr><tr> 140 </tr>
141 <tr>
113 <td><a href="#PythonAstViewer.__resizeColumns">__resizeColumns</a></td> 142 <td><a href="#PythonAstViewer.__resizeColumns">__resizeColumns</a></td>
114 <td>Private method to resize the columns to suitable values.</td> 143 <td>Private method to resize the columns to suitable values.</td>
115 </tr><tr> 144 </tr>
145 <tr>
116 <td><a href="#PythonAstViewer.__selectItemForEditorSelection">__selectItemForEditorSelection</a></td> 146 <td><a href="#PythonAstViewer.__selectItemForEditorSelection">__selectItemForEditorSelection</a></td>
117 <td>Private slot to select the item corresponding to an editor selection.</td> 147 <td>Private slot to select the item corresponding to an editor selection.</td>
118 </tr><tr> 148 </tr>
149 <tr>
119 <td><a href="#PythonAstViewer.hide">hide</a></td> 150 <td><a href="#PythonAstViewer.hide">hide</a></td>
120 <td>Public slot to hide the AST viewer.</td> 151 <td>Public slot to hide the AST viewer.</td>
121 </tr><tr> 152 </tr>
153 <tr>
122 <td><a href="#PythonAstViewer.resizeEvent">resizeEvent</a></td> 154 <td><a href="#PythonAstViewer.resizeEvent">resizeEvent</a></td>
123 <td>Protected method to handle resize events.</td> 155 <td>Protected method to handle resize events.</td>
124 </tr><tr> 156 </tr>
157 <tr>
125 <td><a href="#PythonAstViewer.show">show</a></td> 158 <td><a href="#PythonAstViewer.show">show</a></td>
126 <td>Public slot to show the AST viewer.</td> 159 <td>Public slot to show the AST viewer.</td>
127 </tr><tr> 160 </tr>
161 <tr>
128 <td><a href="#PythonAstViewer.shutdown">shutdown</a></td> 162 <td><a href="#PythonAstViewer.shutdown">shutdown</a></td>
129 <td>Public method to perform shutdown actions.</td> 163 <td>Public method to perform shutdown actions.</td>
130 </tr> 164 </tr>
131 </table> 165 </table>
132 <h3>Static Methods</h3> 166 <h3>Static Methods</h3>
167
133 <table> 168 <table>
134 <tr><td>None</td></tr> 169 <tr><td>None</td></tr>
135 </table> 170 </table>
171
136 <a NAME="PythonAstViewer.__init__" ID="PythonAstViewer.__init__"></a> 172 <a NAME="PythonAstViewer.__init__" ID="PythonAstViewer.__init__"></a>
137 <h4>PythonAstViewer (Constructor)</h4> 173 <h4>PythonAstViewer (Constructor)</h4>
138 <b>PythonAstViewer</b>(<i>viewmanager, parent=None</i>) 174 <b>PythonAstViewer</b>(<i>viewmanager, parent=None</i>)
175
139 <p> 176 <p>
140 Constructor 177 Constructor
141 </p><dl> 178 </p>
179 <dl>
180
142 <dt><i>viewmanager</i> (ViewManager)</dt> 181 <dt><i>viewmanager</i> (ViewManager)</dt>
143 <dd> 182 <dd>
144 reference to the viewmanager object 183 reference to the viewmanager object
145 </dd><dt><i>parent</i> (QWidget)</dt> 184 </dd>
185 <dt><i>parent</i> (QWidget)</dt>
146 <dd> 186 <dd>
147 reference to the parent widget 187 reference to the parent widget
148 </dd> 188 </dd>
149 </dl><a NAME="PythonAstViewer.__astItemClicked" ID="PythonAstViewer.__astItemClicked"></a> 189 </dl>
190 <a NAME="PythonAstViewer.__astItemClicked" ID="PythonAstViewer.__astItemClicked"></a>
150 <h4>PythonAstViewer.__astItemClicked</h4> 191 <h4>PythonAstViewer.__astItemClicked</h4>
151 <b>__astItemClicked</b>(<i>itm, column</i>) 192 <b>__astItemClicked</b>(<i>itm, column</i>)
193
152 <p> 194 <p>
153 Private slot handling a user click on an AST node item. 195 Private slot handling a user click on an AST node item.
154 </p><dl> 196 </p>
197 <dl>
198
155 <dt><i>itm</i> (QTreeWidgetItem)</dt> 199 <dt><i>itm</i> (QTreeWidgetItem)</dt>
156 <dd> 200 <dd>
157 reference to the clicked item 201 reference to the clicked item
158 </dd><dt><i>column</i> (int)</dt> 202 </dd>
203 <dt><i>column</i> (int)</dt>
159 <dd> 204 <dd>
160 column number of the click 205 column number of the click
161 </dd> 206 </dd>
162 </dl><a NAME="PythonAstViewer.__astViewerStateChanged" ID="PythonAstViewer.__astViewerStateChanged"></a> 207 </dl>
208 <a NAME="PythonAstViewer.__astViewerStateChanged" ID="PythonAstViewer.__astViewerStateChanged"></a>
163 <h4>PythonAstViewer.__astViewerStateChanged</h4> 209 <h4>PythonAstViewer.__astViewerStateChanged</h4>
164 <b>__astViewerStateChanged</b>(<i>on</i>) 210 <b>__astViewerStateChanged</b>(<i>on</i>)
211
165 <p> 212 <p>
166 Private slot to toggle the display of the AST viewer. 213 Private slot to toggle the display of the AST viewer.
167 </p><dl> 214 </p>
215 <dl>
216
168 <dt><i>on</i> (bool)</dt> 217 <dt><i>on</i> (bool)</dt>
169 <dd> 218 <dd>
170 flag indicating to show the AST 219 flag indicating to show the AST
171 </dd> 220 </dd>
172 </dl><a NAME="PythonAstViewer.__clearSelection" ID="PythonAstViewer.__clearSelection"></a> 221 </dl>
222 <a NAME="PythonAstViewer.__clearSelection" ID="PythonAstViewer.__clearSelection"></a>
173 <h4>PythonAstViewer.__clearSelection</h4> 223 <h4>PythonAstViewer.__clearSelection</h4>
174 <b>__clearSelection</b>(<i></i>) 224 <b>__clearSelection</b>(<i></i>)
225
175 <p> 226 <p>
176 Private method to clear all selected items. 227 Private method to clear all selected items.
177 </p><a NAME="PythonAstViewer.__createErrorItem" ID="PythonAstViewer.__createErrorItem"></a> 228 </p>
229 <a NAME="PythonAstViewer.__createErrorItem" ID="PythonAstViewer.__createErrorItem"></a>
178 <h4>PythonAstViewer.__createErrorItem</h4> 230 <h4>PythonAstViewer.__createErrorItem</h4>
179 <b>__createErrorItem</b>(<i>error</i>) 231 <b>__createErrorItem</b>(<i>error</i>)
232
180 <p> 233 <p>
181 Private method to create a top level error item. 234 Private method to create a top level error item.
182 </p><dl> 235 </p>
236 <dl>
237
183 <dt><i>error</i> (str)</dt> 238 <dt><i>error</i> (str)</dt>
184 <dd> 239 <dd>
185 error message 240 error message
186 </dd> 241 </dd>
187 </dl><dl> 242 </dl>
243 <dl>
188 <dt>Returns:</dt> 244 <dt>Returns:</dt>
189 <dd> 245 <dd>
190 generated item 246 generated item
191 </dd> 247 </dd>
192 </dl><dl> 248 </dl>
249 <dl>
193 <dt>Return Type:</dt> 250 <dt>Return Type:</dt>
194 <dd> 251 <dd>
195 QTreeWidgetItem 252 QTreeWidgetItem
196 </dd> 253 </dd>
197 </dl><a NAME="PythonAstViewer.__editorChanged" ID="PythonAstViewer.__editorChanged"></a> 254 </dl>
255 <a NAME="PythonAstViewer.__editorChanged" ID="PythonAstViewer.__editorChanged"></a>
198 <h4>PythonAstViewer.__editorChanged</h4> 256 <h4>PythonAstViewer.__editorChanged</h4>
199 <b>__editorChanged</b>(<i>editor</i>) 257 <b>__editorChanged</b>(<i>editor</i>)
258
200 <p> 259 <p>
201 Private slot to handle a change of the current editor. 260 Private slot to handle a change of the current editor.
202 </p><dl> 261 </p>
262 <dl>
263
203 <dt><i>editor</i> (Editor)</dt> 264 <dt><i>editor</i> (Editor)</dt>
204 <dd> 265 <dd>
205 reference to the current editor 266 reference to the current editor
206 </dd> 267 </dd>
207 </dl><a NAME="PythonAstViewer.__editorDoubleClicked" ID="PythonAstViewer.__editorDoubleClicked"></a> 268 </dl>
269 <a NAME="PythonAstViewer.__editorDoubleClicked" ID="PythonAstViewer.__editorDoubleClicked"></a>
208 <h4>PythonAstViewer.__editorDoubleClicked</h4> 270 <h4>PythonAstViewer.__editorDoubleClicked</h4>
209 <b>__editorDoubleClicked</b>(<i>editor, pos, buttons</i>) 271 <b>__editorDoubleClicked</b>(<i>editor, pos, buttons</i>)
272
210 <p> 273 <p>
211 Private slot to handle a mouse button double click in the editor. 274 Private slot to handle a mouse button double click in the editor.
212 </p><dl> 275 </p>
276 <dl>
277
213 <dt><i>editor</i> (Editor)</dt> 278 <dt><i>editor</i> (Editor)</dt>
214 <dd> 279 <dd>
215 reference to the editor, that emitted the signal 280 reference to the editor, that emitted the signal
216 </dd><dt><i>pos</i> (QPoint)</dt> 281 </dd>
282 <dt><i>pos</i> (QPoint)</dt>
217 <dd> 283 <dd>
218 position of the double click 284 position of the double click
219 </dd><dt><i>buttons</i> (Qt.MouseButtons)</dt> 285 </dd>
286 <dt><i>buttons</i> (Qt.MouseButtons)</dt>
220 <dd> 287 <dd>
221 mouse buttons that were double clicked 288 mouse buttons that were double clicked
222 </dd> 289 </dd>
223 </dl><a NAME="PythonAstViewer.__editorSaved" ID="PythonAstViewer.__editorSaved"></a> 290 </dl>
291 <a NAME="PythonAstViewer.__editorSaved" ID="PythonAstViewer.__editorSaved"></a>
224 <h4>PythonAstViewer.__editorSaved</h4> 292 <h4>PythonAstViewer.__editorSaved</h4>
225 <b>__editorSaved</b>(<i>editor</i>) 293 <b>__editorSaved</b>(<i>editor</i>)
294
226 <p> 295 <p>
227 Private slot to reload the AST after the connected editor was saved. 296 Private slot to reload the AST after the connected editor was saved.
228 </p><dl> 297 </p>
298 <dl>
299
229 <dt><i>editor</i> (Editor)</dt> 300 <dt><i>editor</i> (Editor)</dt>
230 <dd> 301 <dd>
231 reference to the editor that performed a save action 302 reference to the editor that performed a save action
232 </dd> 303 </dd>
233 </dl><a NAME="PythonAstViewer.__findClosestContainingItem" ID="PythonAstViewer.__findClosestContainingItem"></a> 304 </dl>
305 <a NAME="PythonAstViewer.__findClosestContainingItem" ID="PythonAstViewer.__findClosestContainingItem"></a>
234 <h4>PythonAstViewer.__findClosestContainingItem</h4> 306 <h4>PythonAstViewer.__findClosestContainingItem</h4>
235 <b>__findClosestContainingItem</b>(<i>itm, textRange</i>) 307 <b>__findClosestContainingItem</b>(<i>itm, textRange</i>)
308
236 <p> 309 <p>
237 Private method to search for the tree item that contains a range 310 Private method to search for the tree item that contains a range
238 closest. 311 closest.
239 </p><dl> 312 </p>
313 <dl>
314
240 <dt><i>itm</i> (QTreeWidgetItem)</dt> 315 <dt><i>itm</i> (QTreeWidgetItem)</dt>
241 <dd> 316 <dd>
242 tree item to start searching at 317 tree item to start searching at
243 </dd><dt><i>textRange</i> (tuple of (int, int, int, int))</dt> 318 </dd>
319 <dt><i>textRange</i> (tuple of (int, int, int, int))</dt>
244 <dd> 320 <dd>
245 tuple giving the start and end positions 321 tuple giving the start and end positions
246 </dd> 322 </dd>
247 </dl><dl> 323 </dl>
324 <dl>
248 <dt>Returns:</dt> 325 <dt>Returns:</dt>
249 <dd> 326 <dd>
250 best matching tree item 327 best matching tree item
251 </dd> 328 </dd>
252 </dl><dl> 329 </dl>
330 <dl>
253 <dt>Return Type:</dt> 331 <dt>Return Type:</dt>
254 <dd> 332 <dd>
255 QTreeWidgetItem 333 QTreeWidgetItem
256 </dd> 334 </dd>
257 </dl><a NAME="PythonAstViewer.__findClosestContainingNode" ID="PythonAstViewer.__findClosestContainingNode"></a> 335 </dl>
336 <a NAME="PythonAstViewer.__findClosestContainingNode" ID="PythonAstViewer.__findClosestContainingNode"></a>
258 <h4>PythonAstViewer.__findClosestContainingNode</h4> 337 <h4>PythonAstViewer.__findClosestContainingNode</h4>
259 <b>__findClosestContainingNode</b>(<i>node, textRange</i>) 338 <b>__findClosestContainingNode</b>(<i>node, textRange</i>)
339
260 <p> 340 <p>
261 Private method to search for the AST node that contains a range 341 Private method to search for the AST node that contains a range
262 closest. 342 closest.
263 </p><dl> 343 </p>
344 <dl>
345
264 <dt><i>node</i> (ast.AST)</dt> 346 <dt><i>node</i> (ast.AST)</dt>
265 <dd> 347 <dd>
266 AST node to start searching at 348 AST node to start searching at
267 </dd><dt><i>textRange</i> (tuple of (int, int, int, int))</dt> 349 </dd>
350 <dt><i>textRange</i> (tuple of (int, int, int, int))</dt>
268 <dd> 351 <dd>
269 tuple giving the start and end positions 352 tuple giving the start and end positions
270 </dd> 353 </dd>
271 </dl><dl> 354 </dl>
355 <dl>
272 <dt>Returns:</dt> 356 <dt>Returns:</dt>
273 <dd> 357 <dd>
274 best matching node 358 best matching node
275 </dd> 359 </dd>
276 </dl><dl> 360 </dl>
361 <dl>
277 <dt>Return Type:</dt> 362 <dt>Return Type:</dt>
278 <dd> 363 <dd>
279 ast.AST 364 ast.AST
280 </dd> 365 </dd>
281 </dl><a NAME="PythonAstViewer.__grabFocus" ID="PythonAstViewer.__grabFocus"></a> 366 </dl>
367 <a NAME="PythonAstViewer.__grabFocus" ID="PythonAstViewer.__grabFocus"></a>
282 <h4>PythonAstViewer.__grabFocus</h4> 368 <h4>PythonAstViewer.__grabFocus</h4>
283 <b>__grabFocus</b>(<i></i>) 369 <b>__grabFocus</b>(<i></i>)
370
284 <p> 371 <p>
285 Private method to grab the input focus. 372 Private method to grab the input focus.
286 </p><a NAME="PythonAstViewer.__lastEditorClosed" ID="PythonAstViewer.__lastEditorClosed"></a> 373 </p>
374 <a NAME="PythonAstViewer.__lastEditorClosed" ID="PythonAstViewer.__lastEditorClosed"></a>
287 <h4>PythonAstViewer.__lastEditorClosed</h4> 375 <h4>PythonAstViewer.__lastEditorClosed</h4>
288 <b>__lastEditorClosed</b>(<i></i>) 376 <b>__lastEditorClosed</b>(<i></i>)
377
289 <p> 378 <p>
290 Private slot to handle the last editor closed signal of the view 379 Private slot to handle the last editor closed signal of the view
291 manager. 380 manager.
292 </p><a NAME="PythonAstViewer.__loadAST" ID="PythonAstViewer.__loadAST"></a> 381 </p>
382 <a NAME="PythonAstViewer.__loadAST" ID="PythonAstViewer.__loadAST"></a>
293 <h4>PythonAstViewer.__loadAST</h4> 383 <h4>PythonAstViewer.__loadAST</h4>
294 <b>__loadAST</b>(<i></i>) 384 <b>__loadAST</b>(<i></i>)
385
295 <p> 386 <p>
296 Private method to generate the AST from the source of the current 387 Private method to generate the AST from the source of the current
297 editor and visualize it. 388 editor and visualize it.
298 </p><a NAME="PythonAstViewer.__markTextRanges" ID="PythonAstViewer.__markTextRanges"></a> 389 </p>
390 <a NAME="PythonAstViewer.__markTextRanges" ID="PythonAstViewer.__markTextRanges"></a>
299 <h4>PythonAstViewer.__markTextRanges</h4> 391 <h4>PythonAstViewer.__markTextRanges</h4>
300 <b>__markTextRanges</b>(<i>tree, source</i>) 392 <b>__markTextRanges</b>(<i>tree, source</i>)
393
301 <p> 394 <p>
302 Private method to modify the AST nodes with end_lineno and 395 Private method to modify the AST nodes with end_lineno and
303 end_col_offset information. 396 end_col_offset information.
304 </p><p> 397 </p>
398 <p>
305 Note: The modifications are only done for nodes containing lineno and 399 Note: The modifications are only done for nodes containing lineno and
306 col_offset attributes. 400 col_offset attributes.
307 </p><dl> 401 </p>
402 <dl>
403
308 <dt><i>tree</i> (ast.AST)</dt> 404 <dt><i>tree</i> (ast.AST)</dt>
309 <dd> 405 <dd>
310 reference to the AST to be modified 406 reference to the AST to be modified
311 </dd><dt><i>source</i> (str)</dt> 407 </dd>
408 <dt><i>source</i> (str)</dt>
312 <dd> 409 <dd>
313 source code the AST was created from 410 source code the AST was created from
314 </dd> 411 </dd>
315 </dl><a NAME="PythonAstViewer.__populateNode" ID="PythonAstViewer.__populateNode"></a> 412 </dl>
413 <a NAME="PythonAstViewer.__populateNode" ID="PythonAstViewer.__populateNode"></a>
316 <h4>PythonAstViewer.__populateNode</h4> 414 <h4>PythonAstViewer.__populateNode</h4>
317 <b>__populateNode</b>(<i>name, nodeOrFields, parent</i>) 415 <b>__populateNode</b>(<i>name, nodeOrFields, parent</i>)
416
318 <p> 417 <p>
319 Private method to populate the tree view with a node. 418 Private method to populate the tree view with a node.
320 </p><dl> 419 </p>
420 <dl>
421
321 <dt><i>name</i> (str)</dt> 422 <dt><i>name</i> (str)</dt>
322 <dd> 423 <dd>
323 name of the node 424 name of the node
324 </dd><dt><i>nodeOrFields</i> (ast.AST or list)</dt> 425 </dd>
426 <dt><i>nodeOrFields</i> (ast.AST or list)</dt>
325 <dd> 427 <dd>
326 reference to the node or a list node fields 428 reference to the node or a list node fields
327 </dd><dt><i>parent</i> (QTreeWidget or QTreeWidgetItem)</dt> 429 </dd>
430 <dt><i>parent</i> (QTreeWidget or QTreeWidgetItem)</dt>
328 <dd> 431 <dd>
329 reference to the parent item 432 reference to the parent item
330 </dd> 433 </dd>
331 </dl><a NAME="PythonAstViewer.__rangeContainsSmaller" ID="PythonAstViewer.__rangeContainsSmaller"></a> 434 </dl>
435 <a NAME="PythonAstViewer.__rangeContainsSmaller" ID="PythonAstViewer.__rangeContainsSmaller"></a>
332 <h4>PythonAstViewer.__rangeContainsSmaller</h4> 436 <h4>PythonAstViewer.__rangeContainsSmaller</h4>
333 <b>__rangeContainsSmaller</b>(<i>first, second</i>) 437 <b>__rangeContainsSmaller</b>(<i>first, second</i>)
438
334 <p> 439 <p>
335 Private method to check, if second is contained in first. 440 Private method to check, if second is contained in first.
336 </p><dl> 441 </p>
442 <dl>
443
337 <dt><i>first</i> (tuple of (int, int, int, int))</dt> 444 <dt><i>first</i> (tuple of (int, int, int, int))</dt>
338 <dd> 445 <dd>
339 text range to check against 446 text range to check against
340 </dd><dt><i>second</i> (tuple of (int, int, int, int))</dt> 447 </dd>
448 <dt><i>second</i> (tuple of (int, int, int, int))</dt>
341 <dd> 449 <dd>
342 text range to check for 450 text range to check for
343 </dd> 451 </dd>
344 </dl><dl> 452 </dl>
453 <dl>
345 <dt>Returns:</dt> 454 <dt>Returns:</dt>
346 <dd> 455 <dd>
347 flag indicating second is contained in first 456 flag indicating second is contained in first
348 </dd> 457 </dd>
349 </dl><dl> 458 </dl>
459 <dl>
350 <dt>Return Type:</dt> 460 <dt>Return Type:</dt>
351 <dd> 461 <dd>
352 bool 462 bool
353 </dd> 463 </dd>
354 </dl><a NAME="PythonAstViewer.__rangeContainsSmallerOrEqual" ID="PythonAstViewer.__rangeContainsSmallerOrEqual"></a> 464 </dl>
465 <a NAME="PythonAstViewer.__rangeContainsSmallerOrEqual" ID="PythonAstViewer.__rangeContainsSmallerOrEqual"></a>
355 <h4>PythonAstViewer.__rangeContainsSmallerOrEqual</h4> 466 <h4>PythonAstViewer.__rangeContainsSmallerOrEqual</h4>
356 <b>__rangeContainsSmallerOrEqual</b>(<i>first, second</i>) 467 <b>__rangeContainsSmallerOrEqual</b>(<i>first, second</i>)
468
357 <p> 469 <p>
358 Private method to check, if second is contained in or equal to first. 470 Private method to check, if second is contained in or equal to first.
359 </p><dl> 471 </p>
472 <dl>
473
360 <dt><i>first</i> (tuple of (int, int, int, int))</dt> 474 <dt><i>first</i> (tuple of (int, int, int, int))</dt>
361 <dd> 475 <dd>
362 text range to check against 476 text range to check against
363 </dd><dt><i>second</i> (tuple of (int, int, int, int))</dt> 477 </dd>
478 <dt><i>second</i> (tuple of (int, int, int, int))</dt>
364 <dd> 479 <dd>
365 text range to check for 480 text range to check for
366 </dd> 481 </dd>
367 </dl><dl> 482 </dl>
483 <dl>
368 <dt>Returns:</dt> 484 <dt>Returns:</dt>
369 <dd> 485 <dd>
370 flag indicating second is contained in or equal to first 486 flag indicating second is contained in or equal to first
371 </dd> 487 </dd>
372 </dl><dl> 488 </dl>
489 <dl>
373 <dt>Return Type:</dt> 490 <dt>Return Type:</dt>
374 <dd> 491 <dd>
375 bool 492 bool
376 </dd> 493 </dd>
377 </dl><a NAME="PythonAstViewer.__resizeColumns" ID="PythonAstViewer.__resizeColumns"></a> 494 </dl>
495 <a NAME="PythonAstViewer.__resizeColumns" ID="PythonAstViewer.__resizeColumns"></a>
378 <h4>PythonAstViewer.__resizeColumns</h4> 496 <h4>PythonAstViewer.__resizeColumns</h4>
379 <b>__resizeColumns</b>(<i></i>) 497 <b>__resizeColumns</b>(<i></i>)
498
380 <p> 499 <p>
381 Private method to resize the columns to suitable values. 500 Private method to resize the columns to suitable values.
382 </p><a NAME="PythonAstViewer.__selectItemForEditorSelection" ID="PythonAstViewer.__selectItemForEditorSelection"></a> 501 </p>
502 <a NAME="PythonAstViewer.__selectItemForEditorSelection" ID="PythonAstViewer.__selectItemForEditorSelection"></a>
383 <h4>PythonAstViewer.__selectItemForEditorSelection</h4> 503 <h4>PythonAstViewer.__selectItemForEditorSelection</h4>
384 <b>__selectItemForEditorSelection</b>(<i></i>) 504 <b>__selectItemForEditorSelection</b>(<i></i>)
505
385 <p> 506 <p>
386 Private slot to select the item corresponding to an editor selection. 507 Private slot to select the item corresponding to an editor selection.
387 </p><a NAME="PythonAstViewer.hide" ID="PythonAstViewer.hide"></a> 508 </p>
509 <a NAME="PythonAstViewer.hide" ID="PythonAstViewer.hide"></a>
388 <h4>PythonAstViewer.hide</h4> 510 <h4>PythonAstViewer.hide</h4>
389 <b>hide</b>(<i></i>) 511 <b>hide</b>(<i></i>)
512
390 <p> 513 <p>
391 Public slot to hide the AST viewer. 514 Public slot to hide the AST viewer.
392 </p><a NAME="PythonAstViewer.resizeEvent" ID="PythonAstViewer.resizeEvent"></a> 515 </p>
516 <a NAME="PythonAstViewer.resizeEvent" ID="PythonAstViewer.resizeEvent"></a>
393 <h4>PythonAstViewer.resizeEvent</h4> 517 <h4>PythonAstViewer.resizeEvent</h4>
394 <b>resizeEvent</b>(<i>evt</i>) 518 <b>resizeEvent</b>(<i>evt</i>)
519
395 <p> 520 <p>
396 Protected method to handle resize events. 521 Protected method to handle resize events.
397 </p><dl> 522 </p>
523 <dl>
524
398 <dt><i>evt</i> (QResizeEvent)</dt> 525 <dt><i>evt</i> (QResizeEvent)</dt>
399 <dd> 526 <dd>
400 resize event 527 resize event
401 </dd> 528 </dd>
402 </dl><a NAME="PythonAstViewer.show" ID="PythonAstViewer.show"></a> 529 </dl>
530 <a NAME="PythonAstViewer.show" ID="PythonAstViewer.show"></a>
403 <h4>PythonAstViewer.show</h4> 531 <h4>PythonAstViewer.show</h4>
404 <b>show</b>(<i></i>) 532 <b>show</b>(<i></i>)
533
405 <p> 534 <p>
406 Public slot to show the AST viewer. 535 Public slot to show the AST viewer.
407 </p><a NAME="PythonAstViewer.shutdown" ID="PythonAstViewer.shutdown"></a> 536 </p>
537 <a NAME="PythonAstViewer.shutdown" ID="PythonAstViewer.shutdown"></a>
408 <h4>PythonAstViewer.shutdown</h4> 538 <h4>PythonAstViewer.shutdown</h4>
409 <b>shutdown</b>(<i></i>) 539 <b>shutdown</b>(<i></i>)
540
410 <p> 541 <p>
411 Public method to perform shutdown actions. 542 Public method to perform shutdown actions.
412 </p> 543 </p>
413 <div align="right"><a href="#top">Up</a></div> 544 <div align="right"><a href="#top">Up</a></div>
414 <hr /> 545 <hr />

eric ide

mercurial