eric6/Documentation/Source/eric6.QScintilla.DocstringGenerator.BaseDocstringGenerator.html

changeset 7998
cd41c844862f
child 8000
47b15df088e4
equal deleted inserted replaced
7997:2ca23396c25c 7998:cd41c844862f
1 <!DOCTYPE html>
2 <html><head>
3 <title>eric6.QScintilla.DocstringGenerator.BaseDocstringGenerator</title>
4 <meta charset="UTF-8">
5 <style>
6 body {
7 background: #EDECE6;
8 margin: 0em 1em 10em 1em;
9 color: black;
10 }
11
12 h1 { color: white; background: #85774A; }
13 h2 { color: white; background: #85774A; }
14 h3 { color: white; background: #9D936E; }
15 h4 { color: white; background: #9D936E; }
16
17 a { color: #BA6D36; }
18
19 </style>
20 </head>
21 <body>
22 <a NAME="top" ID="top"></a>
23 <h1>eric6.QScintilla.DocstringGenerator.BaseDocstringGenerator</h1>
24
25 <p>
26 Module implementing a docstring generator base class.
27 </p>
28 <h3>Global Attributes</h3>
29
30 <table>
31 <tr><td>None</td></tr>
32 </table>
33 <h3>Classes</h3>
34
35 <table>
36
37 <tr>
38 <td><a href="#BaseDocstringGenerator">BaseDocstringGenerator</a></td>
39 <td>Class implementing a docstring generator base class.</td>
40 </tr>
41 <tr>
42 <td><a href="#DocstringMenuForEnterOnly">DocstringMenuForEnterOnly</a></td>
43 <td>Class implementing a special menu reacting to the enter/return keys only.</td>
44 </tr>
45 <tr>
46 <td><a href="#FunctionInfo">FunctionInfo</a></td>
47 <td>Class implementing an object to store function information.</td>
48 </tr>
49 </table>
50 <h3>Functions</h3>
51
52 <table>
53
54 <tr>
55 <td><a href="#getIndentStr">getIndentStr</a></td>
56 <td>Function to get the indentation of a text.</td>
57 </tr>
58 </table>
59 <hr />
60 <hr />
61 <a NAME="BaseDocstringGenerator" ID="BaseDocstringGenerator"></a>
62 <h2>BaseDocstringGenerator</h2>
63
64 <p>
65 Class implementing a docstring generator base class.
66 </p>
67 <h3>Derived from</h3>
68 object
69 <h3>Class Attributes</h3>
70
71 <table>
72 <tr><td>None</td></tr>
73 </table>
74 <h3>Class Methods</h3>
75
76 <table>
77 <tr><td>None</td></tr>
78 </table>
79 <h3>Methods</h3>
80
81 <table>
82
83 <tr>
84 <td><a href="#BaseDocstringGenerator.__init__">BaseDocstringGenerator</a></td>
85 <td>Constructor</td>
86 </tr>
87 <tr>
88 <td><a href="#BaseDocstringGenerator._generateDocstringList">_generateDocstringList</a></td>
89 <td>Protected method to generate type specific docstrings based on the extracted function information.</td>
90 </tr>
91 <tr>
92 <td><a href="#BaseDocstringGenerator.getDocstringType">getDocstringType</a></td>
93 <td>Public method to determine the docstring type to be generated.</td>
94 </tr>
95 <tr>
96 <td><a href="#BaseDocstringGenerator.hasFunctionDefinition">hasFunctionDefinition</a></td>
97 <td>Public method to test, if the cursor is right below a function definition.</td>
98 </tr>
99 <tr>
100 <td><a href="#BaseDocstringGenerator.insertDocstring">insertDocstring</a></td>
101 <td>Public method to insert a docstring for the function at the cursor position.</td>
102 </tr>
103 <tr>
104 <td><a href="#BaseDocstringGenerator.isDocstringIntro">isDocstringIntro</a></td>
105 <td>Public function to test, if the line up to the cursor position might be introducing a docstring.</td>
106 </tr>
107 <tr>
108 <td><a href="#BaseDocstringGenerator.isFunctionStart">isFunctionStart</a></td>
109 <td>Public method to test, if a text is the start of a function or method definition.</td>
110 </tr>
111 </table>
112 <h3>Static Methods</h3>
113
114 <table>
115 <tr><td>None</td></tr>
116 </table>
117
118 <a NAME="BaseDocstringGenerator.__init__" ID="BaseDocstringGenerator.__init__"></a>
119 <h4>BaseDocstringGenerator (Constructor)</h4>
120 <b>BaseDocstringGenerator</b>(<i>editor</i>)
121
122 <p>
123 Constructor
124 </p>
125 <dl>
126
127 <dt><i>editor</i> (Editor)</dt>
128 <dd>
129 reference to the editor widget
130 </dd>
131 </dl>
132 <a NAME="BaseDocstringGenerator._generateDocstringList" ID="BaseDocstringGenerator._generateDocstringList"></a>
133 <h4>BaseDocstringGenerator._generateDocstringList</h4>
134 <b>_generateDocstringList</b>(<i>functionInfo, docstringType</i>)
135
136 <p>
137 Protected method to generate type specific docstrings based on the
138 extracted function information.
139 </p>
140 <dl>
141
142 <dt><i>functionInfo</i> (FunctionInfo)</dt>
143 <dd>
144 reference to the function info object
145 </dd>
146 <dt><i>docstringType</i></dt>
147 <dd>
148 kind of docstring to be generated
149 </dd>
150 </dl>
151 <dl>
152 <dt>Return:</dt>
153 <dd>
154 list of docstring lines
155 </dd>
156 </dl>
157 <dl>
158 <dt>Return Type:</dt>
159 <dd>
160 str
161 </dd>
162 </dl>
163 <a NAME="BaseDocstringGenerator.getDocstringType" ID="BaseDocstringGenerator.getDocstringType"></a>
164 <h4>BaseDocstringGenerator.getDocstringType</h4>
165 <b>getDocstringType</b>(<i></i>)
166
167 <p>
168 Public method to determine the docstring type to be generated.
169 </p>
170 <dl>
171 <dt>Return:</dt>
172 <dd>
173 docstring type (one of 'ericdoc', 'numpydoc', 'googledoc',
174 'sphinxdoc')
175 </dd>
176 </dl>
177 <dl>
178 <dt>Return Type:</dt>
179 <dd>
180 str
181 </dd>
182 </dl>
183 <a NAME="BaseDocstringGenerator.hasFunctionDefinition" ID="BaseDocstringGenerator.hasFunctionDefinition"></a>
184 <h4>BaseDocstringGenerator.hasFunctionDefinition</h4>
185 <b>hasFunctionDefinition</b>(<i>cursorPosition</i>)
186
187 <p>
188 Public method to test, if the cursor is right below a function
189 definition.
190 </p>
191 <dl>
192
193 <dt><i>cursorPosition</i> (tuple of (int, int))</dt>
194 <dd>
195 current cursor position (line and column)
196 </dd>
197 </dl>
198 <dl>
199 <dt>Return:</dt>
200 <dd>
201 flag indicating cursor is right below a function definition
202 </dd>
203 </dl>
204 <dl>
205 <dt>Return Type:</dt>
206 <dd>
207 bool
208 </dd>
209 </dl>
210 <a NAME="BaseDocstringGenerator.insertDocstring" ID="BaseDocstringGenerator.insertDocstring"></a>
211 <h4>BaseDocstringGenerator.insertDocstring</h4>
212 <b>insertDocstring</b>(<i>cursorPosition, fromStart=True</i>)
213
214 <p>
215 Public method to insert a docstring for the function at the cursor
216 position.
217 </p>
218 <dl>
219
220 <dt><i>cursorPosition</i> (tuple of (int, int))</dt>
221 <dd>
222 position of the cursor (line and index)
223 </dd>
224 <dt><i>fromStart</i> (bool)</dt>
225 <dd>
226 flag indicating that the editor text cursor is placed
227 on the line starting the function definition
228 </dd>
229 </dl>
230 <a NAME="BaseDocstringGenerator.isDocstringIntro" ID="BaseDocstringGenerator.isDocstringIntro"></a>
231 <h4>BaseDocstringGenerator.isDocstringIntro</h4>
232 <b>isDocstringIntro</b>(<i>cursorPosition</i>)
233
234 <p>
235 Public function to test, if the line up to the cursor position might be
236 introducing a docstring.
237 </p>
238 <dl>
239
240 <dt><i>cursorPosition</i> (tuple of (int, int))</dt>
241 <dd>
242 current cursor position (line and column)
243 </dd>
244 </dl>
245 <dl>
246 <dt>Return:</dt>
247 <dd>
248 flag indicating a potential start of a docstring
249 </dd>
250 </dl>
251 <dl>
252 <dt>Return Type:</dt>
253 <dd>
254 bool
255 </dd>
256 </dl>
257 <a NAME="BaseDocstringGenerator.isFunctionStart" ID="BaseDocstringGenerator.isFunctionStart"></a>
258 <h4>BaseDocstringGenerator.isFunctionStart</h4>
259 <b>isFunctionStart</b>(<i>text</i>)
260
261 <p>
262 Public method to test, if a text is the start of a function or method
263 definition.
264 </p>
265 <dl>
266
267 <dt><i>text</i> (str)</dt>
268 <dd>
269 line of text to be tested
270 </dd>
271 </dl>
272 <dl>
273 <dt>Return:</dt>
274 <dd>
275 flag indicating that the given text starts a function or
276 method definition (always False)
277 </dd>
278 </dl>
279 <dl>
280 <dt>Return Type:</dt>
281 <dd>
282 bool
283 </dd>
284 </dl>
285 <div align="right"><a href="#top">Up</a></div>
286 <hr />
287 <hr />
288 <a NAME="DocstringMenuForEnterOnly" ID="DocstringMenuForEnterOnly"></a>
289 <h2>DocstringMenuForEnterOnly</h2>
290
291 <p>
292 Class implementing a special menu reacting to the enter/return keys only.
293 </p>
294 <p>
295 If a keyboard input is not the "enter key", the menu is closed and the
296 input is inserted to the code editor.
297 </p>
298 <h3>Derived from</h3>
299 QMenu
300 <h3>Class Attributes</h3>
301
302 <table>
303 <tr><td>None</td></tr>
304 </table>
305 <h3>Class Methods</h3>
306
307 <table>
308 <tr><td>None</td></tr>
309 </table>
310 <h3>Methods</h3>
311
312 <table>
313
314 <tr>
315 <td><a href="#DocstringMenuForEnterOnly.__init__">DocstringMenuForEnterOnly</a></td>
316 <td>Constructor</td>
317 </tr>
318 <tr>
319 <td><a href="#DocstringMenuForEnterOnly.keyPressEvent">keyPressEvent</a></td>
320 <td>Protected method to handle key press events.</td>
321 </tr>
322 </table>
323 <h3>Static Methods</h3>
324
325 <table>
326 <tr><td>None</td></tr>
327 </table>
328
329 <a NAME="DocstringMenuForEnterOnly.__init__" ID="DocstringMenuForEnterOnly.__init__"></a>
330 <h4>DocstringMenuForEnterOnly (Constructor)</h4>
331 <b>DocstringMenuForEnterOnly</b>(<i>editor</i>)
332
333 <p>
334 Constructor
335 </p>
336 <dl>
337
338 <dt><i>editor</i> (Editor)</dt>
339 <dd>
340 reference to the editor
341 </dd>
342 </dl>
343 <a NAME="DocstringMenuForEnterOnly.keyPressEvent" ID="DocstringMenuForEnterOnly.keyPressEvent"></a>
344 <h4>DocstringMenuForEnterOnly.keyPressEvent</h4>
345 <b>keyPressEvent</b>(<i>evt</i>)
346
347 <p>
348 Protected method to handle key press events.
349 </p>
350 <dl>
351
352 <dt><i>evt</i> (QKeyEvent)</dt>
353 <dd>
354 reference to the key press event object
355 </dd>
356 </dl>
357 <div align="right"><a href="#top">Up</a></div>
358 <hr />
359 <hr />
360 <a NAME="FunctionInfo" ID="FunctionInfo"></a>
361 <h2>FunctionInfo</h2>
362
363 <p>
364 Class implementing an object to store function information.
365 </p>
366 <p>
367 Methods to extract the relevant information need to be implemented in
368 language specific subclasses.
369 </p>
370 <h3>Derived from</h3>
371 object
372 <h3>Class Attributes</h3>
373
374 <table>
375 <tr><td>None</td></tr>
376 </table>
377 <h3>Class Methods</h3>
378
379 <table>
380 <tr><td>None</td></tr>
381 </table>
382 <h3>Methods</h3>
383
384 <table>
385
386 <tr>
387 <td><a href="#FunctionInfo.__init__">FunctionInfo</a></td>
388 <td>Constructor</td>
389 </tr>
390 </table>
391 <h3>Static Methods</h3>
392
393 <table>
394 <tr><td>None</td></tr>
395 </table>
396
397 <a NAME="FunctionInfo.__init__" ID="FunctionInfo.__init__"></a>
398 <h4>FunctionInfo (Constructor)</h4>
399 <b>FunctionInfo</b>(<i></i>)
400
401 <p>
402 Constructor
403 </p>
404 <div align="right"><a href="#top">Up</a></div>
405 <hr />
406 <hr />
407 <a NAME="getIndentStr" ID="getIndentStr"></a>
408 <h2>getIndentStr</h2>
409 <b>getIndentStr</b>(<i>text</i>)
410
411 <p>
412 Function to get the indentation of a text.
413 </p>
414 <dl>
415
416 <dt><i>text</i> (str)</dt>
417 <dd>
418 text to extract indentation from
419 </dd>
420 </dl>
421 <dl>
422 <dt>Return:</dt>
423 <dd>
424 indentation string
425 </dd>
426 </dl>
427 <dl>
428 <dt>Return Type:</dt>
429 <dd>
430 str
431 </dd>
432 </dl>
433 <div align="right"><a href="#top">Up</a></div>
434 <hr />
435 </body></html>

eric ide

mercurial