src/eric7/Documentation/Source/eric7.Templates.TemplateViewer.html

branch
eric7
changeset 9209
b99e7fd55fd3
parent 8596
d64760b2da50
child 10431
64157aeb0312
equal deleted inserted replaced
9208:3fc8dfeb6ebe 9209:b99e7fd55fd3
1 <!DOCTYPE html>
2 <html><head>
3 <title>eric7.Templates.TemplateViewer</title>
4 <meta charset="UTF-8">
5 <link rel="stylesheet" href="styles.css">
6 </head>
7 <body>
8 <a NAME="top" ID="top"></a>
9 <h1>eric7.Templates.TemplateViewer</h1>
10
11 <p>
12 Module implementing a template viewer and associated classes.
13 </p>
14 <h3>Global Attributes</h3>
15
16 <table>
17 <tr><td>None</td></tr>
18 </table>
19 <h3>Classes</h3>
20
21 <table>
22
23 <tr>
24 <td><a href="#TemplateEntry">TemplateEntry</a></td>
25 <td>Class immplementing a template entry.</td>
26 </tr>
27 <tr>
28 <td><a href="#TemplateGroup">TemplateGroup</a></td>
29 <td>Class implementing a template group.</td>
30 </tr>
31 <tr>
32 <td><a href="#TemplateViewer">TemplateViewer</a></td>
33 <td>Class implementing the template viewer.</td>
34 </tr>
35 </table>
36 <h3>Functions</h3>
37
38 <table>
39 <tr><td>None</td></tr>
40 </table>
41 <hr />
42 <hr />
43 <a NAME="TemplateEntry" ID="TemplateEntry"></a>
44 <h2>TemplateEntry</h2>
45
46 <p>
47 Class immplementing a template entry.
48 </p>
49 <h3>Derived from</h3>
50 QTreeWidgetItem
51 <h3>Class Attributes</h3>
52
53 <table>
54 <tr><td>None</td></tr>
55 </table>
56 <h3>Class Methods</h3>
57
58 <table>
59 <tr><td>None</td></tr>
60 </table>
61 <h3>Methods</h3>
62
63 <table>
64
65 <tr>
66 <td><a href="#TemplateEntry.__init__">TemplateEntry</a></td>
67 <td>Constructor</td>
68 </tr>
69 <tr>
70 <td><a href="#TemplateEntry.__displayText">__displayText</a></td>
71 <td>Private method to generate the display text.</td>
72 </tr>
73 <tr>
74 <td><a href="#TemplateEntry.__expandFormattedVariable">__expandFormattedVariable</a></td>
75 <td>Private method to expand a template variable with special formatting.</td>
76 </tr>
77 <tr>
78 <td><a href="#TemplateEntry.__extractVariables">__extractVariables</a></td>
79 <td>Private method to retrieve the list of variables.</td>
80 </tr>
81 <tr>
82 <td><a href="#TemplateEntry.getDescription">getDescription</a></td>
83 <td>Public method to get the description of the entry.</td>
84 </tr>
85 <tr>
86 <td><a href="#TemplateEntry.getExpandedText">getExpandedText</a></td>
87 <td>Public method to get the template text with all variables expanded.</td>
88 </tr>
89 <tr>
90 <td><a href="#TemplateEntry.getGroupName">getGroupName</a></td>
91 <td>Public method to get the name of the group this entry belongs to.</td>
92 </tr>
93 <tr>
94 <td><a href="#TemplateEntry.getName">getName</a></td>
95 <td>Public method to get the name of the entry.</td>
96 </tr>
97 <tr>
98 <td><a href="#TemplateEntry.getTemplateText">getTemplateText</a></td>
99 <td>Public method to get the template text.</td>
100 </tr>
101 <tr>
102 <td><a href="#TemplateEntry.getVariables">getVariables</a></td>
103 <td>Public method to get the list of variables.</td>
104 </tr>
105 <tr>
106 <td><a href="#TemplateEntry.setDescription">setDescription</a></td>
107 <td>Public method to update the description of the entry.</td>
108 </tr>
109 <tr>
110 <td><a href="#TemplateEntry.setName">setName</a></td>
111 <td>Public method to update the name of the entry.</td>
112 </tr>
113 <tr>
114 <td><a href="#TemplateEntry.setTemplateText">setTemplateText</a></td>
115 <td>Public method to update the template text.</td>
116 </tr>
117 </table>
118 <h3>Static Methods</h3>
119
120 <table>
121 <tr><td>None</td></tr>
122 </table>
123
124 <a NAME="TemplateEntry.__init__" ID="TemplateEntry.__init__"></a>
125 <h4>TemplateEntry (Constructor)</h4>
126 <b>TemplateEntry</b>(<i>parent, name, description, templateText</i>)
127
128 <p>
129 Constructor
130 </p>
131 <dl>
132
133 <dt><i>parent</i></dt>
134 <dd>
135 parent widget of the template entry (QWidget)
136 </dd>
137 <dt><i>name</i></dt>
138 <dd>
139 name of the entry (string)
140 </dd>
141 <dt><i>description</i></dt>
142 <dd>
143 descriptive text for the template (string)
144 </dd>
145 <dt><i>templateText</i></dt>
146 <dd>
147 text of the template entry (string)
148 </dd>
149 </dl>
150 <a NAME="TemplateEntry.__displayText" ID="TemplateEntry.__displayText"></a>
151 <h4>TemplateEntry.__displayText</h4>
152 <b>__displayText</b>(<i></i>)
153
154 <p>
155 Private method to generate the display text.
156 </p>
157 <dl>
158 <dt>Return:</dt>
159 <dd>
160 display text (string)
161 </dd>
162 </dl>
163 <a NAME="TemplateEntry.__expandFormattedVariable" ID="TemplateEntry.__expandFormattedVariable"></a>
164 <h4>TemplateEntry.__expandFormattedVariable</h4>
165 <b>__expandFormattedVariable</b>(<i>var, val, txt</i>)
166
167 <p>
168 Private method to expand a template variable with special formatting.
169 </p>
170 <dl>
171
172 <dt><i>var</i></dt>
173 <dd>
174 template variable name (string)
175 </dd>
176 <dt><i>val</i></dt>
177 <dd>
178 value of the template variable (string)
179 </dd>
180 <dt><i>txt</i></dt>
181 <dd>
182 template text (string)
183 </dd>
184 </dl>
185 <dl>
186 <dt>Return:</dt>
187 <dd>
188 expanded and formatted variable (string)
189 </dd>
190 </dl>
191 <a NAME="TemplateEntry.__extractVariables" ID="TemplateEntry.__extractVariables"></a>
192 <h4>TemplateEntry.__extractVariables</h4>
193 <b>__extractVariables</b>(<i></i>)
194
195 <p>
196 Private method to retrieve the list of variables.
197 </p>
198 <a NAME="TemplateEntry.getDescription" ID="TemplateEntry.getDescription"></a>
199 <h4>TemplateEntry.getDescription</h4>
200 <b>getDescription</b>(<i></i>)
201
202 <p>
203 Public method to get the description of the entry.
204 </p>
205 <dl>
206 <dt>Return:</dt>
207 <dd>
208 description of the entry (string)
209 </dd>
210 </dl>
211 <a NAME="TemplateEntry.getExpandedText" ID="TemplateEntry.getExpandedText"></a>
212 <h4>TemplateEntry.getExpandedText</h4>
213 <b>getExpandedText</b>(<i>varDict, indent</i>)
214
215 <p>
216 Public method to get the template text with all variables expanded.
217 </p>
218 <dl>
219
220 <dt><i>varDict</i></dt>
221 <dd>
222 dictionary containing the texts of each variable
223 with the variable name as key.
224 </dd>
225 <dt><i>indent</i></dt>
226 <dd>
227 indentation of the line receiving he expanded
228 template text (string)
229 </dd>
230 </dl>
231 <dl>
232 <dt>Return:</dt>
233 <dd>
234 a tuple of the expanded template text (string), the
235 number of lines (integer) and the length of the last line (integer)
236 </dd>
237 </dl>
238 <a NAME="TemplateEntry.getGroupName" ID="TemplateEntry.getGroupName"></a>
239 <h4>TemplateEntry.getGroupName</h4>
240 <b>getGroupName</b>(<i></i>)
241
242 <p>
243 Public method to get the name of the group this entry belongs to.
244 </p>
245 <dl>
246 <dt>Return:</dt>
247 <dd>
248 name of the group containing this entry (string)
249 </dd>
250 </dl>
251 <a NAME="TemplateEntry.getName" ID="TemplateEntry.getName"></a>
252 <h4>TemplateEntry.getName</h4>
253 <b>getName</b>(<i></i>)
254
255 <p>
256 Public method to get the name of the entry.
257 </p>
258 <dl>
259 <dt>Return:</dt>
260 <dd>
261 name of the entry (string)
262 </dd>
263 </dl>
264 <a NAME="TemplateEntry.getTemplateText" ID="TemplateEntry.getTemplateText"></a>
265 <h4>TemplateEntry.getTemplateText</h4>
266 <b>getTemplateText</b>(<i></i>)
267
268 <p>
269 Public method to get the template text.
270 </p>
271 <dl>
272 <dt>Return:</dt>
273 <dd>
274 the template text (string)
275 </dd>
276 </dl>
277 <a NAME="TemplateEntry.getVariables" ID="TemplateEntry.getVariables"></a>
278 <h4>TemplateEntry.getVariables</h4>
279 <b>getVariables</b>(<i></i>)
280
281 <p>
282 Public method to get the list of variables.
283 </p>
284 <dl>
285 <dt>Return:</dt>
286 <dd>
287 list of variables (list of strings)
288 </dd>
289 </dl>
290 <a NAME="TemplateEntry.setDescription" ID="TemplateEntry.setDescription"></a>
291 <h4>TemplateEntry.setDescription</h4>
292 <b>setDescription</b>(<i>description</i>)
293
294 <p>
295 Public method to update the description of the entry.
296 </p>
297 <dl>
298
299 <dt><i>description</i></dt>
300 <dd>
301 description of the entry (string)
302 </dd>
303 </dl>
304 <a NAME="TemplateEntry.setName" ID="TemplateEntry.setName"></a>
305 <h4>TemplateEntry.setName</h4>
306 <b>setName</b>(<i>name</i>)
307
308 <p>
309 Public method to update the name of the entry.
310 </p>
311 <dl>
312
313 <dt><i>name</i></dt>
314 <dd>
315 name of the entry (string)
316 </dd>
317 </dl>
318 <a NAME="TemplateEntry.setTemplateText" ID="TemplateEntry.setTemplateText"></a>
319 <h4>TemplateEntry.setTemplateText</h4>
320 <b>setTemplateText</b>(<i>templateText</i>)
321
322 <p>
323 Public method to update the template text.
324 </p>
325 <dl>
326
327 <dt><i>templateText</i></dt>
328 <dd>
329 text of the template entry (string)
330 </dd>
331 </dl>
332 <div align="right"><a href="#top">Up</a></div>
333 <hr />
334 <hr />
335 <a NAME="TemplateGroup" ID="TemplateGroup"></a>
336 <h2>TemplateGroup</h2>
337
338 <p>
339 Class implementing a template group.
340 </p>
341 <h3>Derived from</h3>
342 QTreeWidgetItem
343 <h3>Class Attributes</h3>
344
345 <table>
346 <tr><td>None</td></tr>
347 </table>
348 <h3>Class Methods</h3>
349
350 <table>
351 <tr><td>None</td></tr>
352 </table>
353 <h3>Methods</h3>
354
355 <table>
356
357 <tr>
358 <td><a href="#TemplateGroup.__init__">TemplateGroup</a></td>
359 <td>Constructor</td>
360 </tr>
361 <tr>
362 <td><a href="#TemplateGroup.addEntry">addEntry</a></td>
363 <td>Public method to add a template entry to this group.</td>
364 </tr>
365 <tr>
366 <td><a href="#TemplateGroup.getAllEntries">getAllEntries</a></td>
367 <td>Public method to retrieve all entries.</td>
368 </tr>
369 <tr>
370 <td><a href="#TemplateGroup.getEntry">getEntry</a></td>
371 <td>Public method to get an entry.</td>
372 </tr>
373 <tr>
374 <td><a href="#TemplateGroup.getEntryNames">getEntryNames</a></td>
375 <td>Public method to get the names of all entries, who's name starts with the given string.</td>
376 </tr>
377 <tr>
378 <td><a href="#TemplateGroup.getLanguage">getLanguage</a></td>
379 <td>Public method to get the name of the group.</td>
380 </tr>
381 <tr>
382 <td><a href="#TemplateGroup.getName">getName</a></td>
383 <td>Public method to get the name of the group.</td>
384 </tr>
385 <tr>
386 <td><a href="#TemplateGroup.hasEntry">hasEntry</a></td>
387 <td>Public method to check, if the group has an entry with the given name.</td>
388 </tr>
389 <tr>
390 <td><a href="#TemplateGroup.removeAllEntries">removeAllEntries</a></td>
391 <td>Public method to remove all template entries of this group.</td>
392 </tr>
393 <tr>
394 <td><a href="#TemplateGroup.removeEntry">removeEntry</a></td>
395 <td>Public method to remove a template entry from this group.</td>
396 </tr>
397 <tr>
398 <td><a href="#TemplateGroup.setLanguage">setLanguage</a></td>
399 <td>Public method to update the name of the group.</td>
400 </tr>
401 <tr>
402 <td><a href="#TemplateGroup.setName">setName</a></td>
403 <td>Public method to update the name of the group.</td>
404 </tr>
405 </table>
406 <h3>Static Methods</h3>
407
408 <table>
409 <tr><td>None</td></tr>
410 </table>
411
412 <a NAME="TemplateGroup.__init__" ID="TemplateGroup.__init__"></a>
413 <h4>TemplateGroup (Constructor)</h4>
414 <b>TemplateGroup</b>(<i>parent, name, language="All"</i>)
415
416 <p>
417 Constructor
418 </p>
419 <dl>
420
421 <dt><i>parent</i></dt>
422 <dd>
423 parent widget of the template group (QWidget)
424 </dd>
425 <dt><i>name</i></dt>
426 <dd>
427 name of the group (string)
428 </dd>
429 <dt><i>language</i></dt>
430 <dd>
431 programming language for the group (string)
432 </dd>
433 </dl>
434 <a NAME="TemplateGroup.addEntry" ID="TemplateGroup.addEntry"></a>
435 <h4>TemplateGroup.addEntry</h4>
436 <b>addEntry</b>(<i>name, description, template, quiet=False</i>)
437
438 <p>
439 Public method to add a template entry to this group.
440 </p>
441 <dl>
442
443 <dt><i>name</i></dt>
444 <dd>
445 name of the entry (string)
446 </dd>
447 <dt><i>description</i></dt>
448 <dd>
449 description of the entry to add (string)
450 </dd>
451 <dt><i>template</i></dt>
452 <dd>
453 template text of the entry (string)
454 </dd>
455 <dt><i>quiet</i></dt>
456 <dd>
457 flag indicating quiet operation (boolean)
458 </dd>
459 </dl>
460 <a NAME="TemplateGroup.getAllEntries" ID="TemplateGroup.getAllEntries"></a>
461 <h4>TemplateGroup.getAllEntries</h4>
462 <b>getAllEntries</b>(<i></i>)
463
464 <p>
465 Public method to retrieve all entries.
466 </p>
467 <dl>
468 <dt>Return:</dt>
469 <dd>
470 list of all entries (list of TemplateEntry)
471 </dd>
472 </dl>
473 <a NAME="TemplateGroup.getEntry" ID="TemplateGroup.getEntry"></a>
474 <h4>TemplateGroup.getEntry</h4>
475 <b>getEntry</b>(<i>name</i>)
476
477 <p>
478 Public method to get an entry.
479 </p>
480 <dl>
481
482 <dt><i>name</i></dt>
483 <dd>
484 name of the entry to retrieve (string)
485 </dd>
486 </dl>
487 <dl>
488 <dt>Return:</dt>
489 <dd>
490 reference to the entry (TemplateEntry)
491 </dd>
492 </dl>
493 <a NAME="TemplateGroup.getEntryNames" ID="TemplateGroup.getEntryNames"></a>
494 <h4>TemplateGroup.getEntryNames</h4>
495 <b>getEntryNames</b>(<i>beginning</i>)
496
497 <p>
498 Public method to get the names of all entries, who's name starts with
499 the given string.
500 </p>
501 <dl>
502
503 <dt><i>beginning</i></dt>
504 <dd>
505 string denoting the beginning of the template name
506 (string)
507 </dd>
508 </dl>
509 <dl>
510 <dt>Return:</dt>
511 <dd>
512 list of entry names found (list of strings)
513 </dd>
514 </dl>
515 <a NAME="TemplateGroup.getLanguage" ID="TemplateGroup.getLanguage"></a>
516 <h4>TemplateGroup.getLanguage</h4>
517 <b>getLanguage</b>(<i></i>)
518
519 <p>
520 Public method to get the name of the group.
521 </p>
522 <dl>
523 <dt>Return:</dt>
524 <dd>
525 language of the group (string)
526 </dd>
527 </dl>
528 <a NAME="TemplateGroup.getName" ID="TemplateGroup.getName"></a>
529 <h4>TemplateGroup.getName</h4>
530 <b>getName</b>(<i></i>)
531
532 <p>
533 Public method to get the name of the group.
534 </p>
535 <dl>
536 <dt>Return:</dt>
537 <dd>
538 name of the group (string)
539 </dd>
540 </dl>
541 <a NAME="TemplateGroup.hasEntry" ID="TemplateGroup.hasEntry"></a>
542 <h4>TemplateGroup.hasEntry</h4>
543 <b>hasEntry</b>(<i>name</i>)
544
545 <p>
546 Public method to check, if the group has an entry with the given name.
547 </p>
548 <dl>
549
550 <dt><i>name</i></dt>
551 <dd>
552 name of the entry to check for (string)
553 </dd>
554 </dl>
555 <dl>
556 <dt>Return:</dt>
557 <dd>
558 flag indicating existence (boolean)
559 </dd>
560 </dl>
561 <a NAME="TemplateGroup.removeAllEntries" ID="TemplateGroup.removeAllEntries"></a>
562 <h4>TemplateGroup.removeAllEntries</h4>
563 <b>removeAllEntries</b>(<i></i>)
564
565 <p>
566 Public method to remove all template entries of this group.
567 </p>
568 <a NAME="TemplateGroup.removeEntry" ID="TemplateGroup.removeEntry"></a>
569 <h4>TemplateGroup.removeEntry</h4>
570 <b>removeEntry</b>(<i>name</i>)
571
572 <p>
573 Public method to remove a template entry from this group.
574 </p>
575 <dl>
576
577 <dt><i>name</i></dt>
578 <dd>
579 name of the entry to be removed (string)
580 </dd>
581 </dl>
582 <a NAME="TemplateGroup.setLanguage" ID="TemplateGroup.setLanguage"></a>
583 <h4>TemplateGroup.setLanguage</h4>
584 <b>setLanguage</b>(<i>language</i>)
585
586 <p>
587 Public method to update the name of the group.
588 </p>
589 <dl>
590
591 <dt><i>language</i></dt>
592 <dd>
593 programming language for the group (string)
594 </dd>
595 </dl>
596 <a NAME="TemplateGroup.setName" ID="TemplateGroup.setName"></a>
597 <h4>TemplateGroup.setName</h4>
598 <b>setName</b>(<i>name</i>)
599
600 <p>
601 Public method to update the name of the group.
602 </p>
603 <dl>
604
605 <dt><i>name</i></dt>
606 <dd>
607 name of the group (string)
608 </dd>
609 </dl>
610 <div align="right"><a href="#top">Up</a></div>
611 <hr />
612 <hr />
613 <a NAME="TemplateViewer" ID="TemplateViewer"></a>
614 <h2>TemplateViewer</h2>
615
616 <p>
617 Class implementing the template viewer.
618 </p>
619 <h3>Derived from</h3>
620 QTreeWidget
621 <h3>Class Attributes</h3>
622
623 <table>
624 <tr><td>None</td></tr>
625 </table>
626 <h3>Class Methods</h3>
627
628 <table>
629 <tr><td>None</td></tr>
630 </table>
631 <h3>Methods</h3>
632
633 <table>
634
635 <tr>
636 <td><a href="#TemplateViewer.__init__">TemplateViewer</a></td>
637 <td>Constructor</td>
638 </tr>
639 <tr>
640 <td><a href="#TemplateViewer.__addEntry">__addEntry</a></td>
641 <td>Private slot to handle the Add Entry context menu action.</td>
642 </tr>
643 <tr>
644 <td><a href="#TemplateViewer.__addGroup">__addGroup</a></td>
645 <td>Private slot to handle the Add Group context menu action.</td>
646 </tr>
647 <tr>
648 <td><a href="#TemplateViewer.__configure">__configure</a></td>
649 <td>Private method to open the configuration dialog.</td>
650 </tr>
651 <tr>
652 <td><a href="#TemplateViewer.__edit">__edit</a></td>
653 <td>Private slot to handle the Edit context menu action.</td>
654 </tr>
655 <tr>
656 <td><a href="#TemplateViewer.__export">__export</a></td>
657 <td>Private slot to handle the Export context menu action.</td>
658 </tr>
659 <tr>
660 <td><a href="#TemplateViewer.__getPredefinedVars">__getPredefinedVars</a></td>
661 <td>Private method to return predefined variables.</td>
662 </tr>
663 <tr>
664 <td><a href="#TemplateViewer.__import">__import</a></td>
665 <td>Private slot to handle the Import context menu action.</td>
666 </tr>
667 <tr>
668 <td><a href="#TemplateViewer.__reload">__reload</a></td>
669 <td>Private slot to reload the templates.</td>
670 </tr>
671 <tr>
672 <td><a href="#TemplateViewer.__remove">__remove</a></td>
673 <td>Private slot to handle the Remove context menu action.</td>
674 </tr>
675 <tr>
676 <td><a href="#TemplateViewer.__resort">__resort</a></td>
677 <td>Private method to resort the tree.</td>
678 </tr>
679 <tr>
680 <td><a href="#TemplateViewer.__showContextMenu">__showContextMenu</a></td>
681 <td>Private slot to show the context menu of the list.</td>
682 </tr>
683 <tr>
684 <td><a href="#TemplateViewer.__showHelp">__showHelp</a></td>
685 <td>Private method to show some help.</td>
686 </tr>
687 <tr>
688 <td><a href="#TemplateViewer.__templateItemActivated">__templateItemActivated</a></td>
689 <td>Private slot to handle the activation of an item.</td>
690 </tr>
691 <tr>
692 <td><a href="#TemplateViewer.addEntry">addEntry</a></td>
693 <td>Public method to add a template entry.</td>
694 </tr>
695 <tr>
696 <td><a href="#TemplateViewer.addGroup">addGroup</a></td>
697 <td>Public method to add a group.</td>
698 </tr>
699 <tr>
700 <td><a href="#TemplateViewer.applyNamedTemplate">applyNamedTemplate</a></td>
701 <td>Public method to apply a template given a template name.</td>
702 </tr>
703 <tr>
704 <td><a href="#TemplateViewer.applyTemplate">applyTemplate</a></td>
705 <td>Public method to apply the template.</td>
706 </tr>
707 <tr>
708 <td><a href="#TemplateViewer.changeEntry">changeEntry</a></td>
709 <td>Public method to change a template entry.</td>
710 </tr>
711 <tr>
712 <td><a href="#TemplateViewer.changeGroup">changeGroup</a></td>
713 <td>Public method to rename a group.</td>
714 </tr>
715 <tr>
716 <td><a href="#TemplateViewer.getAllGroups">getAllGroups</a></td>
717 <td>Public method to get all groups.</td>
718 </tr>
719 <tr>
720 <td><a href="#TemplateViewer.getGroupNames">getGroupNames</a></td>
721 <td>Public method to get all group names.</td>
722 </tr>
723 <tr>
724 <td><a href="#TemplateViewer.getTemplateNames">getTemplateNames</a></td>
725 <td>Public method to get the names of templates starting with the given string.</td>
726 </tr>
727 <tr>
728 <td><a href="#TemplateViewer.hasGroup">hasGroup</a></td>
729 <td>Public method to check, if a group with the given name exists.</td>
730 </tr>
731 <tr>
732 <td><a href="#TemplateViewer.hasTemplate">hasTemplate</a></td>
733 <td>Public method to check, if an entry of the given name exists.</td>
734 </tr>
735 <tr>
736 <td><a href="#TemplateViewer.readTemplates">readTemplates</a></td>
737 <td>Public method to read in the templates file (.e4c).</td>
738 </tr>
739 <tr>
740 <td><a href="#TemplateViewer.removeEntry">removeEntry</a></td>
741 <td>Public method to remove a template entry.</td>
742 </tr>
743 <tr>
744 <td><a href="#TemplateViewer.removeGroup">removeGroup</a></td>
745 <td>Public method to remove a group.</td>
746 </tr>
747 <tr>
748 <td><a href="#TemplateViewer.save">save</a></td>
749 <td>Public slot to save the templates.</td>
750 </tr>
751 <tr>
752 <td><a href="#TemplateViewer.writeTemplates">writeTemplates</a></td>
753 <td>Public method to write the templates data to a JSON file (.ecj).</td>
754 </tr>
755 </table>
756 <h3>Static Methods</h3>
757
758 <table>
759 <tr><td>None</td></tr>
760 </table>
761
762 <a NAME="TemplateViewer.__init__" ID="TemplateViewer.__init__"></a>
763 <h4>TemplateViewer (Constructor)</h4>
764 <b>TemplateViewer</b>(<i>parent, viewmanager</i>)
765
766 <p>
767 Constructor
768 </p>
769 <dl>
770
771 <dt><i>parent</i></dt>
772 <dd>
773 the parent (QWidget)
774 </dd>
775 <dt><i>viewmanager</i></dt>
776 <dd>
777 reference to the viewmanager object
778 </dd>
779 </dl>
780 <a NAME="TemplateViewer.__addEntry" ID="TemplateViewer.__addEntry"></a>
781 <h4>TemplateViewer.__addEntry</h4>
782 <b>__addEntry</b>(<i></i>)
783
784 <p>
785 Private slot to handle the Add Entry context menu action.
786 </p>
787 <a NAME="TemplateViewer.__addGroup" ID="TemplateViewer.__addGroup"></a>
788 <h4>TemplateViewer.__addGroup</h4>
789 <b>__addGroup</b>(<i></i>)
790
791 <p>
792 Private slot to handle the Add Group context menu action.
793 </p>
794 <a NAME="TemplateViewer.__configure" ID="TemplateViewer.__configure"></a>
795 <h4>TemplateViewer.__configure</h4>
796 <b>__configure</b>(<i></i>)
797
798 <p>
799 Private method to open the configuration dialog.
800 </p>
801 <a NAME="TemplateViewer.__edit" ID="TemplateViewer.__edit"></a>
802 <h4>TemplateViewer.__edit</h4>
803 <b>__edit</b>(<i></i>)
804
805 <p>
806 Private slot to handle the Edit context menu action.
807 </p>
808 <a NAME="TemplateViewer.__export" ID="TemplateViewer.__export"></a>
809 <h4>TemplateViewer.__export</h4>
810 <b>__export</b>(<i></i>)
811
812 <p>
813 Private slot to handle the Export context menu action.
814 </p>
815 <a NAME="TemplateViewer.__getPredefinedVars" ID="TemplateViewer.__getPredefinedVars"></a>
816 <h4>TemplateViewer.__getPredefinedVars</h4>
817 <b>__getPredefinedVars</b>(<i></i>)
818
819 <p>
820 Private method to return predefined variables.
821 </p>
822 <dl>
823 <dt>Return:</dt>
824 <dd>
825 dictionary of predefined variables and their values
826 </dd>
827 </dl>
828 <a NAME="TemplateViewer.__import" ID="TemplateViewer.__import"></a>
829 <h4>TemplateViewer.__import</h4>
830 <b>__import</b>(<i></i>)
831
832 <p>
833 Private slot to handle the Import context menu action.
834 </p>
835 <a NAME="TemplateViewer.__reload" ID="TemplateViewer.__reload"></a>
836 <h4>TemplateViewer.__reload</h4>
837 <b>__reload</b>(<i></i>)
838
839 <p>
840 Private slot to reload the templates.
841 </p>
842 <a NAME="TemplateViewer.__remove" ID="TemplateViewer.__remove"></a>
843 <h4>TemplateViewer.__remove</h4>
844 <b>__remove</b>(<i></i>)
845
846 <p>
847 Private slot to handle the Remove context menu action.
848 </p>
849 <a NAME="TemplateViewer.__resort" ID="TemplateViewer.__resort"></a>
850 <h4>TemplateViewer.__resort</h4>
851 <b>__resort</b>(<i></i>)
852
853 <p>
854 Private method to resort the tree.
855 </p>
856 <a NAME="TemplateViewer.__showContextMenu" ID="TemplateViewer.__showContextMenu"></a>
857 <h4>TemplateViewer.__showContextMenu</h4>
858 <b>__showContextMenu</b>(<i>coord</i>)
859
860 <p>
861 Private slot to show the context menu of the list.
862 </p>
863 <dl>
864
865 <dt><i>coord</i></dt>
866 <dd>
867 the position of the mouse pointer (QPoint)
868 </dd>
869 </dl>
870 <a NAME="TemplateViewer.__showHelp" ID="TemplateViewer.__showHelp"></a>
871 <h4>TemplateViewer.__showHelp</h4>
872 <b>__showHelp</b>(<i></i>)
873
874 <p>
875 Private method to show some help.
876 </p>
877 <a NAME="TemplateViewer.__templateItemActivated" ID="TemplateViewer.__templateItemActivated"></a>
878 <h4>TemplateViewer.__templateItemActivated</h4>
879 <b>__templateItemActivated</b>(<i>itm=None, col=0</i>)
880
881 <p>
882 Private slot to handle the activation of an item.
883 </p>
884 <dl>
885
886 <dt><i>itm</i></dt>
887 <dd>
888 reference to the activated item (QTreeWidgetItem)
889 </dd>
890 <dt><i>col</i></dt>
891 <dd>
892 column the item was activated in (integer)
893 </dd>
894 </dl>
895 <a NAME="TemplateViewer.addEntry" ID="TemplateViewer.addEntry"></a>
896 <h4>TemplateViewer.addEntry</h4>
897 <b>addEntry</b>(<i>groupName, name, description, template, quiet=False</i>)
898
899 <p>
900 Public method to add a template entry.
901 </p>
902 <dl>
903
904 <dt><i>groupName</i></dt>
905 <dd>
906 name of the group to add to (string)
907 </dd>
908 <dt><i>name</i></dt>
909 <dd>
910 name of the entry to add (string)
911 </dd>
912 <dt><i>description</i></dt>
913 <dd>
914 description of the entry to add (string)
915 </dd>
916 <dt><i>template</i></dt>
917 <dd>
918 template text of the entry (string)
919 </dd>
920 <dt><i>quiet</i></dt>
921 <dd>
922 flag indicating quiet operation (boolean)
923 </dd>
924 </dl>
925 <a NAME="TemplateViewer.addGroup" ID="TemplateViewer.addGroup"></a>
926 <h4>TemplateViewer.addGroup</h4>
927 <b>addGroup</b>(<i>name, language="All"</i>)
928
929 <p>
930 Public method to add a group.
931 </p>
932 <dl>
933
934 <dt><i>name</i></dt>
935 <dd>
936 name of the group to be added (string)
937 </dd>
938 <dt><i>language</i></dt>
939 <dd>
940 programming language for the group (string)
941 </dd>
942 </dl>
943 <a NAME="TemplateViewer.applyNamedTemplate" ID="TemplateViewer.applyNamedTemplate"></a>
944 <h4>TemplateViewer.applyNamedTemplate</h4>
945 <b>applyNamedTemplate</b>(<i>templateName, groupName=None</i>)
946
947 <p>
948 Public method to apply a template given a template name.
949 </p>
950 <dl>
951
952 <dt><i>templateName</i></dt>
953 <dd>
954 name of the template item to apply (string)
955 </dd>
956 <dt><i>groupName</i></dt>
957 <dd>
958 name of the group to get the entry from (string).
959 None or empty means to apply the first template found with the
960 given name.
961 </dd>
962 </dl>
963 <a NAME="TemplateViewer.applyTemplate" ID="TemplateViewer.applyTemplate"></a>
964 <h4>TemplateViewer.applyTemplate</h4>
965 <b>applyTemplate</b>(<i>itm</i>)
966
967 <p>
968 Public method to apply the template.
969 </p>
970 <dl>
971
972 <dt><i>itm</i></dt>
973 <dd>
974 reference to the template item to apply (TemplateEntry)
975 </dd>
976 </dl>
977 <a NAME="TemplateViewer.changeEntry" ID="TemplateViewer.changeEntry"></a>
978 <h4>TemplateViewer.changeEntry</h4>
979 <b>changeEntry</b>(<i>itm, name, groupName, description, template</i>)
980
981 <p>
982 Public method to change a template entry.
983 </p>
984 <dl>
985
986 <dt><i>itm</i></dt>
987 <dd>
988 template entry to be changed (TemplateEntry)
989 </dd>
990 <dt><i>name</i></dt>
991 <dd>
992 new name for the entry (string)
993 </dd>
994 <dt><i>groupName</i></dt>
995 <dd>
996 name of the group the entry should belong to
997 (string)
998 </dd>
999 <dt><i>description</i></dt>
1000 <dd>
1001 description of the entry (string)
1002 </dd>
1003 <dt><i>template</i></dt>
1004 <dd>
1005 template text of the entry (string)
1006 </dd>
1007 </dl>
1008 <a NAME="TemplateViewer.changeGroup" ID="TemplateViewer.changeGroup"></a>
1009 <h4>TemplateViewer.changeGroup</h4>
1010 <b>changeGroup</b>(<i>oldname, newname, language="All"</i>)
1011
1012 <p>
1013 Public method to rename a group.
1014 </p>
1015 <dl>
1016
1017 <dt><i>oldname</i></dt>
1018 <dd>
1019 old name of the group (string)
1020 </dd>
1021 <dt><i>newname</i></dt>
1022 <dd>
1023 new name of the group (string)
1024 </dd>
1025 <dt><i>language</i></dt>
1026 <dd>
1027 programming language for the group (string)
1028 </dd>
1029 </dl>
1030 <a NAME="TemplateViewer.getAllGroups" ID="TemplateViewer.getAllGroups"></a>
1031 <h4>TemplateViewer.getAllGroups</h4>
1032 <b>getAllGroups</b>(<i></i>)
1033
1034 <p>
1035 Public method to get all groups.
1036 </p>
1037 <dl>
1038 <dt>Return:</dt>
1039 <dd>
1040 list of all groups (list of TemplateGroup)
1041 </dd>
1042 </dl>
1043 <a NAME="TemplateViewer.getGroupNames" ID="TemplateViewer.getGroupNames"></a>
1044 <h4>TemplateViewer.getGroupNames</h4>
1045 <b>getGroupNames</b>(<i></i>)
1046
1047 <p>
1048 Public method to get all group names.
1049 </p>
1050 <dl>
1051 <dt>Return:</dt>
1052 <dd>
1053 list of all group names (list of strings)
1054 </dd>
1055 </dl>
1056 <a NAME="TemplateViewer.getTemplateNames" ID="TemplateViewer.getTemplateNames"></a>
1057 <h4>TemplateViewer.getTemplateNames</h4>
1058 <b>getTemplateNames</b>(<i>start, groupName=None</i>)
1059
1060 <p>
1061 Public method to get the names of templates starting with the
1062 given string.
1063 </p>
1064 <dl>
1065
1066 <dt><i>start</i></dt>
1067 <dd>
1068 start string of the name (string)
1069 </dd>
1070 <dt><i>groupName</i></dt>
1071 <dd>
1072 name of the group to get the entry from (string).
1073 None or empty means to look in all groups.
1074 </dd>
1075 </dl>
1076 <dl>
1077 <dt>Return:</dt>
1078 <dd>
1079 sorted list of matching template names (list of strings)
1080 </dd>
1081 </dl>
1082 <a NAME="TemplateViewer.hasGroup" ID="TemplateViewer.hasGroup"></a>
1083 <h4>TemplateViewer.hasGroup</h4>
1084 <b>hasGroup</b>(<i>name</i>)
1085
1086 <p>
1087 Public method to check, if a group with the given name exists.
1088 </p>
1089 <dl>
1090
1091 <dt><i>name</i></dt>
1092 <dd>
1093 name of the group to be checked for (string)
1094 </dd>
1095 </dl>
1096 <dl>
1097 <dt>Return:</dt>
1098 <dd>
1099 flag indicating an existing group (boolean)
1100 </dd>
1101 </dl>
1102 <a NAME="TemplateViewer.hasTemplate" ID="TemplateViewer.hasTemplate"></a>
1103 <h4>TemplateViewer.hasTemplate</h4>
1104 <b>hasTemplate</b>(<i>entryName, groupName=None</i>)
1105
1106 <p>
1107 Public method to check, if an entry of the given name exists.
1108 </p>
1109 <dl>
1110
1111 <dt><i>entryName</i></dt>
1112 <dd>
1113 name of the entry to check for (string)
1114 </dd>
1115 <dt><i>groupName</i></dt>
1116 <dd>
1117 name of the group to check for the entry (string).
1118 None or empty means to check all groups.
1119 </dd>
1120 </dl>
1121 <dl>
1122 <dt>Return:</dt>
1123 <dd>
1124 flag indicating the existence (boolean)
1125 </dd>
1126 </dl>
1127 <a NAME="TemplateViewer.readTemplates" ID="TemplateViewer.readTemplates"></a>
1128 <h4>TemplateViewer.readTemplates</h4>
1129 <b>readTemplates</b>(<i>filename=None</i>)
1130
1131 <p>
1132 Public method to read in the templates file (.e4c).
1133 </p>
1134 <dl>
1135
1136 <dt><i>filename</i> (str)</dt>
1137 <dd>
1138 name of a templates file to read
1139 </dd>
1140 </dl>
1141 <a NAME="TemplateViewer.removeEntry" ID="TemplateViewer.removeEntry"></a>
1142 <h4>TemplateViewer.removeEntry</h4>
1143 <b>removeEntry</b>(<i>itm</i>)
1144
1145 <p>
1146 Public method to remove a template entry.
1147 </p>
1148 <dl>
1149
1150 <dt><i>itm</i></dt>
1151 <dd>
1152 template entry to be removed (TemplateEntry)
1153 </dd>
1154 </dl>
1155 <a NAME="TemplateViewer.removeGroup" ID="TemplateViewer.removeGroup"></a>
1156 <h4>TemplateViewer.removeGroup</h4>
1157 <b>removeGroup</b>(<i>itm</i>)
1158
1159 <p>
1160 Public method to remove a group.
1161 </p>
1162 <dl>
1163
1164 <dt><i>itm</i></dt>
1165 <dd>
1166 template group to be removed (TemplateGroup)
1167 </dd>
1168 </dl>
1169 <a NAME="TemplateViewer.save" ID="TemplateViewer.save"></a>
1170 <h4>TemplateViewer.save</h4>
1171 <b>save</b>(<i></i>)
1172
1173 <p>
1174 Public slot to save the templates.
1175 </p>
1176 <a NAME="TemplateViewer.writeTemplates" ID="TemplateViewer.writeTemplates"></a>
1177 <h4>TemplateViewer.writeTemplates</h4>
1178 <b>writeTemplates</b>(<i>filename=None</i>)
1179
1180 <p>
1181 Public method to write the templates data to a JSON file (.ecj).
1182 </p>
1183 <dl>
1184
1185 <dt><i>filename</i> (str)</dt>
1186 <dd>
1187 name of a templates file to write
1188 </dd>
1189 </dl>
1190 <dl>
1191 <dt>Return:</dt>
1192 <dd>
1193 flag indicating success
1194 </dd>
1195 </dl>
1196 <dl>
1197 <dt>Return Type:</dt>
1198 <dd>
1199 bool
1200 </dd>
1201 </dl>
1202 <div align="right"><a href="#top">Up</a></div>
1203 <hr />
1204 </body></html>

eric ide

mercurial