|
1 <!DOCTYPE html> |
|
2 <html><head> |
|
3 <title>eric6.Templates.TemplateViewer</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><a NAME="top" ID="top"></a> |
|
22 <h1>eric6.Templates.TemplateViewer</h1> |
|
23 <p> |
|
24 Module implementing a template viewer and associated classes. |
|
25 </p> |
|
26 <h3>Global Attributes</h3> |
|
27 <table> |
|
28 <tr><td>None</td></tr> |
|
29 </table> |
|
30 <h3>Classes</h3> |
|
31 <table> |
|
32 <tr> |
|
33 <td><a href="#TemplateEntry">TemplateEntry</a></td> |
|
34 <td>Class immplementing a template entry.</td> |
|
35 </tr><tr> |
|
36 <td><a href="#TemplateGroup">TemplateGroup</a></td> |
|
37 <td>Class implementing a template group.</td> |
|
38 </tr><tr> |
|
39 <td><a href="#TemplateViewer">TemplateViewer</a></td> |
|
40 <td>Class implementing the template viewer.</td> |
|
41 </tr> |
|
42 </table> |
|
43 <h3>Functions</h3> |
|
44 <table> |
|
45 <tr><td>None</td></tr> |
|
46 </table> |
|
47 <hr /><hr /> |
|
48 <a NAME="TemplateEntry" ID="TemplateEntry"></a> |
|
49 <h2>TemplateEntry</h2> |
|
50 <p> |
|
51 Class immplementing a template entry. |
|
52 </p> |
|
53 <h3>Derived from</h3> |
|
54 QTreeWidgetItem |
|
55 <h3>Class Attributes</h3> |
|
56 <table> |
|
57 <tr><td>None</td></tr> |
|
58 </table> |
|
59 <h3>Class Methods</h3> |
|
60 <table> |
|
61 <tr><td>None</td></tr> |
|
62 </table> |
|
63 <h3>Methods</h3> |
|
64 <table> |
|
65 <tr> |
|
66 <td><a href="#TemplateEntry.__init__">TemplateEntry</a></td> |
|
67 <td>Constructor</td> |
|
68 </tr><tr> |
|
69 <td><a href="#TemplateEntry.__displayText">__displayText</a></td> |
|
70 <td>Private method to generate the display text.</td> |
|
71 </tr><tr> |
|
72 <td><a href="#TemplateEntry.__expandFormattedVariable">__expandFormattedVariable</a></td> |
|
73 <td>Private method to expand a template variable with special formatting.</td> |
|
74 </tr><tr> |
|
75 <td><a href="#TemplateEntry.__extractVariables">__extractVariables</a></td> |
|
76 <td>Private method to retrieve the list of variables.</td> |
|
77 </tr><tr> |
|
78 <td><a href="#TemplateEntry.getDescription">getDescription</a></td> |
|
79 <td>Public method to get the description of the entry.</td> |
|
80 </tr><tr> |
|
81 <td><a href="#TemplateEntry.getExpandedText">getExpandedText</a></td> |
|
82 <td>Public method to get the template text with all variables expanded.</td> |
|
83 </tr><tr> |
|
84 <td><a href="#TemplateEntry.getGroupName">getGroupName</a></td> |
|
85 <td>Public method to get the name of the group this entry belongs to.</td> |
|
86 </tr><tr> |
|
87 <td><a href="#TemplateEntry.getName">getName</a></td> |
|
88 <td>Public method to get the name of the entry.</td> |
|
89 </tr><tr> |
|
90 <td><a href="#TemplateEntry.getTemplateText">getTemplateText</a></td> |
|
91 <td>Public method to get the template text.</td> |
|
92 </tr><tr> |
|
93 <td><a href="#TemplateEntry.getVariables">getVariables</a></td> |
|
94 <td>Public method to get the list of variables.</td> |
|
95 </tr><tr> |
|
96 <td><a href="#TemplateEntry.setDescription">setDescription</a></td> |
|
97 <td>Public method to update the description of the entry.</td> |
|
98 </tr><tr> |
|
99 <td><a href="#TemplateEntry.setName">setName</a></td> |
|
100 <td>Public method to update the name of the entry.</td> |
|
101 </tr><tr> |
|
102 <td><a href="#TemplateEntry.setTemplateText">setTemplateText</a></td> |
|
103 <td>Public method to update the template text.</td> |
|
104 </tr> |
|
105 </table> |
|
106 <h3>Static Methods</h3> |
|
107 <table> |
|
108 <tr><td>None</td></tr> |
|
109 </table> |
|
110 <a NAME="TemplateEntry.__init__" ID="TemplateEntry.__init__"></a> |
|
111 <h4>TemplateEntry (Constructor)</h4> |
|
112 <b>TemplateEntry</b>(<i>parent, name, description, templateText</i>) |
|
113 <p> |
|
114 Constructor |
|
115 </p><dl> |
|
116 <dt><i>parent</i></dt> |
|
117 <dd> |
|
118 parent widget of the template entry (QWidget) |
|
119 </dd><dt><i>name</i></dt> |
|
120 <dd> |
|
121 name of the entry (string) |
|
122 </dd><dt><i>description</i></dt> |
|
123 <dd> |
|
124 descriptive text for the template (string) |
|
125 </dd><dt><i>templateText</i></dt> |
|
126 <dd> |
|
127 text of the template entry (string) |
|
128 </dd> |
|
129 </dl><a NAME="TemplateEntry.__displayText" ID="TemplateEntry.__displayText"></a> |
|
130 <h4>TemplateEntry.__displayText</h4> |
|
131 <b>__displayText</b>(<i></i>) |
|
132 <p> |
|
133 Private method to generate the display text. |
|
134 </p><dl> |
|
135 <dt>Returns:</dt> |
|
136 <dd> |
|
137 display text (string) |
|
138 </dd> |
|
139 </dl><a NAME="TemplateEntry.__expandFormattedVariable" ID="TemplateEntry.__expandFormattedVariable"></a> |
|
140 <h4>TemplateEntry.__expandFormattedVariable</h4> |
|
141 <b>__expandFormattedVariable</b>(<i>var, val, txt</i>) |
|
142 <p> |
|
143 Private method to expand a template variable with special formatting. |
|
144 </p><dl> |
|
145 <dt><i>var</i></dt> |
|
146 <dd> |
|
147 template variable name (string) |
|
148 </dd><dt><i>val</i></dt> |
|
149 <dd> |
|
150 value of the template variable (string) |
|
151 </dd><dt><i>txt</i></dt> |
|
152 <dd> |
|
153 template text (string) |
|
154 </dd> |
|
155 </dl><dl> |
|
156 <dt>Returns:</dt> |
|
157 <dd> |
|
158 expanded and formatted variable (string) |
|
159 </dd> |
|
160 </dl><a NAME="TemplateEntry.__extractVariables" ID="TemplateEntry.__extractVariables"></a> |
|
161 <h4>TemplateEntry.__extractVariables</h4> |
|
162 <b>__extractVariables</b>(<i></i>) |
|
163 <p> |
|
164 Private method to retrieve the list of variables. |
|
165 </p><a NAME="TemplateEntry.getDescription" ID="TemplateEntry.getDescription"></a> |
|
166 <h4>TemplateEntry.getDescription</h4> |
|
167 <b>getDescription</b>(<i></i>) |
|
168 <p> |
|
169 Public method to get the description of the entry. |
|
170 </p><dl> |
|
171 <dt>Returns:</dt> |
|
172 <dd> |
|
173 description of the entry (string) |
|
174 </dd> |
|
175 </dl><a NAME="TemplateEntry.getExpandedText" ID="TemplateEntry.getExpandedText"></a> |
|
176 <h4>TemplateEntry.getExpandedText</h4> |
|
177 <b>getExpandedText</b>(<i>varDict, indent</i>) |
|
178 <p> |
|
179 Public method to get the template text with all variables expanded. |
|
180 </p><dl> |
|
181 <dt><i>varDict</i></dt> |
|
182 <dd> |
|
183 dictionary containing the texts of each variable |
|
184 with the variable name as key. |
|
185 </dd><dt><i>indent</i></dt> |
|
186 <dd> |
|
187 indentation of the line receiving he expanded |
|
188 template text (string) |
|
189 </dd> |
|
190 </dl><dl> |
|
191 <dt>Returns:</dt> |
|
192 <dd> |
|
193 a tuple of the expanded template text (string), the |
|
194 number of lines (integer) and the length of the last line (integer) |
|
195 </dd> |
|
196 </dl><a NAME="TemplateEntry.getGroupName" ID="TemplateEntry.getGroupName"></a> |
|
197 <h4>TemplateEntry.getGroupName</h4> |
|
198 <b>getGroupName</b>(<i></i>) |
|
199 <p> |
|
200 Public method to get the name of the group this entry belongs to. |
|
201 </p><dl> |
|
202 <dt>Returns:</dt> |
|
203 <dd> |
|
204 name of the group containing this entry (string) |
|
205 </dd> |
|
206 </dl><a NAME="TemplateEntry.getName" ID="TemplateEntry.getName"></a> |
|
207 <h4>TemplateEntry.getName</h4> |
|
208 <b>getName</b>(<i></i>) |
|
209 <p> |
|
210 Public method to get the name of the entry. |
|
211 </p><dl> |
|
212 <dt>Returns:</dt> |
|
213 <dd> |
|
214 name of the entry (string) |
|
215 </dd> |
|
216 </dl><a NAME="TemplateEntry.getTemplateText" ID="TemplateEntry.getTemplateText"></a> |
|
217 <h4>TemplateEntry.getTemplateText</h4> |
|
218 <b>getTemplateText</b>(<i></i>) |
|
219 <p> |
|
220 Public method to get the template text. |
|
221 </p><dl> |
|
222 <dt>Returns:</dt> |
|
223 <dd> |
|
224 the template text (string) |
|
225 </dd> |
|
226 </dl><a NAME="TemplateEntry.getVariables" ID="TemplateEntry.getVariables"></a> |
|
227 <h4>TemplateEntry.getVariables</h4> |
|
228 <b>getVariables</b>(<i></i>) |
|
229 <p> |
|
230 Public method to get the list of variables. |
|
231 </p><dl> |
|
232 <dt>Returns:</dt> |
|
233 <dd> |
|
234 list of variables (list of strings) |
|
235 </dd> |
|
236 </dl><a NAME="TemplateEntry.setDescription" ID="TemplateEntry.setDescription"></a> |
|
237 <h4>TemplateEntry.setDescription</h4> |
|
238 <b>setDescription</b>(<i>description</i>) |
|
239 <p> |
|
240 Public method to update the description of the entry. |
|
241 </p><dl> |
|
242 <dt><i>description</i></dt> |
|
243 <dd> |
|
244 description of the entry (string) |
|
245 </dd> |
|
246 </dl><a NAME="TemplateEntry.setName" ID="TemplateEntry.setName"></a> |
|
247 <h4>TemplateEntry.setName</h4> |
|
248 <b>setName</b>(<i>name</i>) |
|
249 <p> |
|
250 Public method to update the name of the entry. |
|
251 </p><dl> |
|
252 <dt><i>name</i></dt> |
|
253 <dd> |
|
254 name of the entry (string) |
|
255 </dd> |
|
256 </dl><a NAME="TemplateEntry.setTemplateText" ID="TemplateEntry.setTemplateText"></a> |
|
257 <h4>TemplateEntry.setTemplateText</h4> |
|
258 <b>setTemplateText</b>(<i>templateText</i>) |
|
259 <p> |
|
260 Public method to update the template text. |
|
261 </p><dl> |
|
262 <dt><i>templateText</i></dt> |
|
263 <dd> |
|
264 text of the template entry (string) |
|
265 </dd> |
|
266 </dl> |
|
267 <div align="right"><a href="#top">Up</a></div> |
|
268 <hr /><hr /> |
|
269 <a NAME="TemplateGroup" ID="TemplateGroup"></a> |
|
270 <h2>TemplateGroup</h2> |
|
271 <p> |
|
272 Class implementing a template group. |
|
273 </p> |
|
274 <h3>Derived from</h3> |
|
275 QTreeWidgetItem |
|
276 <h3>Class Attributes</h3> |
|
277 <table> |
|
278 <tr><td>None</td></tr> |
|
279 </table> |
|
280 <h3>Class Methods</h3> |
|
281 <table> |
|
282 <tr><td>None</td></tr> |
|
283 </table> |
|
284 <h3>Methods</h3> |
|
285 <table> |
|
286 <tr> |
|
287 <td><a href="#TemplateGroup.__init__">TemplateGroup</a></td> |
|
288 <td>Constructor</td> |
|
289 </tr><tr> |
|
290 <td><a href="#TemplateGroup.addEntry">addEntry</a></td> |
|
291 <td>Public method to add a template entry to this group.</td> |
|
292 </tr><tr> |
|
293 <td><a href="#TemplateGroup.getAllEntries">getAllEntries</a></td> |
|
294 <td>Public method to retrieve all entries.</td> |
|
295 </tr><tr> |
|
296 <td><a href="#TemplateGroup.getEntry">getEntry</a></td> |
|
297 <td>Public method to get an entry.</td> |
|
298 </tr><tr> |
|
299 <td><a href="#TemplateGroup.getEntryNames">getEntryNames</a></td> |
|
300 <td>Public method to get the names of all entries, who's name starts with the given string.</td> |
|
301 </tr><tr> |
|
302 <td><a href="#TemplateGroup.getLanguage">getLanguage</a></td> |
|
303 <td>Public method to get the name of the group.</td> |
|
304 </tr><tr> |
|
305 <td><a href="#TemplateGroup.getName">getName</a></td> |
|
306 <td>Public method to get the name of the group.</td> |
|
307 </tr><tr> |
|
308 <td><a href="#TemplateGroup.hasEntry">hasEntry</a></td> |
|
309 <td>Public method to check, if the group has an entry with the given name.</td> |
|
310 </tr><tr> |
|
311 <td><a href="#TemplateGroup.removeAllEntries">removeAllEntries</a></td> |
|
312 <td>Public method to remove all template entries of this group.</td> |
|
313 </tr><tr> |
|
314 <td><a href="#TemplateGroup.removeEntry">removeEntry</a></td> |
|
315 <td>Public method to remove a template entry from this group.</td> |
|
316 </tr><tr> |
|
317 <td><a href="#TemplateGroup.setLanguage">setLanguage</a></td> |
|
318 <td>Public method to update the name of the group.</td> |
|
319 </tr><tr> |
|
320 <td><a href="#TemplateGroup.setName">setName</a></td> |
|
321 <td>Public method to update the name of the group.</td> |
|
322 </tr> |
|
323 </table> |
|
324 <h3>Static Methods</h3> |
|
325 <table> |
|
326 <tr><td>None</td></tr> |
|
327 </table> |
|
328 <a NAME="TemplateGroup.__init__" ID="TemplateGroup.__init__"></a> |
|
329 <h4>TemplateGroup (Constructor)</h4> |
|
330 <b>TemplateGroup</b>(<i>parent, name, language="All"</i>) |
|
331 <p> |
|
332 Constructor |
|
333 </p><dl> |
|
334 <dt><i>parent</i></dt> |
|
335 <dd> |
|
336 parent widget of the template group (QWidget) |
|
337 </dd><dt><i>name</i></dt> |
|
338 <dd> |
|
339 name of the group (string) |
|
340 </dd><dt><i>language</i></dt> |
|
341 <dd> |
|
342 programming language for the group (string) |
|
343 </dd> |
|
344 </dl><a NAME="TemplateGroup.addEntry" ID="TemplateGroup.addEntry"></a> |
|
345 <h4>TemplateGroup.addEntry</h4> |
|
346 <b>addEntry</b>(<i>name, description, template, quiet=False</i>) |
|
347 <p> |
|
348 Public method to add a template entry to this group. |
|
349 </p><dl> |
|
350 <dt><i>name</i></dt> |
|
351 <dd> |
|
352 name of the entry (string) |
|
353 </dd><dt><i>description</i></dt> |
|
354 <dd> |
|
355 description of the entry to add (string) |
|
356 </dd><dt><i>template</i></dt> |
|
357 <dd> |
|
358 template text of the entry (string) |
|
359 </dd><dt><i>quiet</i></dt> |
|
360 <dd> |
|
361 flag indicating quiet operation (boolean) |
|
362 </dd> |
|
363 </dl><a NAME="TemplateGroup.getAllEntries" ID="TemplateGroup.getAllEntries"></a> |
|
364 <h4>TemplateGroup.getAllEntries</h4> |
|
365 <b>getAllEntries</b>(<i></i>) |
|
366 <p> |
|
367 Public method to retrieve all entries. |
|
368 </p><dl> |
|
369 <dt>Returns:</dt> |
|
370 <dd> |
|
371 list of all entries (list of TemplateEntry) |
|
372 </dd> |
|
373 </dl><a NAME="TemplateGroup.getEntry" ID="TemplateGroup.getEntry"></a> |
|
374 <h4>TemplateGroup.getEntry</h4> |
|
375 <b>getEntry</b>(<i>name</i>) |
|
376 <p> |
|
377 Public method to get an entry. |
|
378 </p><dl> |
|
379 <dt><i>name</i></dt> |
|
380 <dd> |
|
381 name of the entry to retrieve (string) |
|
382 </dd> |
|
383 </dl><dl> |
|
384 <dt>Returns:</dt> |
|
385 <dd> |
|
386 reference to the entry (TemplateEntry) |
|
387 </dd> |
|
388 </dl><a NAME="TemplateGroup.getEntryNames" ID="TemplateGroup.getEntryNames"></a> |
|
389 <h4>TemplateGroup.getEntryNames</h4> |
|
390 <b>getEntryNames</b>(<i>beginning</i>) |
|
391 <p> |
|
392 Public method to get the names of all entries, who's name starts with |
|
393 the given string. |
|
394 </p><dl> |
|
395 <dt><i>beginning</i></dt> |
|
396 <dd> |
|
397 string denoting the beginning of the template name |
|
398 (string) |
|
399 </dd> |
|
400 </dl><dl> |
|
401 <dt>Returns:</dt> |
|
402 <dd> |
|
403 list of entry names found (list of strings) |
|
404 </dd> |
|
405 </dl><a NAME="TemplateGroup.getLanguage" ID="TemplateGroup.getLanguage"></a> |
|
406 <h4>TemplateGroup.getLanguage</h4> |
|
407 <b>getLanguage</b>(<i></i>) |
|
408 <p> |
|
409 Public method to get the name of the group. |
|
410 </p><dl> |
|
411 <dt>Returns:</dt> |
|
412 <dd> |
|
413 language of the group (string) |
|
414 </dd> |
|
415 </dl><a NAME="TemplateGroup.getName" ID="TemplateGroup.getName"></a> |
|
416 <h4>TemplateGroup.getName</h4> |
|
417 <b>getName</b>(<i></i>) |
|
418 <p> |
|
419 Public method to get the name of the group. |
|
420 </p><dl> |
|
421 <dt>Returns:</dt> |
|
422 <dd> |
|
423 name of the group (string) |
|
424 </dd> |
|
425 </dl><a NAME="TemplateGroup.hasEntry" ID="TemplateGroup.hasEntry"></a> |
|
426 <h4>TemplateGroup.hasEntry</h4> |
|
427 <b>hasEntry</b>(<i>name</i>) |
|
428 <p> |
|
429 Public method to check, if the group has an entry with the given name. |
|
430 </p><dl> |
|
431 <dt><i>name</i></dt> |
|
432 <dd> |
|
433 name of the entry to check for (string) |
|
434 </dd> |
|
435 </dl><dl> |
|
436 <dt>Returns:</dt> |
|
437 <dd> |
|
438 flag indicating existence (boolean) |
|
439 </dd> |
|
440 </dl><a NAME="TemplateGroup.removeAllEntries" ID="TemplateGroup.removeAllEntries"></a> |
|
441 <h4>TemplateGroup.removeAllEntries</h4> |
|
442 <b>removeAllEntries</b>(<i></i>) |
|
443 <p> |
|
444 Public method to remove all template entries of this group. |
|
445 </p><a NAME="TemplateGroup.removeEntry" ID="TemplateGroup.removeEntry"></a> |
|
446 <h4>TemplateGroup.removeEntry</h4> |
|
447 <b>removeEntry</b>(<i>name</i>) |
|
448 <p> |
|
449 Public method to remove a template entry from this group. |
|
450 </p><dl> |
|
451 <dt><i>name</i></dt> |
|
452 <dd> |
|
453 name of the entry to be removed (string) |
|
454 </dd> |
|
455 </dl><a NAME="TemplateGroup.setLanguage" ID="TemplateGroup.setLanguage"></a> |
|
456 <h4>TemplateGroup.setLanguage</h4> |
|
457 <b>setLanguage</b>(<i>language</i>) |
|
458 <p> |
|
459 Public method to update the name of the group. |
|
460 </p><dl> |
|
461 <dt><i>language</i></dt> |
|
462 <dd> |
|
463 programming language for the group (string) |
|
464 </dd> |
|
465 </dl><a NAME="TemplateGroup.setName" ID="TemplateGroup.setName"></a> |
|
466 <h4>TemplateGroup.setName</h4> |
|
467 <b>setName</b>(<i>name</i>) |
|
468 <p> |
|
469 Public method to update the name of the group. |
|
470 </p><dl> |
|
471 <dt><i>name</i></dt> |
|
472 <dd> |
|
473 name of the group (string) |
|
474 </dd> |
|
475 </dl> |
|
476 <div align="right"><a href="#top">Up</a></div> |
|
477 <hr /><hr /> |
|
478 <a NAME="TemplateViewer" ID="TemplateViewer"></a> |
|
479 <h2>TemplateViewer</h2> |
|
480 <p> |
|
481 Class implementing the template viewer. |
|
482 </p> |
|
483 <h3>Derived from</h3> |
|
484 QTreeWidget |
|
485 <h3>Class Attributes</h3> |
|
486 <table> |
|
487 <tr><td>None</td></tr> |
|
488 </table> |
|
489 <h3>Class Methods</h3> |
|
490 <table> |
|
491 <tr><td>None</td></tr> |
|
492 </table> |
|
493 <h3>Methods</h3> |
|
494 <table> |
|
495 <tr> |
|
496 <td><a href="#TemplateViewer.__init__">TemplateViewer</a></td> |
|
497 <td>Constructor</td> |
|
498 </tr><tr> |
|
499 <td><a href="#TemplateViewer.__addEntry">__addEntry</a></td> |
|
500 <td>Private slot to handle the Add Entry context menu action.</td> |
|
501 </tr><tr> |
|
502 <td><a href="#TemplateViewer.__addGroup">__addGroup</a></td> |
|
503 <td>Private slot to handle the Add Group context menu action.</td> |
|
504 </tr><tr> |
|
505 <td><a href="#TemplateViewer.__configure">__configure</a></td> |
|
506 <td>Private method to open the configuration dialog.</td> |
|
507 </tr><tr> |
|
508 <td><a href="#TemplateViewer.__edit">__edit</a></td> |
|
509 <td>Private slot to handle the Edit context menu action.</td> |
|
510 </tr><tr> |
|
511 <td><a href="#TemplateViewer.__export">__export</a></td> |
|
512 <td>Private slot to handle the Export context menu action.</td> |
|
513 </tr><tr> |
|
514 <td><a href="#TemplateViewer.__getPredefinedVars">__getPredefinedVars</a></td> |
|
515 <td>Private method to return predefined variables.</td> |
|
516 </tr><tr> |
|
517 <td><a href="#TemplateViewer.__import">__import</a></td> |
|
518 <td>Private slot to handle the Import context menu action.</td> |
|
519 </tr><tr> |
|
520 <td><a href="#TemplateViewer.__reload">__reload</a></td> |
|
521 <td>Private slot to reload the templates.</td> |
|
522 </tr><tr> |
|
523 <td><a href="#TemplateViewer.__remove">__remove</a></td> |
|
524 <td>Private slot to handle the Remove context menu action.</td> |
|
525 </tr><tr> |
|
526 <td><a href="#TemplateViewer.__resort">__resort</a></td> |
|
527 <td>Private method to resort the tree.</td> |
|
528 </tr><tr> |
|
529 <td><a href="#TemplateViewer.__showContextMenu">__showContextMenu</a></td> |
|
530 <td>Private slot to show the context menu of the list.</td> |
|
531 </tr><tr> |
|
532 <td><a href="#TemplateViewer.__showHelp">__showHelp</a></td> |
|
533 <td>Private method to show some help.</td> |
|
534 </tr><tr> |
|
535 <td><a href="#TemplateViewer.__templateItemActivated">__templateItemActivated</a></td> |
|
536 <td>Private slot to handle the activation of an item.</td> |
|
537 </tr><tr> |
|
538 <td><a href="#TemplateViewer.addEntry">addEntry</a></td> |
|
539 <td>Public method to add a template entry.</td> |
|
540 </tr><tr> |
|
541 <td><a href="#TemplateViewer.addGroup">addGroup</a></td> |
|
542 <td>Public method to add a group.</td> |
|
543 </tr><tr> |
|
544 <td><a href="#TemplateViewer.applyNamedTemplate">applyNamedTemplate</a></td> |
|
545 <td>Public method to apply a template given a template name.</td> |
|
546 </tr><tr> |
|
547 <td><a href="#TemplateViewer.applyTemplate">applyTemplate</a></td> |
|
548 <td>Public method to apply the template.</td> |
|
549 </tr><tr> |
|
550 <td><a href="#TemplateViewer.changeEntry">changeEntry</a></td> |
|
551 <td>Public method to change a template entry.</td> |
|
552 </tr><tr> |
|
553 <td><a href="#TemplateViewer.changeGroup">changeGroup</a></td> |
|
554 <td>Public method to rename a group.</td> |
|
555 </tr><tr> |
|
556 <td><a href="#TemplateViewer.getAllGroups">getAllGroups</a></td> |
|
557 <td>Public method to get all groups.</td> |
|
558 </tr><tr> |
|
559 <td><a href="#TemplateViewer.getGroupNames">getGroupNames</a></td> |
|
560 <td>Public method to get all group names.</td> |
|
561 </tr><tr> |
|
562 <td><a href="#TemplateViewer.getTemplateNames">getTemplateNames</a></td> |
|
563 <td>Public method to get the names of templates starting with the given string.</td> |
|
564 </tr><tr> |
|
565 <td><a href="#TemplateViewer.hasGroup">hasGroup</a></td> |
|
566 <td>Public method to check, if a group with the given name exists.</td> |
|
567 </tr><tr> |
|
568 <td><a href="#TemplateViewer.hasTemplate">hasTemplate</a></td> |
|
569 <td>Public method to check, if an entry of the given name exists.</td> |
|
570 </tr><tr> |
|
571 <td><a href="#TemplateViewer.readTemplates">readTemplates</a></td> |
|
572 <td>Public method to read in the templates file (.e4c).</td> |
|
573 </tr><tr> |
|
574 <td><a href="#TemplateViewer.removeEntry">removeEntry</a></td> |
|
575 <td>Public method to remove a template entry.</td> |
|
576 </tr><tr> |
|
577 <td><a href="#TemplateViewer.removeGroup">removeGroup</a></td> |
|
578 <td>Public method to remove a group.</td> |
|
579 </tr><tr> |
|
580 <td><a href="#TemplateViewer.save">save</a></td> |
|
581 <td>Public slot to save the templates.</td> |
|
582 </tr><tr> |
|
583 <td><a href="#TemplateViewer.writeTemplates">writeTemplates</a></td> |
|
584 <td>Public method to write the templates data to an XML file (.e4c).</td> |
|
585 </tr> |
|
586 </table> |
|
587 <h3>Static Methods</h3> |
|
588 <table> |
|
589 <tr><td>None</td></tr> |
|
590 </table> |
|
591 <a NAME="TemplateViewer.__init__" ID="TemplateViewer.__init__"></a> |
|
592 <h4>TemplateViewer (Constructor)</h4> |
|
593 <b>TemplateViewer</b>(<i>parent, viewmanager</i>) |
|
594 <p> |
|
595 Constructor |
|
596 </p><dl> |
|
597 <dt><i>parent</i></dt> |
|
598 <dd> |
|
599 the parent (QWidget) |
|
600 </dd><dt><i>viewmanager</i></dt> |
|
601 <dd> |
|
602 reference to the viewmanager object |
|
603 </dd> |
|
604 </dl><a NAME="TemplateViewer.__addEntry" ID="TemplateViewer.__addEntry"></a> |
|
605 <h4>TemplateViewer.__addEntry</h4> |
|
606 <b>__addEntry</b>(<i></i>) |
|
607 <p> |
|
608 Private slot to handle the Add Entry context menu action. |
|
609 </p><a NAME="TemplateViewer.__addGroup" ID="TemplateViewer.__addGroup"></a> |
|
610 <h4>TemplateViewer.__addGroup</h4> |
|
611 <b>__addGroup</b>(<i></i>) |
|
612 <p> |
|
613 Private slot to handle the Add Group context menu action. |
|
614 </p><a NAME="TemplateViewer.__configure" ID="TemplateViewer.__configure"></a> |
|
615 <h4>TemplateViewer.__configure</h4> |
|
616 <b>__configure</b>(<i></i>) |
|
617 <p> |
|
618 Private method to open the configuration dialog. |
|
619 </p><a NAME="TemplateViewer.__edit" ID="TemplateViewer.__edit"></a> |
|
620 <h4>TemplateViewer.__edit</h4> |
|
621 <b>__edit</b>(<i></i>) |
|
622 <p> |
|
623 Private slot to handle the Edit context menu action. |
|
624 </p><a NAME="TemplateViewer.__export" ID="TemplateViewer.__export"></a> |
|
625 <h4>TemplateViewer.__export</h4> |
|
626 <b>__export</b>(<i></i>) |
|
627 <p> |
|
628 Private slot to handle the Export context menu action. |
|
629 </p><a NAME="TemplateViewer.__getPredefinedVars" ID="TemplateViewer.__getPredefinedVars"></a> |
|
630 <h4>TemplateViewer.__getPredefinedVars</h4> |
|
631 <b>__getPredefinedVars</b>(<i></i>) |
|
632 <p> |
|
633 Private method to return predefined variables. |
|
634 </p><dl> |
|
635 <dt>Returns:</dt> |
|
636 <dd> |
|
637 dictionary of predefined variables and their values |
|
638 </dd> |
|
639 </dl><a NAME="TemplateViewer.__import" ID="TemplateViewer.__import"></a> |
|
640 <h4>TemplateViewer.__import</h4> |
|
641 <b>__import</b>(<i></i>) |
|
642 <p> |
|
643 Private slot to handle the Import context menu action. |
|
644 </p><a NAME="TemplateViewer.__reload" ID="TemplateViewer.__reload"></a> |
|
645 <h4>TemplateViewer.__reload</h4> |
|
646 <b>__reload</b>(<i></i>) |
|
647 <p> |
|
648 Private slot to reload the templates. |
|
649 </p><a NAME="TemplateViewer.__remove" ID="TemplateViewer.__remove"></a> |
|
650 <h4>TemplateViewer.__remove</h4> |
|
651 <b>__remove</b>(<i></i>) |
|
652 <p> |
|
653 Private slot to handle the Remove context menu action. |
|
654 </p><a NAME="TemplateViewer.__resort" ID="TemplateViewer.__resort"></a> |
|
655 <h4>TemplateViewer.__resort</h4> |
|
656 <b>__resort</b>(<i></i>) |
|
657 <p> |
|
658 Private method to resort the tree. |
|
659 </p><a NAME="TemplateViewer.__showContextMenu" ID="TemplateViewer.__showContextMenu"></a> |
|
660 <h4>TemplateViewer.__showContextMenu</h4> |
|
661 <b>__showContextMenu</b>(<i>coord</i>) |
|
662 <p> |
|
663 Private slot to show the context menu of the list. |
|
664 </p><dl> |
|
665 <dt><i>coord</i></dt> |
|
666 <dd> |
|
667 the position of the mouse pointer (QPoint) |
|
668 </dd> |
|
669 </dl><a NAME="TemplateViewer.__showHelp" ID="TemplateViewer.__showHelp"></a> |
|
670 <h4>TemplateViewer.__showHelp</h4> |
|
671 <b>__showHelp</b>(<i></i>) |
|
672 <p> |
|
673 Private method to show some help. |
|
674 </p><a NAME="TemplateViewer.__templateItemActivated" ID="TemplateViewer.__templateItemActivated"></a> |
|
675 <h4>TemplateViewer.__templateItemActivated</h4> |
|
676 <b>__templateItemActivated</b>(<i>itm=None, col=0</i>) |
|
677 <p> |
|
678 Private slot to handle the activation of an item. |
|
679 </p><dl> |
|
680 <dt><i>itm</i></dt> |
|
681 <dd> |
|
682 reference to the activated item (QTreeWidgetItem) |
|
683 </dd><dt><i>col</i></dt> |
|
684 <dd> |
|
685 column the item was activated in (integer) |
|
686 </dd> |
|
687 </dl><a NAME="TemplateViewer.addEntry" ID="TemplateViewer.addEntry"></a> |
|
688 <h4>TemplateViewer.addEntry</h4> |
|
689 <b>addEntry</b>(<i>groupName, name, description, template, quiet=False</i>) |
|
690 <p> |
|
691 Public method to add a template entry. |
|
692 </p><dl> |
|
693 <dt><i>groupName</i></dt> |
|
694 <dd> |
|
695 name of the group to add to (string) |
|
696 </dd><dt><i>name</i></dt> |
|
697 <dd> |
|
698 name of the entry to add (string) |
|
699 </dd><dt><i>description</i></dt> |
|
700 <dd> |
|
701 description of the entry to add (string) |
|
702 </dd><dt><i>template</i></dt> |
|
703 <dd> |
|
704 template text of the entry (string) |
|
705 </dd><dt><i>quiet</i></dt> |
|
706 <dd> |
|
707 flag indicating quiet operation (boolean) |
|
708 </dd> |
|
709 </dl><a NAME="TemplateViewer.addGroup" ID="TemplateViewer.addGroup"></a> |
|
710 <h4>TemplateViewer.addGroup</h4> |
|
711 <b>addGroup</b>(<i>name, language="All"</i>) |
|
712 <p> |
|
713 Public method to add a group. |
|
714 </p><dl> |
|
715 <dt><i>name</i></dt> |
|
716 <dd> |
|
717 name of the group to be added (string) |
|
718 </dd><dt><i>language</i></dt> |
|
719 <dd> |
|
720 programming language for the group (string) |
|
721 </dd> |
|
722 </dl><a NAME="TemplateViewer.applyNamedTemplate" ID="TemplateViewer.applyNamedTemplate"></a> |
|
723 <h4>TemplateViewer.applyNamedTemplate</h4> |
|
724 <b>applyNamedTemplate</b>(<i>templateName, groupName=None</i>) |
|
725 <p> |
|
726 Public method to apply a template given a template name. |
|
727 </p><dl> |
|
728 <dt><i>templateName</i></dt> |
|
729 <dd> |
|
730 name of the template item to apply (string) |
|
731 </dd><dt><i>groupName</i></dt> |
|
732 <dd> |
|
733 name of the group to get the entry from (string). |
|
734 None or empty means to apply the first template found with the |
|
735 given name. |
|
736 </dd> |
|
737 </dl><a NAME="TemplateViewer.applyTemplate" ID="TemplateViewer.applyTemplate"></a> |
|
738 <h4>TemplateViewer.applyTemplate</h4> |
|
739 <b>applyTemplate</b>(<i>itm</i>) |
|
740 <p> |
|
741 Public method to apply the template. |
|
742 </p><dl> |
|
743 <dt><i>itm</i></dt> |
|
744 <dd> |
|
745 reference to the template item to apply (TemplateEntry) |
|
746 </dd> |
|
747 </dl><a NAME="TemplateViewer.changeEntry" ID="TemplateViewer.changeEntry"></a> |
|
748 <h4>TemplateViewer.changeEntry</h4> |
|
749 <b>changeEntry</b>(<i>itm, name, groupName, description, template</i>) |
|
750 <p> |
|
751 Public method to change a template entry. |
|
752 </p><dl> |
|
753 <dt><i>itm</i></dt> |
|
754 <dd> |
|
755 template entry to be changed (TemplateEntry) |
|
756 </dd><dt><i>name</i></dt> |
|
757 <dd> |
|
758 new name for the entry (string) |
|
759 </dd><dt><i>groupName</i></dt> |
|
760 <dd> |
|
761 name of the group the entry should belong to |
|
762 (string) |
|
763 </dd><dt><i>description</i></dt> |
|
764 <dd> |
|
765 description of the entry (string) |
|
766 </dd><dt><i>template</i></dt> |
|
767 <dd> |
|
768 template text of the entry (string) |
|
769 </dd> |
|
770 </dl><a NAME="TemplateViewer.changeGroup" ID="TemplateViewer.changeGroup"></a> |
|
771 <h4>TemplateViewer.changeGroup</h4> |
|
772 <b>changeGroup</b>(<i>oldname, newname, language="All"</i>) |
|
773 <p> |
|
774 Public method to rename a group. |
|
775 </p><dl> |
|
776 <dt><i>oldname</i></dt> |
|
777 <dd> |
|
778 old name of the group (string) |
|
779 </dd><dt><i>newname</i></dt> |
|
780 <dd> |
|
781 new name of the group (string) |
|
782 </dd><dt><i>language</i></dt> |
|
783 <dd> |
|
784 programming language for the group (string) |
|
785 </dd> |
|
786 </dl><a NAME="TemplateViewer.getAllGroups" ID="TemplateViewer.getAllGroups"></a> |
|
787 <h4>TemplateViewer.getAllGroups</h4> |
|
788 <b>getAllGroups</b>(<i></i>) |
|
789 <p> |
|
790 Public method to get all groups. |
|
791 </p><dl> |
|
792 <dt>Returns:</dt> |
|
793 <dd> |
|
794 list of all groups (list of TemplateGroup) |
|
795 </dd> |
|
796 </dl><a NAME="TemplateViewer.getGroupNames" ID="TemplateViewer.getGroupNames"></a> |
|
797 <h4>TemplateViewer.getGroupNames</h4> |
|
798 <b>getGroupNames</b>(<i></i>) |
|
799 <p> |
|
800 Public method to get all group names. |
|
801 </p><dl> |
|
802 <dt>Returns:</dt> |
|
803 <dd> |
|
804 list of all group names (list of strings) |
|
805 </dd> |
|
806 </dl><a NAME="TemplateViewer.getTemplateNames" ID="TemplateViewer.getTemplateNames"></a> |
|
807 <h4>TemplateViewer.getTemplateNames</h4> |
|
808 <b>getTemplateNames</b>(<i>start, groupName=None</i>) |
|
809 <p> |
|
810 Public method to get the names of templates starting with the |
|
811 given string. |
|
812 </p><dl> |
|
813 <dt><i>start</i></dt> |
|
814 <dd> |
|
815 start string of the name (string) |
|
816 </dd><dt><i>groupName</i></dt> |
|
817 <dd> |
|
818 name of the group to get the entry from (string). |
|
819 None or empty means to look in all groups. |
|
820 </dd> |
|
821 </dl><dl> |
|
822 <dt>Returns:</dt> |
|
823 <dd> |
|
824 sorted list of matching template names (list of strings) |
|
825 </dd> |
|
826 </dl><a NAME="TemplateViewer.hasGroup" ID="TemplateViewer.hasGroup"></a> |
|
827 <h4>TemplateViewer.hasGroup</h4> |
|
828 <b>hasGroup</b>(<i>name</i>) |
|
829 <p> |
|
830 Public method to check, if a group with the given name exists. |
|
831 </p><dl> |
|
832 <dt><i>name</i></dt> |
|
833 <dd> |
|
834 name of the group to be checked for (string) |
|
835 </dd> |
|
836 </dl><dl> |
|
837 <dt>Returns:</dt> |
|
838 <dd> |
|
839 flag indicating an existing group (boolean) |
|
840 </dd> |
|
841 </dl><a NAME="TemplateViewer.hasTemplate" ID="TemplateViewer.hasTemplate"></a> |
|
842 <h4>TemplateViewer.hasTemplate</h4> |
|
843 <b>hasTemplate</b>(<i>entryName, groupName=None</i>) |
|
844 <p> |
|
845 Public method to check, if an entry of the given name exists. |
|
846 </p><dl> |
|
847 <dt><i>entryName</i></dt> |
|
848 <dd> |
|
849 name of the entry to check for (string) |
|
850 </dd><dt><i>groupName</i></dt> |
|
851 <dd> |
|
852 name of the group to check for the entry (string). |
|
853 None or empty means to check all groups. |
|
854 </dd> |
|
855 </dl><dl> |
|
856 <dt>Returns:</dt> |
|
857 <dd> |
|
858 flag indicating the existence (boolean) |
|
859 </dd> |
|
860 </dl><a NAME="TemplateViewer.readTemplates" ID="TemplateViewer.readTemplates"></a> |
|
861 <h4>TemplateViewer.readTemplates</h4> |
|
862 <b>readTemplates</b>(<i>filename=None</i>) |
|
863 <p> |
|
864 Public method to read in the templates file (.e4c). |
|
865 </p><dl> |
|
866 <dt><i>filename</i></dt> |
|
867 <dd> |
|
868 name of a templates file to read (string) |
|
869 </dd> |
|
870 </dl><a NAME="TemplateViewer.removeEntry" ID="TemplateViewer.removeEntry"></a> |
|
871 <h4>TemplateViewer.removeEntry</h4> |
|
872 <b>removeEntry</b>(<i>itm</i>) |
|
873 <p> |
|
874 Public method to remove a template entry. |
|
875 </p><dl> |
|
876 <dt><i>itm</i></dt> |
|
877 <dd> |
|
878 template entry to be removed (TemplateEntry) |
|
879 </dd> |
|
880 </dl><a NAME="TemplateViewer.removeGroup" ID="TemplateViewer.removeGroup"></a> |
|
881 <h4>TemplateViewer.removeGroup</h4> |
|
882 <b>removeGroup</b>(<i>itm</i>) |
|
883 <p> |
|
884 Public method to remove a group. |
|
885 </p><dl> |
|
886 <dt><i>itm</i></dt> |
|
887 <dd> |
|
888 template group to be removed (TemplateGroup) |
|
889 </dd> |
|
890 </dl><a NAME="TemplateViewer.save" ID="TemplateViewer.save"></a> |
|
891 <h4>TemplateViewer.save</h4> |
|
892 <b>save</b>(<i></i>) |
|
893 <p> |
|
894 Public slot to save the templates. |
|
895 </p><a NAME="TemplateViewer.writeTemplates" ID="TemplateViewer.writeTemplates"></a> |
|
896 <h4>TemplateViewer.writeTemplates</h4> |
|
897 <b>writeTemplates</b>(<i>filename=None</i>) |
|
898 <p> |
|
899 Public method to write the templates data to an XML file (.e4c). |
|
900 </p><dl> |
|
901 <dt><i>filename</i></dt> |
|
902 <dd> |
|
903 name of a templates file to read (string) |
|
904 </dd> |
|
905 </dl><dl> |
|
906 <dt>Returns:</dt> |
|
907 <dd> |
|
908 flag indicating success (boolean) |
|
909 </dd> |
|
910 </dl> |
|
911 <div align="right"><a href="#top">Up</a></div> |
|
912 <hr /> |
|
913 </body></html> |