Documentation/Source/eric4.Templates.TemplateViewer.html

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

eric ide

mercurial