|
1 <!DOCTYPE html> |
|
2 <html><head> |
|
3 <title>eric7.Graphics.UMLItem</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.UMLItem</h1> |
|
10 |
|
11 <p> |
|
12 Module implementing the UMLItem base class. |
|
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="#UMLItem">UMLItem</a></td> |
|
25 <td>Class implementing the UMLItem base class.</td> |
|
26 </tr> |
|
27 <tr> |
|
28 <td><a href="#UMLModel">UMLModel</a></td> |
|
29 <td>Class implementing the UMLModel base class.</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="UMLItem" ID="UMLItem"></a> |
|
40 <h2>UMLItem</h2> |
|
41 |
|
42 <p> |
|
43 Class implementing the UMLItem base class. |
|
44 </p> |
|
45 <h3>Derived from</h3> |
|
46 QGraphicsRectItem |
|
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="#UMLItem.fromDict">fromDict</a></td> |
|
58 <td>Class method to create a generic UML item from persisted data.</td> |
|
59 </tr> |
|
60 </table> |
|
61 <h3>Methods</h3> |
|
62 |
|
63 <table> |
|
64 |
|
65 <tr> |
|
66 <td><a href="#UMLItem.__init__">UMLItem</a></td> |
|
67 <td>Constructor</td> |
|
68 </tr> |
|
69 <tr> |
|
70 <td><a href="#UMLItem.addAssociation">addAssociation</a></td> |
|
71 <td>Public method to add an association to this widget.</td> |
|
72 </tr> |
|
73 <tr> |
|
74 <td><a href="#UMLItem.adjustAssociations">adjustAssociations</a></td> |
|
75 <td>Public method to adjust the associations to widget movements.</td> |
|
76 </tr> |
|
77 <tr> |
|
78 <td><a href="#UMLItem.getId">getId</a></td> |
|
79 <td>Public method to get the item ID.</td> |
|
80 </tr> |
|
81 <tr> |
|
82 <td><a href="#UMLItem.getItemType">getItemType</a></td> |
|
83 <td>Public method to get the item's type.</td> |
|
84 </tr> |
|
85 <tr> |
|
86 <td><a href="#UMLItem.getName">getName</a></td> |
|
87 <td>Public method to retrieve the item name.</td> |
|
88 </tr> |
|
89 <tr> |
|
90 <td><a href="#UMLItem.itemChange">itemChange</a></td> |
|
91 <td>Public method called when an items state changes.</td> |
|
92 </tr> |
|
93 <tr> |
|
94 <td><a href="#UMLItem.moveBy">moveBy</a></td> |
|
95 <td>Public overriden method to move the widget relative.</td> |
|
96 </tr> |
|
97 <tr> |
|
98 <td><a href="#UMLItem.paint">paint</a></td> |
|
99 <td>Public method to paint the item in local coordinates.</td> |
|
100 </tr> |
|
101 <tr> |
|
102 <td><a href="#UMLItem.parseItemDataString">parseItemDataString</a></td> |
|
103 <td>Public method to parse the given persistence data.</td> |
|
104 </tr> |
|
105 <tr> |
|
106 <td><a href="#UMLItem.removeAssociation">removeAssociation</a></td> |
|
107 <td>Public method to remove an association to this widget.</td> |
|
108 </tr> |
|
109 <tr> |
|
110 <td><a href="#UMLItem.removeAssociations">removeAssociations</a></td> |
|
111 <td>Public method to remove all associations of this widget.</td> |
|
112 </tr> |
|
113 <tr> |
|
114 <td><a href="#UMLItem.setId">setId</a></td> |
|
115 <td>Public method to assign an ID to the item.</td> |
|
116 </tr> |
|
117 <tr> |
|
118 <td><a href="#UMLItem.setPos">setPos</a></td> |
|
119 <td>Public overriden method to set the items position.</td> |
|
120 </tr> |
|
121 <tr> |
|
122 <td><a href="#UMLItem.setSize">setSize</a></td> |
|
123 <td>Public method to set the rectangles size.</td> |
|
124 </tr> |
|
125 <tr> |
|
126 <td><a href="#UMLItem.toDict">toDict</a></td> |
|
127 <td>Public method to collect data to be persisted.</td> |
|
128 </tr> |
|
129 </table> |
|
130 <h3>Static Methods</h3> |
|
131 |
|
132 <table> |
|
133 <tr><td>None</td></tr> |
|
134 </table> |
|
135 |
|
136 <a NAME="UMLItem.fromDict" ID="UMLItem.fromDict"></a> |
|
137 <h4>UMLItem.fromDict (class method)</h4> |
|
138 <b>fromDict</b>(<i>data, colors=None</i>) |
|
139 |
|
140 <p> |
|
141 Class method to create a generic UML item from persisted data. |
|
142 </p> |
|
143 <dl> |
|
144 |
|
145 <dt><i>data</i> (dict)</dt> |
|
146 <dd> |
|
147 dictionary containing the persisted data as generated |
|
148 by toDict() |
|
149 </dd> |
|
150 <dt><i>colors</i> (tuple of (QColor, QColor))</dt> |
|
151 <dd> |
|
152 tuple containing the foreground and background colors |
|
153 </dd> |
|
154 </dl> |
|
155 <dl> |
|
156 <dt>Return:</dt> |
|
157 <dd> |
|
158 created UML item |
|
159 </dd> |
|
160 </dl> |
|
161 <dl> |
|
162 <dt>Return Type:</dt> |
|
163 <dd> |
|
164 UMLItem |
|
165 </dd> |
|
166 </dl> |
|
167 <a NAME="UMLItem.__init__" ID="UMLItem.__init__"></a> |
|
168 <h4>UMLItem (Constructor)</h4> |
|
169 <b>UMLItem</b>(<i>model=None, x=0, y=0, rounded=False, colors=None, parent=None</i>) |
|
170 |
|
171 <p> |
|
172 Constructor |
|
173 </p> |
|
174 <dl> |
|
175 |
|
176 <dt><i>model</i> (UMLModel)</dt> |
|
177 <dd> |
|
178 UML model containing the item data |
|
179 </dd> |
|
180 <dt><i>x</i> (int)</dt> |
|
181 <dd> |
|
182 x-coordinate |
|
183 </dd> |
|
184 <dt><i>y</i> (int)</dt> |
|
185 <dd> |
|
186 y-coordinate |
|
187 </dd> |
|
188 <dt><i>rounded</i> (bool)</dt> |
|
189 <dd> |
|
190 flag indicating a rounded corner |
|
191 </dd> |
|
192 <dt><i>colors</i> (tuple of (QColor, QColor))</dt> |
|
193 <dd> |
|
194 tuple containing the foreground and background colors |
|
195 </dd> |
|
196 <dt><i>parent</i> (QGraphicsItem)</dt> |
|
197 <dd> |
|
198 reference to the parent object |
|
199 </dd> |
|
200 </dl> |
|
201 <a NAME="UMLItem.addAssociation" ID="UMLItem.addAssociation"></a> |
|
202 <h4>UMLItem.addAssociation</h4> |
|
203 <b>addAssociation</b>(<i>assoc</i>) |
|
204 |
|
205 <p> |
|
206 Public method to add an association to this widget. |
|
207 </p> |
|
208 <dl> |
|
209 |
|
210 <dt><i>assoc</i> (AssociationWidget)</dt> |
|
211 <dd> |
|
212 association to be added |
|
213 </dd> |
|
214 </dl> |
|
215 <a NAME="UMLItem.adjustAssociations" ID="UMLItem.adjustAssociations"></a> |
|
216 <h4>UMLItem.adjustAssociations</h4> |
|
217 <b>adjustAssociations</b>(<i></i>) |
|
218 |
|
219 <p> |
|
220 Public method to adjust the associations to widget movements. |
|
221 </p> |
|
222 <a NAME="UMLItem.getId" ID="UMLItem.getId"></a> |
|
223 <h4>UMLItem.getId</h4> |
|
224 <b>getId</b>(<i></i>) |
|
225 |
|
226 <p> |
|
227 Public method to get the item ID. |
|
228 </p> |
|
229 <dl> |
|
230 <dt>Return:</dt> |
|
231 <dd> |
|
232 ID of the item |
|
233 </dd> |
|
234 </dl> |
|
235 <dl> |
|
236 <dt>Return Type:</dt> |
|
237 <dd> |
|
238 int |
|
239 </dd> |
|
240 </dl> |
|
241 <a NAME="UMLItem.getItemType" ID="UMLItem.getItemType"></a> |
|
242 <h4>UMLItem.getItemType</h4> |
|
243 <b>getItemType</b>(<i></i>) |
|
244 |
|
245 <p> |
|
246 Public method to get the item's type. |
|
247 </p> |
|
248 <dl> |
|
249 <dt>Return:</dt> |
|
250 <dd> |
|
251 item type |
|
252 </dd> |
|
253 </dl> |
|
254 <dl> |
|
255 <dt>Return Type:</dt> |
|
256 <dd> |
|
257 str |
|
258 </dd> |
|
259 </dl> |
|
260 <a NAME="UMLItem.getName" ID="UMLItem.getName"></a> |
|
261 <h4>UMLItem.getName</h4> |
|
262 <b>getName</b>(<i></i>) |
|
263 |
|
264 <p> |
|
265 Public method to retrieve the item name. |
|
266 </p> |
|
267 <dl> |
|
268 <dt>Return:</dt> |
|
269 <dd> |
|
270 item name |
|
271 </dd> |
|
272 </dl> |
|
273 <dl> |
|
274 <dt>Return Type:</dt> |
|
275 <dd> |
|
276 str |
|
277 </dd> |
|
278 </dl> |
|
279 <a NAME="UMLItem.itemChange" ID="UMLItem.itemChange"></a> |
|
280 <h4>UMLItem.itemChange</h4> |
|
281 <b>itemChange</b>(<i>change, value</i>) |
|
282 |
|
283 <p> |
|
284 Public method called when an items state changes. |
|
285 </p> |
|
286 <dl> |
|
287 |
|
288 <dt><i>change</i> (QGraphicsItem.GraphicsItemChange)</dt> |
|
289 <dd> |
|
290 the item's change |
|
291 </dd> |
|
292 <dt><i>value</i></dt> |
|
293 <dd> |
|
294 the value of the change |
|
295 </dd> |
|
296 </dl> |
|
297 <dl> |
|
298 <dt>Return:</dt> |
|
299 <dd> |
|
300 adjusted values |
|
301 </dd> |
|
302 </dl> |
|
303 <a NAME="UMLItem.moveBy" ID="UMLItem.moveBy"></a> |
|
304 <h4>UMLItem.moveBy</h4> |
|
305 <b>moveBy</b>(<i>dx, dy</i>) |
|
306 |
|
307 <p> |
|
308 Public overriden method to move the widget relative. |
|
309 </p> |
|
310 <dl> |
|
311 |
|
312 <dt><i>dx</i> (float)</dt> |
|
313 <dd> |
|
314 relative movement in x-direction |
|
315 </dd> |
|
316 <dt><i>dy</i> (float)</dt> |
|
317 <dd> |
|
318 relative movement in y-direction |
|
319 </dd> |
|
320 </dl> |
|
321 <a NAME="UMLItem.paint" ID="UMLItem.paint"></a> |
|
322 <h4>UMLItem.paint</h4> |
|
323 <b>paint</b>(<i>painter, option, widget=None</i>) |
|
324 |
|
325 <p> |
|
326 Public method to paint the item in local coordinates. |
|
327 </p> |
|
328 <dl> |
|
329 |
|
330 <dt><i>painter</i> (QPainter)</dt> |
|
331 <dd> |
|
332 reference to the painter object |
|
333 </dd> |
|
334 <dt><i>option</i> (QStyleOptionGraphicsItem)</dt> |
|
335 <dd> |
|
336 style options |
|
337 </dd> |
|
338 <dt><i>widget</i> (QWidget)</dt> |
|
339 <dd> |
|
340 optional reference to the widget painted on |
|
341 </dd> |
|
342 </dl> |
|
343 <a NAME="UMLItem.parseItemDataString" ID="UMLItem.parseItemDataString"></a> |
|
344 <h4>UMLItem.parseItemDataString</h4> |
|
345 <b>parseItemDataString</b>(<i>version, data</i>) |
|
346 |
|
347 <p> |
|
348 Public method to parse the given persistence data. |
|
349 </p> |
|
350 <dl> |
|
351 |
|
352 <dt><i>version</i> (str)</dt> |
|
353 <dd> |
|
354 version of the data |
|
355 </dd> |
|
356 <dt><i>data</i> (str)</dt> |
|
357 <dd> |
|
358 persisted data to be parsed |
|
359 </dd> |
|
360 </dl> |
|
361 <dl> |
|
362 <dt>Return:</dt> |
|
363 <dd> |
|
364 flag indicating success |
|
365 </dd> |
|
366 </dl> |
|
367 <dl> |
|
368 <dt>Return Type:</dt> |
|
369 <dd> |
|
370 bool |
|
371 </dd> |
|
372 </dl> |
|
373 <a NAME="UMLItem.removeAssociation" ID="UMLItem.removeAssociation"></a> |
|
374 <h4>UMLItem.removeAssociation</h4> |
|
375 <b>removeAssociation</b>(<i>assoc</i>) |
|
376 |
|
377 <p> |
|
378 Public method to remove an association to this widget. |
|
379 </p> |
|
380 <dl> |
|
381 |
|
382 <dt><i>assoc</i> (AssociationWidget)</dt> |
|
383 <dd> |
|
384 association to be removed |
|
385 </dd> |
|
386 </dl> |
|
387 <a NAME="UMLItem.removeAssociations" ID="UMLItem.removeAssociations"></a> |
|
388 <h4>UMLItem.removeAssociations</h4> |
|
389 <b>removeAssociations</b>(<i></i>) |
|
390 |
|
391 <p> |
|
392 Public method to remove all associations of this widget. |
|
393 </p> |
|
394 <a NAME="UMLItem.setId" ID="UMLItem.setId"></a> |
|
395 <h4>UMLItem.setId</h4> |
|
396 <b>setId</b>(<i>itemId</i>) |
|
397 |
|
398 <p> |
|
399 Public method to assign an ID to the item. |
|
400 </p> |
|
401 <dl> |
|
402 |
|
403 <dt><i>itemId</i> (int)</dt> |
|
404 <dd> |
|
405 assigned ID |
|
406 </dd> |
|
407 </dl> |
|
408 <a NAME="UMLItem.setPos" ID="UMLItem.setPos"></a> |
|
409 <h4>UMLItem.setPos</h4> |
|
410 <b>setPos</b>(<i>x, y</i>) |
|
411 |
|
412 <p> |
|
413 Public overriden method to set the items position. |
|
414 </p> |
|
415 <dl> |
|
416 |
|
417 <dt><i>x</i> (float)</dt> |
|
418 <dd> |
|
419 absolute x-position |
|
420 </dd> |
|
421 <dt><i>y</i> (float)</dt> |
|
422 <dd> |
|
423 absolute y-position |
|
424 </dd> |
|
425 </dl> |
|
426 <a NAME="UMLItem.setSize" ID="UMLItem.setSize"></a> |
|
427 <h4>UMLItem.setSize</h4> |
|
428 <b>setSize</b>(<i>width, height</i>) |
|
429 |
|
430 <p> |
|
431 Public method to set the rectangles size. |
|
432 </p> |
|
433 <dl> |
|
434 |
|
435 <dt><i>width</i> (float)</dt> |
|
436 <dd> |
|
437 width of the rectangle |
|
438 </dd> |
|
439 <dt><i>height</i> (float)</dt> |
|
440 <dd> |
|
441 height of the rectangle |
|
442 </dd> |
|
443 </dl> |
|
444 <a NAME="UMLItem.toDict" ID="UMLItem.toDict"></a> |
|
445 <h4>UMLItem.toDict</h4> |
|
446 <b>toDict</b>(<i></i>) |
|
447 |
|
448 <p> |
|
449 Public method to collect data to be persisted. |
|
450 </p> |
|
451 <dl> |
|
452 <dt>Return:</dt> |
|
453 <dd> |
|
454 dictionary containing data to be persisted |
|
455 </dd> |
|
456 </dl> |
|
457 <dl> |
|
458 <dt>Return Type:</dt> |
|
459 <dd> |
|
460 dict |
|
461 </dd> |
|
462 </dl> |
|
463 <div align="right"><a href="#top">Up</a></div> |
|
464 <hr /> |
|
465 <hr /> |
|
466 <a NAME="UMLModel" ID="UMLModel"></a> |
|
467 <h2>UMLModel</h2> |
|
468 |
|
469 <p> |
|
470 Class implementing the UMLModel base class. |
|
471 </p> |
|
472 <h3>Derived from</h3> |
|
473 None |
|
474 <h3>Class Attributes</h3> |
|
475 |
|
476 <table> |
|
477 <tr><td>None</td></tr> |
|
478 </table> |
|
479 <h3>Class Methods</h3> |
|
480 |
|
481 <table> |
|
482 <tr><td>None</td></tr> |
|
483 </table> |
|
484 <h3>Methods</h3> |
|
485 |
|
486 <table> |
|
487 |
|
488 <tr> |
|
489 <td><a href="#UMLModel.__init__">UMLModel</a></td> |
|
490 <td>Constructor</td> |
|
491 </tr> |
|
492 <tr> |
|
493 <td><a href="#UMLModel.getName">getName</a></td> |
|
494 <td>Public method to retrieve the model name.</td> |
|
495 </tr> |
|
496 </table> |
|
497 <h3>Static Methods</h3> |
|
498 |
|
499 <table> |
|
500 <tr><td>None</td></tr> |
|
501 </table> |
|
502 |
|
503 <a NAME="UMLModel.__init__" ID="UMLModel.__init__"></a> |
|
504 <h4>UMLModel (Constructor)</h4> |
|
505 <b>UMLModel</b>(<i>name</i>) |
|
506 |
|
507 <p> |
|
508 Constructor |
|
509 </p> |
|
510 <dl> |
|
511 |
|
512 <dt><i>name</i> (str)</dt> |
|
513 <dd> |
|
514 package name |
|
515 </dd> |
|
516 </dl> |
|
517 <a NAME="UMLModel.getName" ID="UMLModel.getName"></a> |
|
518 <h4>UMLModel.getName</h4> |
|
519 <b>getName</b>(<i></i>) |
|
520 |
|
521 <p> |
|
522 Public method to retrieve the model name. |
|
523 </p> |
|
524 <dl> |
|
525 <dt>Return:</dt> |
|
526 <dd> |
|
527 model name |
|
528 </dd> |
|
529 </dl> |
|
530 <dl> |
|
531 <dt>Return Type:</dt> |
|
532 <dd> |
|
533 str |
|
534 </dd> |
|
535 </dl> |
|
536 <div align="right"><a href="#top">Up</a></div> |
|
537 <hr /> |
|
538 </body></html> |