|
1 <!DOCTYPE html> |
|
2 <html><head> |
|
3 <title>eric7.Graphics.ImportsDiagramBuilder</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.ImportsDiagramBuilder</h1> |
|
10 |
|
11 <p> |
|
12 Module implementing a dialog showing an imports diagram of a package. |
|
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="#ImportsDiagramBuilder">ImportsDiagramBuilder</a></td> |
|
25 <td>Class implementing a builder for imports diagrams of a package.</td> |
|
26 </tr> |
|
27 </table> |
|
28 <h3>Functions</h3> |
|
29 |
|
30 <table> |
|
31 <tr><td>None</td></tr> |
|
32 </table> |
|
33 <hr /> |
|
34 <hr /> |
|
35 <a NAME="ImportsDiagramBuilder" ID="ImportsDiagramBuilder"></a> |
|
36 <h2>ImportsDiagramBuilder</h2> |
|
37 |
|
38 <p> |
|
39 Class implementing a builder for imports diagrams of a package. |
|
40 </p> |
|
41 <p> |
|
42 Note: Only package internal imports are shown in order to maintain |
|
43 some readability. |
|
44 </p> |
|
45 <h3>Derived from</h3> |
|
46 UMLDiagramBuilder |
|
47 <h3>Class Attributes</h3> |
|
48 |
|
49 <table> |
|
50 <tr><td>None</td></tr> |
|
51 </table> |
|
52 <h3>Class Methods</h3> |
|
53 |
|
54 <table> |
|
55 <tr><td>None</td></tr> |
|
56 </table> |
|
57 <h3>Methods</h3> |
|
58 |
|
59 <table> |
|
60 |
|
61 <tr> |
|
62 <td><a href="#ImportsDiagramBuilder.__init__">ImportsDiagramBuilder</a></td> |
|
63 <td>Constructor</td> |
|
64 </tr> |
|
65 <tr> |
|
66 <td><a href="#ImportsDiagramBuilder.__addModule">__addModule</a></td> |
|
67 <td>Private method to add a module to the diagram.</td> |
|
68 </tr> |
|
69 <tr> |
|
70 <td><a href="#ImportsDiagramBuilder.__arrangeNodes">__arrangeNodes</a></td> |
|
71 <td>Private method to arrange the shapes on the canvas.</td> |
|
72 </tr> |
|
73 <tr> |
|
74 <td><a href="#ImportsDiagramBuilder.__buildModulesDict">__buildModulesDict</a></td> |
|
75 <td>Private method to build a dictionary of modules contained in the package.</td> |
|
76 </tr> |
|
77 <tr> |
|
78 <td><a href="#ImportsDiagramBuilder.__createAssociations">__createAssociations</a></td> |
|
79 <td>Private method to generate the associations between the module shapes.</td> |
|
80 </tr> |
|
81 <tr> |
|
82 <td><a href="#ImportsDiagramBuilder.buildDiagram">buildDiagram</a></td> |
|
83 <td>Public method to build the modules shapes of the diagram.</td> |
|
84 </tr> |
|
85 <tr> |
|
86 <td><a href="#ImportsDiagramBuilder.fromDict">fromDict</a></td> |
|
87 <td>Public method to populate the class with data persisted by 'toDict()'.</td> |
|
88 </tr> |
|
89 <tr> |
|
90 <td><a href="#ImportsDiagramBuilder.initialize">initialize</a></td> |
|
91 <td>Public method to initialize the object.</td> |
|
92 </tr> |
|
93 <tr> |
|
94 <td><a href="#ImportsDiagramBuilder.parsePersistenceData">parsePersistenceData</a></td> |
|
95 <td>Public method to parse persisted data.</td> |
|
96 </tr> |
|
97 <tr> |
|
98 <td><a href="#ImportsDiagramBuilder.toDict">toDict</a></td> |
|
99 <td>Public method to collect data to be persisted.</td> |
|
100 </tr> |
|
101 </table> |
|
102 <h3>Static Methods</h3> |
|
103 |
|
104 <table> |
|
105 <tr><td>None</td></tr> |
|
106 </table> |
|
107 |
|
108 <a NAME="ImportsDiagramBuilder.__init__" ID="ImportsDiagramBuilder.__init__"></a> |
|
109 <h4>ImportsDiagramBuilder (Constructor)</h4> |
|
110 <b>ImportsDiagramBuilder</b>(<i>dialog, view, project, package, showExternalImports=False</i>) |
|
111 |
|
112 <p> |
|
113 Constructor |
|
114 </p> |
|
115 <dl> |
|
116 |
|
117 <dt><i>dialog</i> (UMLDialog)</dt> |
|
118 <dd> |
|
119 reference to the UML dialog |
|
120 </dd> |
|
121 <dt><i>view</i> (UMLGraphicsView)</dt> |
|
122 <dd> |
|
123 reference to the view object |
|
124 </dd> |
|
125 <dt><i>project</i> (Project)</dt> |
|
126 <dd> |
|
127 reference to the project object |
|
128 </dd> |
|
129 <dt><i>package</i> (str)</dt> |
|
130 <dd> |
|
131 name of a python package to show the import |
|
132 relationships |
|
133 </dd> |
|
134 <dt><i>showExternalImports</i> (bool)</dt> |
|
135 <dd> |
|
136 flag indicating to show exports from |
|
137 outside the package |
|
138 </dd> |
|
139 </dl> |
|
140 <a NAME="ImportsDiagramBuilder.__addModule" ID="ImportsDiagramBuilder.__addModule"></a> |
|
141 <h4>ImportsDiagramBuilder.__addModule</h4> |
|
142 <b>__addModule</b>(<i>name, classes, x, y</i>) |
|
143 |
|
144 <p> |
|
145 Private method to add a module to the diagram. |
|
146 </p> |
|
147 <dl> |
|
148 |
|
149 <dt><i>name</i> (str)</dt> |
|
150 <dd> |
|
151 module name to be shown |
|
152 </dd> |
|
153 <dt><i>classes</i> (list of str)</dt> |
|
154 <dd> |
|
155 list of class names contained in the module |
|
156 </dd> |
|
157 <dt><i>x</i> (float)</dt> |
|
158 <dd> |
|
159 x-coordinate |
|
160 </dd> |
|
161 <dt><i>y</i> (float)</dt> |
|
162 <dd> |
|
163 y-coordinate |
|
164 </dd> |
|
165 </dl> |
|
166 <dl> |
|
167 <dt>Return:</dt> |
|
168 <dd> |
|
169 reference to the imports item |
|
170 </dd> |
|
171 </dl> |
|
172 <dl> |
|
173 <dt>Return Type:</dt> |
|
174 <dd> |
|
175 ModuleItem |
|
176 </dd> |
|
177 </dl> |
|
178 <a NAME="ImportsDiagramBuilder.__arrangeNodes" ID="ImportsDiagramBuilder.__arrangeNodes"></a> |
|
179 <h4>ImportsDiagramBuilder.__arrangeNodes</h4> |
|
180 <b>__arrangeNodes</b>(<i>nodes, routes, whiteSpaceFactor=1.2</i>) |
|
181 |
|
182 <p> |
|
183 Private method to arrange the shapes on the canvas. |
|
184 </p> |
|
185 <p> |
|
186 The algorithm is borrowed from Boa Constructor. |
|
187 </p> |
|
188 <dl> |
|
189 |
|
190 <dt><i>nodes</i> (list of str)</dt> |
|
191 <dd> |
|
192 list of nodes to arrange |
|
193 </dd> |
|
194 <dt><i>routes</i> (list of tuple of (str, str))</dt> |
|
195 <dd> |
|
196 list of routes |
|
197 </dd> |
|
198 <dt><i>whiteSpaceFactor</i> (float)</dt> |
|
199 <dd> |
|
200 factor to increase whitespace between |
|
201 items |
|
202 </dd> |
|
203 </dl> |
|
204 <a NAME="ImportsDiagramBuilder.__buildModulesDict" ID="ImportsDiagramBuilder.__buildModulesDict"></a> |
|
205 <h4>ImportsDiagramBuilder.__buildModulesDict</h4> |
|
206 <b>__buildModulesDict</b>(<i></i>) |
|
207 |
|
208 <p> |
|
209 Private method to build a dictionary of modules contained in the |
|
210 package. |
|
211 </p> |
|
212 <dl> |
|
213 <dt>Return:</dt> |
|
214 <dd> |
|
215 dictionary of modules contained in the package |
|
216 </dd> |
|
217 </dl> |
|
218 <dl> |
|
219 <dt>Return Type:</dt> |
|
220 <dd> |
|
221 dict |
|
222 </dd> |
|
223 </dl> |
|
224 <a NAME="ImportsDiagramBuilder.__createAssociations" ID="ImportsDiagramBuilder.__createAssociations"></a> |
|
225 <h4>ImportsDiagramBuilder.__createAssociations</h4> |
|
226 <b>__createAssociations</b>(<i>routes</i>) |
|
227 |
|
228 <p> |
|
229 Private method to generate the associations between the module shapes. |
|
230 </p> |
|
231 <dl> |
|
232 |
|
233 <dt><i>routes</i> (list of tuple of (str, str))</dt> |
|
234 <dd> |
|
235 list of associations |
|
236 </dd> |
|
237 </dl> |
|
238 <a NAME="ImportsDiagramBuilder.buildDiagram" ID="ImportsDiagramBuilder.buildDiagram"></a> |
|
239 <h4>ImportsDiagramBuilder.buildDiagram</h4> |
|
240 <b>buildDiagram</b>(<i></i>) |
|
241 |
|
242 <p> |
|
243 Public method to build the modules shapes of the diagram. |
|
244 </p> |
|
245 <a NAME="ImportsDiagramBuilder.fromDict" ID="ImportsDiagramBuilder.fromDict"></a> |
|
246 <h4>ImportsDiagramBuilder.fromDict</h4> |
|
247 <b>fromDict</b>(<i>version, data</i>) |
|
248 |
|
249 <p> |
|
250 Public method to populate the class with data persisted by 'toDict()'. |
|
251 </p> |
|
252 <dl> |
|
253 |
|
254 <dt><i>version</i> (str)</dt> |
|
255 <dd> |
|
256 version of the data |
|
257 </dd> |
|
258 <dt><i>data</i> (dict)</dt> |
|
259 <dd> |
|
260 dictionary containing the persisted data |
|
261 </dd> |
|
262 </dl> |
|
263 <dl> |
|
264 <dt>Return:</dt> |
|
265 <dd> |
|
266 tuple containing a flag indicating success and an info |
|
267 message in case the diagram belongs to a different project |
|
268 </dd> |
|
269 </dl> |
|
270 <dl> |
|
271 <dt>Return Type:</dt> |
|
272 <dd> |
|
273 tuple of (bool, str) |
|
274 </dd> |
|
275 </dl> |
|
276 <a NAME="ImportsDiagramBuilder.initialize" ID="ImportsDiagramBuilder.initialize"></a> |
|
277 <h4>ImportsDiagramBuilder.initialize</h4> |
|
278 <b>initialize</b>(<i></i>) |
|
279 |
|
280 <p> |
|
281 Public method to initialize the object. |
|
282 </p> |
|
283 <a NAME="ImportsDiagramBuilder.parsePersistenceData" ID="ImportsDiagramBuilder.parsePersistenceData"></a> |
|
284 <h4>ImportsDiagramBuilder.parsePersistenceData</h4> |
|
285 <b>parsePersistenceData</b>(<i>version, data</i>) |
|
286 |
|
287 <p> |
|
288 Public method to parse persisted data. |
|
289 </p> |
|
290 <dl> |
|
291 |
|
292 <dt><i>version</i> (str)</dt> |
|
293 <dd> |
|
294 version of the data |
|
295 </dd> |
|
296 <dt><i>data</i> (str)</dt> |
|
297 <dd> |
|
298 persisted data to be parsed |
|
299 </dd> |
|
300 </dl> |
|
301 <dl> |
|
302 <dt>Return:</dt> |
|
303 <dd> |
|
304 flag indicating success |
|
305 </dd> |
|
306 </dl> |
|
307 <dl> |
|
308 <dt>Return Type:</dt> |
|
309 <dd> |
|
310 bool |
|
311 </dd> |
|
312 </dl> |
|
313 <a NAME="ImportsDiagramBuilder.toDict" ID="ImportsDiagramBuilder.toDict"></a> |
|
314 <h4>ImportsDiagramBuilder.toDict</h4> |
|
315 <b>toDict</b>(<i></i>) |
|
316 |
|
317 <p> |
|
318 Public method to collect data to be persisted. |
|
319 </p> |
|
320 <dl> |
|
321 <dt>Return:</dt> |
|
322 <dd> |
|
323 dictionary containing data to be persisted |
|
324 </dd> |
|
325 </dl> |
|
326 <dl> |
|
327 <dt>Return Type:</dt> |
|
328 <dd> |
|
329 dict |
|
330 </dd> |
|
331 </dl> |
|
332 <div align="right"><a href="#top">Up</a></div> |
|
333 <hr /> |
|
334 </body></html> |