39 @param parent parent widget of the view (QWidget) |
39 @param parent parent widget of the view (QWidget) |
40 @param name name of the view widget (string) |
40 @param name name of the view widget (string) |
41 @keyparam showExternalImports flag indicating to show exports from outside |
41 @keyparam showExternalImports flag indicating to show exports from outside |
42 the package (boolean) |
42 the package (boolean) |
43 """ |
43 """ |
44 UMLDialog.__init__(self, buildFunction=self.__buildImports, parent=parent) |
44 UMLDialog.__init__(self, "ImportsDiagram", buildFunction=self.__buildImports, |
|
45 parent=parent) |
45 |
46 |
46 self.showExternalImports = showExternalImports |
47 self.showExternalImports = showExternalImports |
47 self.packagePath = Utilities.normabspath(package) |
48 self.packagePath = Utilities.normabspath(package) |
48 self.package = os.path.splitdrive(self.packagePath)[1].replace(os.sep, '.')[1:] |
49 self.package = os.path.splitdrive(self.packagePath)[1].replace(os.sep, '.')[1:] |
49 hasInit = True |
50 hasInit = True |
50 ppath = self.packagePath |
51 ppath = self.packagePath |
51 while hasInit: |
52 while hasInit: |
52 ppath = os.path.dirname(ppath) |
53 ppath = os.path.dirname(ppath) |
53 hasInit = len(glob.glob(os.path.join(ppath, '__init__.*'))) > 0 |
54 hasInit = len(glob.glob(os.path.join(ppath, '__init__.*'))) > 0 |
54 self.shortPackage = self.packagePath.replace(ppath, '').replace(os.sep, '.')[1:] |
55 self.shortPackage = self.packagePath.replace(ppath, '').replace(os.sep, '.')[1:] |
|
56 |
|
57 self.umlView.setPersistenceData("package={0}".format(self.packagePath)) |
55 |
58 |
56 pname = project.getProjectName() |
59 pname = project.getProjectName() |
57 if pname: |
60 if pname: |
58 name = self.trUtf8("Imports Diagramm {0}: {1}").format( |
61 name = self.trUtf8("Imports Diagramm {0}: {1}").format( |
59 pname, project.getRelativePath(self.packagePath)) |
62 pname, project.getRelativePath(self.packagePath)) |
224 @param y y-coordinate (float) |
227 @param y y-coordinate (float) |
225 """ |
228 """ |
226 classes.sort() |
229 classes.sort() |
227 impM = ModuleModel(name, classes) |
230 impM = ModuleModel(name, classes) |
228 impW = ModuleItem(impM, x, y, scene=self.scene) |
231 impW = ModuleItem(impM, x, y, scene=self.scene) |
|
232 impW.setId(self.umlView.getItemId()) |
229 return impW |
233 return impW |
230 |
234 |
231 def __createAssociations(self, shapes): |
235 def __createAssociations(self, shapes): |
232 """ |
236 """ |
233 Private method to generate the associations between the module shapes. |
237 Private method to generate the associations between the module shapes. |