121 self.tr('Code coverage...'), self.__showCodeCoverage) |
121 self.tr('Code coverage...'), self.__showCodeCoverage) |
122 self.profileMenuAction = self.menuShow.addAction( |
122 self.profileMenuAction = self.menuShow.addAction( |
123 self.tr('Profile data...'), self.__showProfileData) |
123 self.tr('Profile data...'), self.__showProfileData) |
124 self.menuShow.aboutToShow.connect(self.__showContextMenuShow) |
124 self.menuShow.aboutToShow.connect(self.__showContextMenuShow) |
125 |
125 |
|
126 # TODO: differentiate between file and directory/package |
126 self.graphicsMenu = QMenu(self.tr('Diagrams')) |
127 self.graphicsMenu = QMenu(self.tr('Diagrams')) |
127 self.classDiagramAction = self.graphicsMenu.addAction( |
128 self.classDiagramAction = self.graphicsMenu.addAction( |
128 self.tr("Class Diagram..."), self.__showClassDiagram) |
129 self.tr("Class Diagram..."), self.__showClassDiagram) |
129 self.graphicsMenu.addAction( |
130 self.graphicsMenu.addAction( |
130 self.tr("Package Diagram..."), self.__showPackageDiagram) |
131 self.tr("Package Diagram..."), self.__showPackageDiagram) |
1075 res = E5MessageBox.yesNo( |
1076 res = E5MessageBox.yesNo( |
1076 self, |
1077 self, |
1077 self.tr("Class Diagram"), |
1078 self.tr("Class Diagram"), |
1078 self.tr("""Include class attributes?"""), |
1079 self.tr("""Include class attributes?"""), |
1079 yesDefault=True) |
1080 yesDefault=True) |
1080 from Graphics.UMLDialog import UMLDialog |
1081 |
1081 self.classDiagram = UMLDialog(UMLDialog.ClassDiagram, self.project, fn, |
1082 from Graphics.UMLDialog import UMLDialog, UMLDialogType |
1082 self, noAttrs=not res) |
1083 self.classDiagram = UMLDialog( |
|
1084 UMLDialogType.CLASS_DIAGRAM, self.project, fn, |
|
1085 self, noAttrs=not res) |
1083 self.classDiagram.show() |
1086 self.classDiagram.show() |
1084 |
1087 |
1085 def __showImportsDiagram(self): |
1088 def __showImportsDiagram(self): |
1086 """ |
1089 """ |
1087 Private method to handle the imports diagram context menu action. |
1090 Private method to handle the imports diagram context menu action. |
1094 package = os.path.isdir(fn) and fn or os.path.dirname(fn) |
1097 package = os.path.isdir(fn) and fn or os.path.dirname(fn) |
1095 res = E5MessageBox.yesNo( |
1098 res = E5MessageBox.yesNo( |
1096 self, |
1099 self, |
1097 self.tr("Imports Diagram"), |
1100 self.tr("Imports Diagram"), |
1098 self.tr("""Include imports from external modules?""")) |
1101 self.tr("""Include imports from external modules?""")) |
1099 from Graphics.UMLDialog import UMLDialog |
1102 |
|
1103 from Graphics.UMLDialog import UMLDialog, UMLDialogType |
1100 self.importsDiagram = UMLDialog( |
1104 self.importsDiagram = UMLDialog( |
1101 UMLDialog.ImportsDiagram, self.project, package, |
1105 UMLDialogType.IMPORTS_DIAGRAM, self.project, package, |
1102 self, showExternalImports=res) |
1106 self, showExternalImports=res) |
1103 self.importsDiagram.show() |
1107 self.importsDiagram.show() |
1104 |
1108 |
1105 def __showPackageDiagram(self): |
1109 def __showPackageDiagram(self): |
1106 """ |
1110 """ |
1115 res = E5MessageBox.yesNo( |
1119 res = E5MessageBox.yesNo( |
1116 self, |
1120 self, |
1117 self.tr("Package Diagram"), |
1121 self.tr("Package Diagram"), |
1118 self.tr("""Include class attributes?"""), |
1122 self.tr("""Include class attributes?"""), |
1119 yesDefault=True) |
1123 yesDefault=True) |
1120 from Graphics.UMLDialog import UMLDialog |
1124 |
|
1125 from Graphics.UMLDialog import UMLDialog, UMLDialogType |
1121 self.packageDiagram = UMLDialog( |
1126 self.packageDiagram = UMLDialog( |
1122 UMLDialog.PackageDiagram, self.project, package, |
1127 UMLDialogType.PACKAGE_DIAGRAM, self.project, package, |
1123 self, noAttrs=not res) |
1128 self, noAttrs=not res) |
1124 self.packageDiagram.show() |
1129 self.packageDiagram.show() |
1125 |
1130 |
1126 def __showApplicationDiagram(self): |
1131 def __showApplicationDiagram(self): |
1127 """ |
1132 """ |
1130 res = E5MessageBox.yesNo( |
1135 res = E5MessageBox.yesNo( |
1131 self, |
1136 self, |
1132 self.tr("Application Diagram"), |
1137 self.tr("Application Diagram"), |
1133 self.tr("""Include module names?"""), |
1138 self.tr("""Include module names?"""), |
1134 yesDefault=True) |
1139 yesDefault=True) |
1135 from Graphics.UMLDialog import UMLDialog |
1140 |
|
1141 from Graphics.UMLDialog import UMLDialog, UMLDialogType |
1136 self.applicationDiagram = UMLDialog( |
1142 self.applicationDiagram = UMLDialog( |
1137 UMLDialog.ApplicationDiagram, self.project, |
1143 UMLDialogType.APPLICATION_DIAGRAM, self.project, |
1138 self, noModules=not res) |
1144 self, noModules=not res) |
1139 self.applicationDiagram.show() |
1145 self.applicationDiagram.show() |
1140 |
1146 |
1141 def __loadDiagram(self): |
1147 def __loadDiagram(self): |
1142 """ |
1148 """ |
1143 Private slot to load a diagram from file. |
1149 Private slot to load a diagram from file. |
1144 """ |
1150 """ |
1145 from Graphics.UMLDialog import UMLDialog |
1151 from Graphics.UMLDialog import UMLDialog, UMLDialogType |
1146 self.loadedDiagram = None |
1152 self.loadedDiagram = None |
1147 loadedDiagram = UMLDialog( |
1153 loadedDiagram = UMLDialog( |
1148 UMLDialog.NoDiagram, self.project, parent=self) |
1154 UMLDialogType.NO_DIAGRAM, self.project, parent=self) |
1149 if loadedDiagram.load(): |
1155 if loadedDiagram.load(): |
1150 self.loadedDiagram = loadedDiagram |
1156 self.loadedDiagram = loadedDiagram |
1151 self.loadedDiagram.show(fromFile=True) |
1157 self.loadedDiagram.show(fromFile=True) |