|
1 <!DOCTYPE html> |
|
2 <html><head> |
|
3 <title>eric7.Graphics.ModuleItem</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.ModuleItem</h1> |
|
24 |
|
25 <p> |
|
26 Module implementing a module 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="#ModuleItem">ModuleItem</a></td> |
|
39 <td>Class implementing a module item.</td> |
|
40 </tr> |
|
41 <tr> |
|
42 <td><a href="#ModuleModel">ModuleModel</a></td> |
|
43 <td>Class implementing the module 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="ModuleItem" ID="ModuleItem"></a> |
|
54 <h2>ModuleItem</h2> |
|
55 |
|
56 <p> |
|
57 Class implementing a module 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="#ModuleItem.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="#ModuleItem.__init__">ModuleItem</a></td> |
|
81 <td>Constructor</td> |
|
82 </tr> |
|
83 <tr> |
|
84 <td><a href="#ModuleItem.__calculateSize">__calculateSize</a></td> |
|
85 <td>Private method to calculate the size of the module item.</td> |
|
86 </tr> |
|
87 <tr> |
|
88 <td><a href="#ModuleItem.__createTexts">__createTexts</a></td> |
|
89 <td>Private method to create the text items of the module item.</td> |
|
90 </tr> |
|
91 <tr> |
|
92 <td><a href="#ModuleItem.paint">paint</a></td> |
|
93 <td>Public method to paint the item in local coordinates.</td> |
|
94 </tr> |
|
95 <tr> |
|
96 <td><a href="#ModuleItem.parseItemDataString">parseItemDataString</a></td> |
|
97 <td>Public method to parse the given persistence data.</td> |
|
98 </tr> |
|
99 <tr> |
|
100 <td><a href="#ModuleItem.setModel">setModel</a></td> |
|
101 <td>Public method to set the module model.</td> |
|
102 </tr> |
|
103 <tr> |
|
104 <td><a href="#ModuleItem.toDict">toDict</a></td> |
|
105 <td>Public method to collect data to be persisted.</td> |
|
106 </tr> |
|
107 </table> |
|
108 <h3>Static Methods</h3> |
|
109 |
|
110 <table> |
|
111 <tr><td>None</td></tr> |
|
112 </table> |
|
113 |
|
114 <a NAME="ModuleItem.fromDict" ID="ModuleItem.fromDict"></a> |
|
115 <h4>ModuleItem.fromDict (class method)</h4> |
|
116 <b>fromDict</b>(<i>data, colors=None</i>) |
|
117 |
|
118 <p> |
|
119 Class method to create a class item from persisted data. |
|
120 </p> |
|
121 <dl> |
|
122 |
|
123 <dt><i>data</i> (dict)</dt> |
|
124 <dd> |
|
125 dictionary containing the persisted data as generated |
|
126 by toDict() |
|
127 </dd> |
|
128 <dt><i>colors</i> (tuple of (QColor, QColor))</dt> |
|
129 <dd> |
|
130 tuple containing the foreground and background colors |
|
131 </dd> |
|
132 </dl> |
|
133 <dl> |
|
134 <dt>Return:</dt> |
|
135 <dd> |
|
136 created class item |
|
137 </dd> |
|
138 </dl> |
|
139 <dl> |
|
140 <dt>Return Type:</dt> |
|
141 <dd> |
|
142 ClassItem |
|
143 </dd> |
|
144 </dl> |
|
145 <a NAME="ModuleItem.__init__" ID="ModuleItem.__init__"></a> |
|
146 <h4>ModuleItem (Constructor)</h4> |
|
147 <b>ModuleItem</b>(<i>model=None, x=0, y=0, rounded=False, colors=None, parent=None, scene=None</i>) |
|
148 |
|
149 <p> |
|
150 Constructor |
|
151 </p> |
|
152 <dl> |
|
153 |
|
154 <dt><i>model</i> (ModuleModel)</dt> |
|
155 <dd> |
|
156 module model containing the module data |
|
157 </dd> |
|
158 <dt><i>x</i> (int)</dt> |
|
159 <dd> |
|
160 x-coordinate |
|
161 </dd> |
|
162 <dt><i>y</i> (int)</dt> |
|
163 <dd> |
|
164 y-coordinate |
|
165 </dd> |
|
166 <dt><i>rounded</i> (bool)</dt> |
|
167 <dd> |
|
168 flag indicating a rounded corner |
|
169 </dd> |
|
170 <dt><i>colors</i> (tuple of (QColor, QColor))</dt> |
|
171 <dd> |
|
172 tuple containing the foreground and background colors |
|
173 </dd> |
|
174 <dt><i>parent</i> (QGraphicsItem)</dt> |
|
175 <dd> |
|
176 reference to the parent object |
|
177 </dd> |
|
178 <dt><i>scene</i> (QGraphicsScene)</dt> |
|
179 <dd> |
|
180 reference to the scene object |
|
181 </dd> |
|
182 </dl> |
|
183 <a NAME="ModuleItem.__calculateSize" ID="ModuleItem.__calculateSize"></a> |
|
184 <h4>ModuleItem.__calculateSize</h4> |
|
185 <b>__calculateSize</b>(<i></i>) |
|
186 |
|
187 <p> |
|
188 Private method to calculate the size of the module item. |
|
189 </p> |
|
190 <a NAME="ModuleItem.__createTexts" ID="ModuleItem.__createTexts"></a> |
|
191 <h4>ModuleItem.__createTexts</h4> |
|
192 <b>__createTexts</b>(<i></i>) |
|
193 |
|
194 <p> |
|
195 Private method to create the text items of the module item. |
|
196 </p> |
|
197 <a NAME="ModuleItem.paint" ID="ModuleItem.paint"></a> |
|
198 <h4>ModuleItem.paint</h4> |
|
199 <b>paint</b>(<i>painter, option, widget=None</i>) |
|
200 |
|
201 <p> |
|
202 Public method to paint the item in local coordinates. |
|
203 </p> |
|
204 <dl> |
|
205 |
|
206 <dt><i>painter</i> (QPainter)</dt> |
|
207 <dd> |
|
208 reference to the painter object |
|
209 </dd> |
|
210 <dt><i>option</i> (QStyleOptionGraphicsItem)</dt> |
|
211 <dd> |
|
212 style options |
|
213 </dd> |
|
214 <dt><i>widget</i> (QWidget)</dt> |
|
215 <dd> |
|
216 optional reference to the widget painted on |
|
217 </dd> |
|
218 </dl> |
|
219 <a NAME="ModuleItem.parseItemDataString" ID="ModuleItem.parseItemDataString"></a> |
|
220 <h4>ModuleItem.parseItemDataString</h4> |
|
221 <b>parseItemDataString</b>(<i>version, data</i>) |
|
222 |
|
223 <p> |
|
224 Public method to parse the given persistence data. |
|
225 </p> |
|
226 <dl> |
|
227 |
|
228 <dt><i>version</i> (str)</dt> |
|
229 <dd> |
|
230 version of the data |
|
231 </dd> |
|
232 <dt><i>data</i> (str)</dt> |
|
233 <dd> |
|
234 persisted data to be parsed |
|
235 </dd> |
|
236 </dl> |
|
237 <dl> |
|
238 <dt>Return:</dt> |
|
239 <dd> |
|
240 flag indicating success |
|
241 </dd> |
|
242 </dl> |
|
243 <dl> |
|
244 <dt>Return Type:</dt> |
|
245 <dd> |
|
246 bool |
|
247 </dd> |
|
248 </dl> |
|
249 <a NAME="ModuleItem.setModel" ID="ModuleItem.setModel"></a> |
|
250 <h4>ModuleItem.setModel</h4> |
|
251 <b>setModel</b>(<i>model</i>) |
|
252 |
|
253 <p> |
|
254 Public method to set the module model. |
|
255 </p> |
|
256 <dl> |
|
257 |
|
258 <dt><i>model</i> (ModuleModel)</dt> |
|
259 <dd> |
|
260 module model containing the module data |
|
261 </dd> |
|
262 </dl> |
|
263 <a NAME="ModuleItem.toDict" ID="ModuleItem.toDict"></a> |
|
264 <h4>ModuleItem.toDict</h4> |
|
265 <b>toDict</b>(<i></i>) |
|
266 |
|
267 <p> |
|
268 Public method to collect data to be persisted. |
|
269 </p> |
|
270 <dl> |
|
271 <dt>Return:</dt> |
|
272 <dd> |
|
273 dictionary containing data to be persisted |
|
274 </dd> |
|
275 </dl> |
|
276 <dl> |
|
277 <dt>Return Type:</dt> |
|
278 <dd> |
|
279 dict |
|
280 </dd> |
|
281 </dl> |
|
282 <div align="right"><a href="#top">Up</a></div> |
|
283 <hr /> |
|
284 <hr /> |
|
285 <a NAME="ModuleModel" ID="ModuleModel"></a> |
|
286 <h2>ModuleModel</h2> |
|
287 |
|
288 <p> |
|
289 Class implementing the module model. |
|
290 </p> |
|
291 <h3>Derived from</h3> |
|
292 UMLModel |
|
293 <h3>Class Attributes</h3> |
|
294 |
|
295 <table> |
|
296 <tr><td>None</td></tr> |
|
297 </table> |
|
298 <h3>Class Methods</h3> |
|
299 |
|
300 <table> |
|
301 <tr><td>None</td></tr> |
|
302 </table> |
|
303 <h3>Methods</h3> |
|
304 |
|
305 <table> |
|
306 |
|
307 <tr> |
|
308 <td><a href="#ModuleModel.__init__">ModuleModel</a></td> |
|
309 <td>Constructor</td> |
|
310 </tr> |
|
311 <tr> |
|
312 <td><a href="#ModuleModel.addClass">addClass</a></td> |
|
313 <td>Public method to add a class to the module model.</td> |
|
314 </tr> |
|
315 <tr> |
|
316 <td><a href="#ModuleModel.getClasses">getClasses</a></td> |
|
317 <td>Public method to retrieve the classes of the module.</td> |
|
318 </tr> |
|
319 </table> |
|
320 <h3>Static Methods</h3> |
|
321 |
|
322 <table> |
|
323 <tr><td>None</td></tr> |
|
324 </table> |
|
325 |
|
326 <a NAME="ModuleModel.__init__" ID="ModuleModel.__init__"></a> |
|
327 <h4>ModuleModel (Constructor)</h4> |
|
328 <b>ModuleModel</b>(<i>name, classlist=None</i>) |
|
329 |
|
330 <p> |
|
331 Constructor |
|
332 </p> |
|
333 <dl> |
|
334 |
|
335 <dt><i>name</i> (str)</dt> |
|
336 <dd> |
|
337 the module name |
|
338 </dd> |
|
339 <dt><i>classlist</i> (list of str)</dt> |
|
340 <dd> |
|
341 list of class names |
|
342 </dd> |
|
343 </dl> |
|
344 <a NAME="ModuleModel.addClass" ID="ModuleModel.addClass"></a> |
|
345 <h4>ModuleModel.addClass</h4> |
|
346 <b>addClass</b>(<i>classname</i>) |
|
347 |
|
348 <p> |
|
349 Public method to add a class to the module model. |
|
350 </p> |
|
351 <dl> |
|
352 |
|
353 <dt><i>classname</i> (str)</dt> |
|
354 <dd> |
|
355 class name to be added |
|
356 </dd> |
|
357 </dl> |
|
358 <a NAME="ModuleModel.getClasses" ID="ModuleModel.getClasses"></a> |
|
359 <h4>ModuleModel.getClasses</h4> |
|
360 <b>getClasses</b>(<i></i>) |
|
361 |
|
362 <p> |
|
363 Public method to retrieve the classes of the module. |
|
364 </p> |
|
365 <dl> |
|
366 <dt>Return:</dt> |
|
367 <dd> |
|
368 list of class names |
|
369 </dd> |
|
370 </dl> |
|
371 <dl> |
|
372 <dt>Return Type:</dt> |
|
373 <dd> |
|
374 list of str |
|
375 </dd> |
|
376 </dl> |
|
377 <div align="right"><a href="#top">Up</a></div> |
|
378 <hr /> |
|
379 </body></html> |