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