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

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

eric ide

mercurial