657 packagePath = os.path.join(packagePath, name) |
657 packagePath = os.path.join(packagePath, name) |
658 if not os.path.exists(packagePath): |
658 if not os.path.exists(packagePath): |
659 try: |
659 try: |
660 os.mkdir(packagePath) |
660 os.mkdir(packagePath) |
661 except OSError as err: |
661 except OSError as err: |
662 E5MessageBox.critical(self, |
662 E5MessageBox.critical( |
|
663 self, |
663 self.trUtf8("Add new Python package"), |
664 self.trUtf8("Add new Python package"), |
664 self.trUtf8( |
665 self.trUtf8( |
665 """<p>The package directory <b>{0}</b> could""" |
666 """<p>The package directory <b>{0}</b> could""" |
666 """ not be created. Aborting...</p>""" |
667 """ not be created. Aborting...</p>""" |
667 """<p>Reason: {1}</p>""")\ |
668 """<p>Reason: {1}</p>""")\ |
671 if not os.path.exists(packageFile): |
672 if not os.path.exists(packageFile): |
672 try: |
673 try: |
673 f = open(packageFile, "w", encoding="utf-8") |
674 f = open(packageFile, "w", encoding="utf-8") |
674 f.close() |
675 f.close() |
675 except IOError as err: |
676 except IOError as err: |
676 E5MessageBox.critical(self, |
677 E5MessageBox.critical( |
|
678 self, |
677 self.trUtf8("Add new Python package"), |
679 self.trUtf8("Add new Python package"), |
678 self.trUtf8( |
680 self.trUtf8( |
679 """<p>The package file <b>{0}</b> could""" |
681 """<p>The package file <b>{0}</b> could""" |
680 """ not be created. Aborting...</p>""" |
682 """ not be created. Aborting...</p>""" |
681 """<p>Reason: {1}</p>""")\ |
683 """<p>Reason: {1}</p>""")\ |
895 itm = self.model().item(self.currentIndex()) |
897 itm = self.model().item(self.currentIndex()) |
896 try: |
898 try: |
897 fn = itm.fileName() |
899 fn = itm.fileName() |
898 except AttributeError: |
900 except AttributeError: |
899 fn = itm.dirName() |
901 fn = itm.dirName() |
900 res = E5MessageBox.yesNo(self, |
902 res = E5MessageBox.yesNo( |
|
903 self, |
901 self.trUtf8("Class Diagram"), |
904 self.trUtf8("Class Diagram"), |
902 self.trUtf8("""Include class attributes?"""), |
905 self.trUtf8("""Include class attributes?"""), |
903 yesDefault=True) |
906 yesDefault=True) |
904 from Graphics.UMLDialog import UMLDialog |
907 from Graphics.UMLDialog import UMLDialog |
905 self.classDiagram = UMLDialog(UMLDialog.ClassDiagram, self.project, fn, |
908 self.classDiagram = UMLDialog(UMLDialog.ClassDiagram, self.project, fn, |
914 try: |
917 try: |
915 fn = itm.fileName() |
918 fn = itm.fileName() |
916 except AttributeError: |
919 except AttributeError: |
917 fn = itm.dirName() |
920 fn = itm.dirName() |
918 package = os.path.isdir(fn) and fn or os.path.dirname(fn) |
921 package = os.path.isdir(fn) and fn or os.path.dirname(fn) |
919 res = E5MessageBox.yesNo(self, |
922 res = E5MessageBox.yesNo( |
|
923 self, |
920 self.trUtf8("Imports Diagram"), |
924 self.trUtf8("Imports Diagram"), |
921 self.trUtf8("""Include imports from external modules?""")) |
925 self.trUtf8("""Include imports from external modules?""")) |
922 from Graphics.UMLDialog import UMLDialog |
926 from Graphics.UMLDialog import UMLDialog |
923 self.importsDiagram = UMLDialog( |
927 self.importsDiagram = UMLDialog( |
924 UMLDialog.ImportsDiagram, self.project, package, |
928 UMLDialog.ImportsDiagram, self.project, package, |
933 try: |
937 try: |
934 fn = itm.fileName() |
938 fn = itm.fileName() |
935 except AttributeError: |
939 except AttributeError: |
936 fn = itm.dirName() |
940 fn = itm.dirName() |
937 package = os.path.isdir(fn) and fn or os.path.dirname(fn) |
941 package = os.path.isdir(fn) and fn or os.path.dirname(fn) |
938 res = E5MessageBox.yesNo(self, |
942 res = E5MessageBox.yesNo( |
|
943 self, |
939 self.trUtf8("Package Diagram"), |
944 self.trUtf8("Package Diagram"), |
940 self.trUtf8("""Include class attributes?"""), |
945 self.trUtf8("""Include class attributes?"""), |
941 yesDefault=True) |
946 yesDefault=True) |
942 from Graphics.UMLDialog import UMLDialog |
947 from Graphics.UMLDialog import UMLDialog |
943 self.packageDiagram = UMLDialog( |
948 self.packageDiagram = UMLDialog( |
947 |
952 |
948 def __showApplicationDiagram(self): |
953 def __showApplicationDiagram(self): |
949 """ |
954 """ |
950 Private method to handle the application diagram context menu action. |
955 Private method to handle the application diagram context menu action. |
951 """ |
956 """ |
952 res = E5MessageBox.yesNo(self, |
957 res = E5MessageBox.yesNo( |
|
958 self, |
953 self.trUtf8("Application Diagram"), |
959 self.trUtf8("Application Diagram"), |
954 self.trUtf8("""Include module names?"""), |
960 self.trUtf8("""Include module names?"""), |
955 yesDefault=True) |
961 yesDefault=True) |
956 from Graphics.UMLDialog import UMLDialog |
962 from Graphics.UMLDialog import UMLDialog |
957 self.applicationDiagram = UMLDialog( |
963 self.applicationDiagram = UMLDialog( |