eric7/Documentation/Source/eric7.Graphics.ClassItem.html

branch
eric7
changeset 8372
e0227a7c850e
child 8596
d64760b2da50
equal deleted inserted replaced
8371:d6062691d424 8372:e0227a7c850e
1 <!DOCTYPE html>
2 <html><head>
3 <title>eric7.Graphics.ClassItem</title>
4 <meta charset="UTF-8">
5 <style>
6 body {
7 background: #EDECE6;
8 margin: 0em 1em 10em 1em;
9 color: black;
10 }
11
12 h1 { color: white; background: #85774A; }
13 h2 { color: white; background: #85774A; }
14 h3 { color: white; background: #9D936E; }
15 h4 { color: white; background: #9D936E; }
16
17 a { color: #BA6D36; }
18
19 </style>
20 </head>
21 <body>
22 <a NAME="top" ID="top"></a>
23 <h1>eric7.Graphics.ClassItem</h1>
24
25 <p>
26 Module implementing an UML like class item.
27 </p>
28 <h3>Global Attributes</h3>
29
30 <table>
31 <tr><td>None</td></tr>
32 </table>
33 <h3>Classes</h3>
34
35 <table>
36
37 <tr>
38 <td><a href="#ClassItem">ClassItem</a></td>
39 <td>Class implementing an UML like class item.</td>
40 </tr>
41 <tr>
42 <td><a href="#ClassModel">ClassModel</a></td>
43 <td>Class implementing the class model.</td>
44 </tr>
45 </table>
46 <h3>Functions</h3>
47
48 <table>
49 <tr><td>None</td></tr>
50 </table>
51 <hr />
52 <hr />
53 <a NAME="ClassItem" ID="ClassItem"></a>
54 <h2>ClassItem</h2>
55
56 <p>
57 Class implementing an UML like class item.
58 </p>
59 <h3>Derived from</h3>
60 UMLItem
61 <h3>Class Attributes</h3>
62
63 <table>
64 <tr><td>ItemType</td></tr>
65 </table>
66 <h3>Class Methods</h3>
67
68 <table>
69
70 <tr>
71 <td><a href="#ClassItem.fromDict">fromDict</a></td>
72 <td>Class method to create a class item from persisted data.</td>
73 </tr>
74 </table>
75 <h3>Methods</h3>
76
77 <table>
78
79 <tr>
80 <td><a href="#ClassItem.__init__">ClassItem</a></td>
81 <td>Constructor</td>
82 </tr>
83 <tr>
84 <td><a href="#ClassItem.__calculateSize">__calculateSize</a></td>
85 <td>Private method to calculate the size of the class item.</td>
86 </tr>
87 <tr>
88 <td><a href="#ClassItem.__createTexts">__createTexts</a></td>
89 <td>Private method to create the text items of the class item.</td>
90 </tr>
91 <tr>
92 <td><a href="#ClassItem.isExternal">isExternal</a></td>
93 <td>Public method returning the external state.</td>
94 </tr>
95 <tr>
96 <td><a href="#ClassItem.paint">paint</a></td>
97 <td>Public method to paint the item in local coordinates.</td>
98 </tr>
99 <tr>
100 <td><a href="#ClassItem.parseItemDataString">parseItemDataString</a></td>
101 <td>Public method to parse the given persistence data.</td>
102 </tr>
103 <tr>
104 <td><a href="#ClassItem.setModel">setModel</a></td>
105 <td>Public method to set the class model.</td>
106 </tr>
107 <tr>
108 <td><a href="#ClassItem.toDict">toDict</a></td>
109 <td>Public method to collect data to be persisted.</td>
110 </tr>
111 </table>
112 <h3>Static Methods</h3>
113
114 <table>
115 <tr><td>None</td></tr>
116 </table>
117
118 <a NAME="ClassItem.fromDict" ID="ClassItem.fromDict"></a>
119 <h4>ClassItem.fromDict (class method)</h4>
120 <b>fromDict</b>(<i>data, colors=None</i>)
121
122 <p>
123 Class method to create a class item from persisted data.
124 </p>
125 <dl>
126
127 <dt><i>data</i> (dict)</dt>
128 <dd>
129 dictionary containing the persisted data as generated
130 by toDict()
131 </dd>
132 <dt><i>colors</i> (tuple of (QColor, QColor))</dt>
133 <dd>
134 tuple containing the foreground and background colors
135 </dd>
136 </dl>
137 <dl>
138 <dt>Return:</dt>
139 <dd>
140 created class item
141 </dd>
142 </dl>
143 <dl>
144 <dt>Return Type:</dt>
145 <dd>
146 ClassItem
147 </dd>
148 </dl>
149 <a NAME="ClassItem.__init__" ID="ClassItem.__init__"></a>
150 <h4>ClassItem (Constructor)</h4>
151 <b>ClassItem</b>(<i>model=None, external=False, x=0, y=0, rounded=False, noAttrs=False, colors=None, parent=None, scene=None</i>)
152
153 <p>
154 Constructor
155 </p>
156 <dl>
157
158 <dt><i>model</i> (ClassModel)</dt>
159 <dd>
160 class model containing the class data
161 </dd>
162 <dt><i>external</i> (boolean)</dt>
163 <dd>
164 flag indicating a class defined outside our scope
165 </dd>
166 <dt><i>x</i> (int)</dt>
167 <dd>
168 x-coordinate
169 </dd>
170 <dt><i>y</i> (int)</dt>
171 <dd>
172 y-coordinate
173 </dd>
174 <dt><i>rounded</i> (bool)</dt>
175 <dd>
176 flag indicating a rounded corner
177 </dd>
178 <dt><i>noAttrs</i> (bool)</dt>
179 <dd>
180 flag indicating, that no attributes should be shown
181 </dd>
182 <dt><i>colors</i> (tuple of (QColor, QColor))</dt>
183 <dd>
184 tuple containing the foreground and background colors
185 </dd>
186 <dt><i>parent</i> (QGraphicsItem)</dt>
187 <dd>
188 reference to the parent object
189 </dd>
190 <dt><i>scene</i> (QGraphicsScene)</dt>
191 <dd>
192 reference to the scene object
193 </dd>
194 </dl>
195 <a NAME="ClassItem.__calculateSize" ID="ClassItem.__calculateSize"></a>
196 <h4>ClassItem.__calculateSize</h4>
197 <b>__calculateSize</b>(<i></i>)
198
199 <p>
200 Private method to calculate the size of the class item.
201 </p>
202 <a NAME="ClassItem.__createTexts" ID="ClassItem.__createTexts"></a>
203 <h4>ClassItem.__createTexts</h4>
204 <b>__createTexts</b>(<i></i>)
205
206 <p>
207 Private method to create the text items of the class item.
208 </p>
209 <a NAME="ClassItem.isExternal" ID="ClassItem.isExternal"></a>
210 <h4>ClassItem.isExternal</h4>
211 <b>isExternal</b>(<i></i>)
212
213 <p>
214 Public method returning the external state.
215 </p>
216 <dl>
217 <dt>Return:</dt>
218 <dd>
219 external state
220 </dd>
221 </dl>
222 <dl>
223 <dt>Return Type:</dt>
224 <dd>
225 bool
226 </dd>
227 </dl>
228 <a NAME="ClassItem.paint" ID="ClassItem.paint"></a>
229 <h4>ClassItem.paint</h4>
230 <b>paint</b>(<i>painter, option, widget=None</i>)
231
232 <p>
233 Public method to paint the item in local coordinates.
234 </p>
235 <dl>
236
237 <dt><i>painter</i> (QPainter)</dt>
238 <dd>
239 reference to the painter object
240 </dd>
241 <dt><i>option</i> (QStyleOptionGraphicsItem)</dt>
242 <dd>
243 style options
244 </dd>
245 <dt><i>widget</i> (QWidget)</dt>
246 <dd>
247 optional reference to the widget painted on
248 </dd>
249 </dl>
250 <a NAME="ClassItem.parseItemDataString" ID="ClassItem.parseItemDataString"></a>
251 <h4>ClassItem.parseItemDataString</h4>
252 <b>parseItemDataString</b>(<i>version, data</i>)
253
254 <p>
255 Public method to parse the given persistence data.
256 </p>
257 <dl>
258
259 <dt><i>version</i> (str)</dt>
260 <dd>
261 version of the data
262 </dd>
263 <dt><i>data</i> (str)</dt>
264 <dd>
265 persisted data to be parsed
266 </dd>
267 </dl>
268 <dl>
269 <dt>Return:</dt>
270 <dd>
271 flag indicating success
272 </dd>
273 </dl>
274 <dl>
275 <dt>Return Type:</dt>
276 <dd>
277 bool
278 </dd>
279 </dl>
280 <a NAME="ClassItem.setModel" ID="ClassItem.setModel"></a>
281 <h4>ClassItem.setModel</h4>
282 <b>setModel</b>(<i>model</i>)
283
284 <p>
285 Public method to set the class model.
286 </p>
287 <dl>
288
289 <dt><i>model</i> (ClassModel)</dt>
290 <dd>
291 class model containing the class data
292 </dd>
293 </dl>
294 <a NAME="ClassItem.toDict" ID="ClassItem.toDict"></a>
295 <h4>ClassItem.toDict</h4>
296 <b>toDict</b>(<i></i>)
297
298 <p>
299 Public method to collect data to be persisted.
300 </p>
301 <dl>
302 <dt>Return:</dt>
303 <dd>
304 dictionary containing data to be persisted
305 </dd>
306 </dl>
307 <dl>
308 <dt>Return Type:</dt>
309 <dd>
310 dict
311 </dd>
312 </dl>
313 <div align="right"><a href="#top">Up</a></div>
314 <hr />
315 <hr />
316 <a NAME="ClassModel" ID="ClassModel"></a>
317 <h2>ClassModel</h2>
318
319 <p>
320 Class implementing the class model.
321 </p>
322 <h3>Derived from</h3>
323 UMLModel
324 <h3>Class Attributes</h3>
325
326 <table>
327 <tr><td>None</td></tr>
328 </table>
329 <h3>Class Methods</h3>
330
331 <table>
332 <tr><td>None</td></tr>
333 </table>
334 <h3>Methods</h3>
335
336 <table>
337
338 <tr>
339 <td><a href="#ClassModel.__init__">ClassModel</a></td>
340 <td>Constructor</td>
341 </tr>
342 <tr>
343 <td><a href="#ClassModel.addClassAttribute">addClassAttribute</a></td>
344 <td>Public method to add a class attribute to the class model.</td>
345 </tr>
346 <tr>
347 <td><a href="#ClassModel.addInstanceAttribute">addInstanceAttribute</a></td>
348 <td>Public method to add an instance attribute to the class model.</td>
349 </tr>
350 <tr>
351 <td><a href="#ClassModel.addMethod">addMethod</a></td>
352 <td>Public method to add a method to the class model.</td>
353 </tr>
354 <tr>
355 <td><a href="#ClassModel.getClassAttributes">getClassAttributes</a></td>
356 <td>Public method to retrieve the global attributes of the class.</td>
357 </tr>
358 <tr>
359 <td><a href="#ClassModel.getInstanceAttributes">getInstanceAttributes</a></td>
360 <td>Public method to retrieve the attributes of the class.</td>
361 </tr>
362 <tr>
363 <td><a href="#ClassModel.getMethods">getMethods</a></td>
364 <td>Public method to retrieve the methods of the class.</td>
365 </tr>
366 </table>
367 <h3>Static Methods</h3>
368
369 <table>
370 <tr><td>None</td></tr>
371 </table>
372
373 <a NAME="ClassModel.__init__" ID="ClassModel.__init__"></a>
374 <h4>ClassModel (Constructor)</h4>
375 <b>ClassModel</b>(<i>name, methods=None, instanceAttributes=None, classAttributes=None</i>)
376
377 <p>
378 Constructor
379 </p>
380 <dl>
381
382 <dt><i>name</i> (str)</dt>
383 <dd>
384 the class name
385 </dd>
386 <dt><i>methods</i> (list of str)</dt>
387 <dd>
388 list of method names of the class
389 </dd>
390 <dt><i>instanceAttributes</i> (list of str)</dt>
391 <dd>
392 list of instance attribute names of the class
393 </dd>
394 <dt><i>classAttributes</i> (list of str)</dt>
395 <dd>
396 list of class attribute names of the class
397 </dd>
398 </dl>
399 <a NAME="ClassModel.addClassAttribute" ID="ClassModel.addClassAttribute"></a>
400 <h4>ClassModel.addClassAttribute</h4>
401 <b>addClassAttribute</b>(<i>attribute</i>)
402
403 <p>
404 Public method to add a class attribute to the class model.
405 </p>
406 <dl>
407
408 <dt><i>attribute</i> (str)</dt>
409 <dd>
410 class attribute name to be added
411 </dd>
412 </dl>
413 <a NAME="ClassModel.addInstanceAttribute" ID="ClassModel.addInstanceAttribute"></a>
414 <h4>ClassModel.addInstanceAttribute</h4>
415 <b>addInstanceAttribute</b>(<i>attribute</i>)
416
417 <p>
418 Public method to add an instance attribute to the class model.
419 </p>
420 <dl>
421
422 <dt><i>attribute</i> (str)</dt>
423 <dd>
424 instance attribute name to be added
425 </dd>
426 </dl>
427 <a NAME="ClassModel.addMethod" ID="ClassModel.addMethod"></a>
428 <h4>ClassModel.addMethod</h4>
429 <b>addMethod</b>(<i>method</i>)
430
431 <p>
432 Public method to add a method to the class model.
433 </p>
434 <dl>
435
436 <dt><i>method</i> (str)</dt>
437 <dd>
438 method name to be added
439 </dd>
440 </dl>
441 <a NAME="ClassModel.getClassAttributes" ID="ClassModel.getClassAttributes"></a>
442 <h4>ClassModel.getClassAttributes</h4>
443 <b>getClassAttributes</b>(<i></i>)
444
445 <p>
446 Public method to retrieve the global attributes of the class.
447 </p>
448 <dl>
449 <dt>Return:</dt>
450 <dd>
451 list of class attributes
452 </dd>
453 </dl>
454 <dl>
455 <dt>Return Type:</dt>
456 <dd>
457 list of str
458 </dd>
459 </dl>
460 <a NAME="ClassModel.getInstanceAttributes" ID="ClassModel.getInstanceAttributes"></a>
461 <h4>ClassModel.getInstanceAttributes</h4>
462 <b>getInstanceAttributes</b>(<i></i>)
463
464 <p>
465 Public method to retrieve the attributes of the class.
466 </p>
467 <dl>
468 <dt>Return:</dt>
469 <dd>
470 list of instance attributes
471 </dd>
472 </dl>
473 <dl>
474 <dt>Return Type:</dt>
475 <dd>
476 list of str
477 </dd>
478 </dl>
479 <a NAME="ClassModel.getMethods" ID="ClassModel.getMethods"></a>
480 <h4>ClassModel.getMethods</h4>
481 <b>getMethods</b>(<i></i>)
482
483 <p>
484 Public method to retrieve the methods of the class.
485 </p>
486 <dl>
487 <dt>Return:</dt>
488 <dd>
489 list of class methods
490 </dd>
491 </dl>
492 <dl>
493 <dt>Return Type:</dt>
494 <dd>
495 list of str
496 </dd>
497 </dl>
498 <div align="right"><a href="#top">Up</a></div>
499 <hr />
500 </body></html>

eric ide

mercurial