11 import os |
11 import os |
12 |
12 |
13 from PyQt4.QtGui import QProgressDialog, QApplication, QGraphicsTextItem |
13 from PyQt4.QtGui import QProgressDialog, QApplication, QGraphicsTextItem |
14 |
14 |
15 from .UMLDiagramBuilder import UMLDiagramBuilder |
15 from .UMLDiagramBuilder import UMLDiagramBuilder |
16 from .ModuleItem import ModuleItem, ModuleModel |
16 |
17 from .AssociationItem import AssociationItem, Imports |
|
18 |
|
19 import Utilities.ModuleParser |
|
20 import Utilities |
17 import Utilities |
21 import Preferences |
18 import Preferences |
22 |
19 |
23 |
20 |
24 class ImportsDiagramBuilder(UMLDiagramBuilder): |
21 class ImportsDiagramBuilder(UMLDiagramBuilder): |
86 prog = 0 |
83 prog = 0 |
87 progress = QProgressDialog(self.trUtf8("Parsing modules..."), |
84 progress = QProgressDialog(self.trUtf8("Parsing modules..."), |
88 None, 0, tot, self.parent()) |
85 None, 0, tot, self.parent()) |
89 progress.show() |
86 progress.show() |
90 QApplication.processEvents() |
87 QApplication.processEvents() |
|
88 import Utilities.ModuleParser |
91 for module in modules: |
89 for module in modules: |
92 progress.setValue(prog) |
90 progress.setValue(prog) |
93 QApplication.processEvents() |
91 QApplication.processEvents() |
94 prog = prog + 1 |
92 prog = prog + 1 |
95 try: |
93 try: |
221 @param classes list of class names contained in the module |
219 @param classes list of class names contained in the module |
222 (list of strings) |
220 (list of strings) |
223 @param x x-coordinate (float) |
221 @param x x-coordinate (float) |
224 @param y y-coordinate (float) |
222 @param y y-coordinate (float) |
225 """ |
223 """ |
|
224 from .ModuleItem import ModuleItem, ModuleModel |
226 classes.sort() |
225 classes.sort() |
227 impM = ModuleModel(name, classes) |
226 impM = ModuleModel(name, classes) |
228 impW = ModuleItem(impM, x, y, scene=self.scene) |
227 impW = ModuleItem(impM, x, y, scene=self.scene) |
229 impW.setId(self.umlView.getItemId()) |
228 impW.setId(self.umlView.getItemId()) |
230 return impW |
229 return impW |
233 """ |
232 """ |
234 Private method to generate the associations between the module shapes. |
233 Private method to generate the associations between the module shapes. |
235 |
234 |
236 @param shapes list of shapes |
235 @param shapes list of shapes |
237 """ |
236 """ |
|
237 from .AssociationItem import AssociationItem, Imports |
238 for module in list(shapes.keys()): |
238 for module in list(shapes.keys()): |
239 for rel in shapes[module][1]: |
239 for rel in shapes[module][1]: |
240 assoc = AssociationItem( |
240 assoc = AssociationItem( |
241 shapes[module][0], shapes[rel][0], |
241 shapes[module][0], shapes[rel][0], |
242 Imports) |
242 Imports) |