3456:96232974dcdb | 3484:645c12de6b0c |
---|---|
7 Module implementing the project management functionality. | 7 Module implementing the project management functionality. |
8 """ | 8 """ |
9 | 9 |
10 from __future__ import unicode_literals | 10 from __future__ import unicode_literals |
11 try: | 11 try: |
12 str = unicode # __IGNORE_WARNING__ | 12 str = unicode |
13 except (NameError): | 13 except NameError: |
14 pass | 14 pass |
15 | 15 |
16 import os | 16 import os |
17 import time | 17 import time |
18 import shutil | 18 import shutil |
19 import glob | 19 import glob |
20 import fnmatch | 20 import fnmatch |
21 import copy | 21 import copy |
22 import zipfile | 22 import zipfile |
23 | 23 |
24 from PyQt4.QtCore import QFile, QFileInfo, pyqtSignal, QCryptographicHash, \ | 24 from PyQt4.QtCore import pyqtSlot, QFile, QFileInfo, pyqtSignal, \ |
25 QIODevice, QByteArray, QObject, Qt | 25 QCryptographicHash, QIODevice, QByteArray, QObject, Qt |
26 from PyQt4.QtGui import QCursor, QLineEdit, QToolBar, QDialog, QInputDialog, \ | 26 from PyQt4.QtGui import QCursor, QLineEdit, QToolBar, QDialog, QInputDialog, \ |
27 QApplication, QMenu, QAction | 27 QApplication, QMenu, QAction |
28 from PyQt4.Qsci import QsciScintilla | 28 from PyQt4.Qsci import QsciScintilla |
29 | 29 |
30 from E5Gui.E5Application import e5App | 30 from E5Gui.E5Application import e5App |
176 | 176 |
177 self.__progLanguages = [ | 177 self.__progLanguages = [ |
178 "Python2", | 178 "Python2", |
179 "Python3", | 179 "Python3", |
180 "Ruby", | 180 "Ruby", |
181 "JavaScript", | |
181 ] | 182 ] |
182 | 183 |
183 self.sourceExtensions = { | 184 self.sourceExtensions = { |
184 "Python2": Preferences.getPython("PythonExtensions"), | 185 "Python2": Preferences.getPython("PythonExtensions"), |
185 "Python3": Preferences.getPython("Python3Extensions"), | 186 "Python3": Preferences.getPython("Python3Extensions"), |
186 "Ruby": ['.rb'], | 187 "Ruby": ['.rb'], |
187 "Mixed": Preferences.getPython("Python3Extensions") + ['.rb'], | 188 "JavaScript": ['.js'], |
189 "Mixed": (Preferences.getPython("Python3Extensions") + | |
190 ['.rb', '.js']), | |
188 } | 191 } |
189 | 192 |
190 self.dbgFilters = { | 193 self.dbgFilters = { |
191 "Python2": self.trUtf8( | 194 "Python2": self.tr( |
192 "Python2 Files (*.py2);;" | 195 "Python2 Files (*.py2);;" |
193 "Python2 GUI Files (*.pyw2);;"), | 196 "Python2 GUI Files (*.pyw2);;"), |
194 "Python3": self.trUtf8( | 197 "Python3": self.tr( |
195 "Python3 Files (*.py *.py3);;" | 198 "Python3 Files (*.py *.py3);;" |
196 "Python3 GUI Files (*.pyw *.pyw3);;"), | 199 "Python3 GUI Files (*.pyw *.pyw3);;"), |
197 "Ruby": self.trUtf8("Ruby Files (*.rb);;"), | 200 "Ruby": self.tr("Ruby Files (*.rb);;"), |
198 } | 201 } |
199 | 202 |
200 self.vcsMenu = None | 203 self.vcsMenu = None |
201 | 204 |
202 self.__initProjectTypes() | 205 self.__initProjectTypes() |
235 self.__projectTypes = {} | 238 self.__projectTypes = {} |
236 self.__fileTypeCallbacks = {} | 239 self.__fileTypeCallbacks = {} |
237 self.__lexerAssociationCallbacks = {} | 240 self.__lexerAssociationCallbacks = {} |
238 self.__binaryTranslationsCallbacks = {} | 241 self.__binaryTranslationsCallbacks = {} |
239 | 242 |
240 self.__projectTypes["Qt4"] = self.trUtf8("Qt GUI") | 243 self.__projectTypes["Qt4"] = self.tr("Qt GUI") |
241 self.__projectTypes["Qt4C"] = self.trUtf8("Qt Console") | 244 self.__projectTypes["Qt4C"] = self.tr("Qt Console") |
242 self.__projectTypes["PyQt5"] = self.trUtf8("PyQt5 GUI") | 245 self.__projectTypes["PyQt5"] = self.tr("PyQt5 GUI") |
243 self.__projectTypes["PyQt5C"] = self.trUtf8("PyQt5 Console") | 246 self.__projectTypes["PyQt5C"] = self.tr("PyQt5 Console") |
244 self.__projectTypes["E4Plugin"] = self.trUtf8("Eric Plugin") | 247 self.__projectTypes["E4Plugin"] = self.tr("Eric Plugin") |
245 self.__projectTypes["Console"] = self.trUtf8("Console") | 248 self.__projectTypes["Console"] = self.tr("Console") |
246 self.__projectTypes["Other"] = self.trUtf8("Other") | 249 self.__projectTypes["Other"] = self.tr("Other") |
247 | 250 |
248 self.__projectProgLanguages = { | 251 self.__projectProgLanguages = { |
249 "Python2": ["Qt4", "Qt4C", "PyQt5", "PyQt5C", "E4Plugin", | 252 "Python2": ["Qt4", "Qt4C", "PyQt5", "PyQt5C", "E4Plugin", |
250 "Console", "Other"], | 253 "Console", "Other"], |
251 "Python3": ["Qt4", "Qt4C", "PyQt5", "PyQt5C", "E4Plugin", | 254 "Python3": ["Qt4", "Qt4C", "PyQt5", "PyQt5C", "E4Plugin", |
253 "Ruby": ["Qt4", "Qt4C", "Console", "Other"], | 256 "Ruby": ["Qt4", "Qt4C", "Console", "Other"], |
254 } | 257 } |
255 | 258 |
256 pyside2, pyside3 = Utilities.checkPyside() | 259 pyside2, pyside3 = Utilities.checkPyside() |
257 if pyside2 or pyside3: | 260 if pyside2 or pyside3: |
258 self.__projectTypes["PySide"] = self.trUtf8("PySide GUI") | 261 self.__projectTypes["PySide"] = self.tr("PySide GUI") |
259 self.__projectTypes["PySideC"] = self.trUtf8("PySide Console") | 262 self.__projectTypes["PySideC"] = self.tr("PySide Console") |
260 if pyside2: | 263 if pyside2: |
261 self.__projectProgLanguages["Python2"].extend( | 264 self.__projectProgLanguages["Python2"].extend( |
262 ["PySide", "PySideC"]) | 265 ["PySide", "PySideC"]) |
263 if pyside3: | 266 if pyside3: |
264 self.__projectProgLanguages["Python3"].extend( | 267 self.__projectProgLanguages["Python3"].extend( |
316 if progLanguages: | 319 if progLanguages: |
317 for progLanguage in progLanguages: | 320 for progLanguage in progLanguages: |
318 if progLanguage not in self.__projectProgLanguages: | 321 if progLanguage not in self.__projectProgLanguages: |
319 E5MessageBox.critical( | 322 E5MessageBox.critical( |
320 self.ui, | 323 self.ui, |
321 self.trUtf8("Registering Project Type"), | 324 self.tr("Registering Project Type"), |
322 self.trUtf8( | 325 self.tr( |
323 """<p>The Programming Language <b>{0}</b> is not""" | 326 """<p>The Programming Language <b>{0}</b> is not""" |
324 """ supported.</p>""") | 327 """ supported.</p>""") |
325 .format(progLanguage) | 328 .format(progLanguage) |
326 ) | 329 ) |
327 return | 330 return |
328 | 331 |
329 if type_ in self.__projectProgLanguages[progLanguage]: | 332 if type_ in self.__projectProgLanguages[progLanguage]: |
330 E5MessageBox.critical( | 333 E5MessageBox.critical( |
331 self.ui, | 334 self.ui, |
332 self.trUtf8("Registering Project Type"), | 335 self.tr("Registering Project Type"), |
333 self.trUtf8( | 336 self.tr( |
334 """<p>The Project type <b>{0}</b> is already""" | 337 """<p>The Project type <b>{0}</b> is already""" |
335 """ registered with Programming Language""" | 338 """ registered with Programming Language""" |
336 """ <b>{1}</b>.</p>""") | 339 """ <b>{1}</b>.</p>""") |
337 .format(type_, progLanguage) | 340 .format(type_, progLanguage) |
338 ) | 341 ) |
339 return | 342 return |
340 | 343 |
341 if type_ in self.__projectTypes: | 344 if type_ in self.__projectTypes: |
342 E5MessageBox.critical( | 345 E5MessageBox.critical( |
343 self.ui, | 346 self.ui, |
344 self.trUtf8("Registering Project Type"), | 347 self.tr("Registering Project Type"), |
345 self.trUtf8("""<p>The Project type <b>{0}</b> is already""" | 348 self.tr("""<p>The Project type <b>{0}</b> is already""" |
346 """ registered.</p>""").format(type_) | 349 """ registered.</p>""").format(type_) |
347 ) | 350 ) |
348 else: | 351 else: |
349 self.__projectTypes[type_] = description | 352 self.__projectTypes[type_] = description |
350 self.__fileTypeCallbacks[type_] = fileTypeCallback | 353 self.__fileTypeCallbacks[type_] = fileTypeCallback |
351 self.__lexerAssociationCallbacks[type_] = lexerAssociationCallback | 354 self.__lexerAssociationCallbacks[type_] = lexerAssociationCallback |
673 f.close() | 676 f.close() |
674 else: | 677 else: |
675 QApplication.restoreOverrideCursor() | 678 QApplication.restoreOverrideCursor() |
676 E5MessageBox.critical( | 679 E5MessageBox.critical( |
677 self.ui, | 680 self.ui, |
678 self.trUtf8("Read project file"), | 681 self.tr("Read project file"), |
679 self.trUtf8( | 682 self.tr( |
680 "<p>The project file <b>{0}</b> could not be read.</p>") | 683 "<p>The project file <b>{0}</b> could not be read.</p>") |
681 .format(fn)) | 684 .format(fn)) |
682 return False | 685 return False |
683 | 686 |
684 self.pfile = os.path.abspath(fn) | 687 self.pfile = os.path.abspath(fn) |
773 os.path.basename(fn))[0]).writeXML() | 776 os.path.basename(fn))[0]).writeXML() |
774 res = True | 777 res = True |
775 else: | 778 else: |
776 E5MessageBox.critical( | 779 E5MessageBox.critical( |
777 self.ui, | 780 self.ui, |
778 self.trUtf8("Save project file"), | 781 self.tr("Save project file"), |
779 self.trUtf8( | 782 self.tr( |
780 "<p>The project file <b>{0}</b> could not be" | 783 "<p>The project file <b>{0}</b> could not be" |
781 " written.</p>").format(fn)) | 784 " written.</p>").format(fn)) |
782 res = False | 785 res = False |
783 | 786 |
784 if res: | 787 if res: |
809 reader.readXML() | 812 reader.readXML() |
810 f.close() | 813 f.close() |
811 else: | 814 else: |
812 E5MessageBox.critical( | 815 E5MessageBox.critical( |
813 self.ui, | 816 self.ui, |
814 self.trUtf8("Read user project properties"), | 817 self.tr("Read user project properties"), |
815 self.trUtf8( | 818 self.tr( |
816 "<p>The user specific project properties file" | 819 "<p>The user specific project properties file" |
817 " <b>{0}</b> could not be read.</p>").format(fn)) | 820 " <b>{0}</b> could not be read.</p>").format(fn)) |
818 | 821 |
819 def __writeUserProperties(self): | 822 def __writeUserProperties(self): |
820 """ | 823 """ |
833 f, os.path.splitext(os.path.basename(fn))[0]).writeXML() | 836 f, os.path.splitext(os.path.basename(fn))[0]).writeXML() |
834 f.close() | 837 f.close() |
835 else: | 838 else: |
836 E5MessageBox.critical( | 839 E5MessageBox.critical( |
837 self.ui, | 840 self.ui, |
838 self.trUtf8("Save user project properties"), | 841 self.tr("Save user project properties"), |
839 self.trUtf8( | 842 self.tr( |
840 "<p>The user specific project properties file <b>{0}</b>" | 843 "<p>The user specific project properties file <b>{0}</b>" |
841 " could not be written.</p>").format(fn)) | 844 " could not be written.</p>").format(fn)) |
842 | 845 |
843 def __showContextMenuSession(self): | 846 def __showContextMenuSession(self): |
844 """ | 847 """ |
855 self.sessActGrp.findChild( | 858 self.sessActGrp.findChild( |
856 QAction, "project_load_session").setEnabled(enable) | 859 QAction, "project_load_session").setEnabled(enable) |
857 self.sessActGrp.findChild( | 860 self.sessActGrp.findChild( |
858 QAction, "project_delete_session").setEnabled(enable) | 861 QAction, "project_delete_session").setEnabled(enable) |
859 | 862 |
863 @pyqtSlot() | |
860 def __readSession(self, quiet=False, indicator=""): | 864 def __readSession(self, quiet=False, indicator=""): |
861 """ | 865 """ |
862 Private method to read in the project session file (.e4s). | 866 Private method to read in the project session file (.e4s). |
863 | 867 |
864 @param quiet flag indicating quiet operations. | 868 @param quiet flag indicating quiet operations. |
867 """ | 871 """ |
868 if self.pfile is None: | 872 if self.pfile is None: |
869 if not quiet: | 873 if not quiet: |
870 E5MessageBox.critical( | 874 E5MessageBox.critical( |
871 self.ui, | 875 self.ui, |
872 self.trUtf8("Read project session"), | 876 self.tr("Read project session"), |
873 self.trUtf8("Please save the project first.")) | 877 self.tr("Please save the project first.")) |
874 return | 878 return |
875 | 879 |
876 fn, ext = os.path.splitext(os.path.basename(self.pfile)) | 880 fn, ext = os.path.splitext(os.path.basename(self.pfile)) |
877 fn = os.path.join(self.getProjectManagementDir(), | 881 fn = os.path.join(self.getProjectManagementDir(), |
878 '{0}{1}.e4s'.format(fn, indicator)) | 882 '{0}{1}.e4s'.format(fn, indicator)) |
885 f.close() | 889 f.close() |
886 else: | 890 else: |
887 if not quiet: | 891 if not quiet: |
888 E5MessageBox.critical( | 892 E5MessageBox.critical( |
889 self.ui, | 893 self.ui, |
890 self.trUtf8("Read project session"), | 894 self.tr("Read project session"), |
891 self.trUtf8( | 895 self.tr( |
892 "<p>The project session file <b>{0}</b> could not be" | 896 "<p>The project session file <b>{0}</b> could not be" |
893 " read.</p>").format(fn)) | 897 " read.</p>").format(fn)) |
894 | 898 |
899 @pyqtSlot() | |
895 def __writeSession(self, quiet=False, indicator=""): | 900 def __writeSession(self, quiet=False, indicator=""): |
896 """ | 901 """ |
897 Private method to write the session data to an XML file (.e4s). | 902 Private method to write the session data to an XML file (.e4s). |
898 | 903 |
899 @param quiet flag indicating quiet operations. | 904 @param quiet flag indicating quiet operations. |
902 """ | 907 """ |
903 if self.pfile is None: | 908 if self.pfile is None: |
904 if not quiet: | 909 if not quiet: |
905 E5MessageBox.critical( | 910 E5MessageBox.critical( |
906 self.ui, | 911 self.ui, |
907 self.trUtf8("Save project session"), | 912 self.tr("Save project session"), |
908 self.trUtf8("Please save the project first.")) | 913 self.tr("Please save the project first.")) |
909 return | 914 return |
910 | 915 |
911 fn, ext = os.path.splitext(os.path.basename(self.pfile)) | 916 fn, ext = os.path.splitext(os.path.basename(self.pfile)) |
912 fn = os.path.join(self.getProjectManagementDir(), | 917 fn = os.path.join(self.getProjectManagementDir(), |
913 '{0}{1}.e4s'.format(fn, indicator)) | 918 '{0}{1}.e4s'.format(fn, indicator)) |
920 f.close() | 925 f.close() |
921 else: | 926 else: |
922 if not quiet: | 927 if not quiet: |
923 E5MessageBox.critical( | 928 E5MessageBox.critical( |
924 self.ui, | 929 self.ui, |
925 self.trUtf8("Save project session"), | 930 self.tr("Save project session"), |
926 self.trUtf8( | 931 self.tr( |
927 "<p>The project session file <b>{0}</b> could not be" | 932 "<p>The project session file <b>{0}</b> could not be" |
928 " written.</p>").format(fn)) | 933 " written.</p>").format(fn)) |
929 | 934 |
930 def __deleteSession(self): | 935 def __deleteSession(self): |
931 """ | 936 """ |
932 Private method to delete the session file. | 937 Private method to delete the session file. |
933 """ | 938 """ |
934 if self.pfile is None: | 939 if self.pfile is None: |
935 E5MessageBox.critical( | 940 E5MessageBox.critical( |
936 self.ui, | 941 self.ui, |
937 self.trUtf8("Delete project session"), | 942 self.tr("Delete project session"), |
938 self.trUtf8("Please save the project first.")) | 943 self.tr("Please save the project first.")) |
939 return | 944 return |
940 | 945 |
941 fname, ext = os.path.splitext(os.path.basename(self.pfile)) | 946 fname, ext = os.path.splitext(os.path.basename(self.pfile)) |
942 | 947 |
943 for fn in [os.path.join( | 948 for fn in [os.path.join( |
946 try: | 951 try: |
947 os.remove(fn) | 952 os.remove(fn) |
948 except OSError: | 953 except OSError: |
949 E5MessageBox.critical( | 954 E5MessageBox.critical( |
950 self.ui, | 955 self.ui, |
951 self.trUtf8("Delete project session"), | 956 self.tr("Delete project session"), |
952 self.trUtf8( | 957 self.tr( |
953 "<p>The project session file <b>{0}</b> could" | 958 "<p>The project session file <b>{0}</b> could" |
954 " not be deleted.</p>").format(fn)) | 959 " not be deleted.</p>").format(fn)) |
955 | 960 |
956 def __readTasks(self): | 961 def __readTasks(self): |
957 """ | 962 """ |
958 Private method to read in the project tasks file (.e4t). | 963 Private method to read in the project tasks file (.e4t). |
959 """ | 964 """ |
960 if self.pfile is None: | 965 if self.pfile is None: |
961 E5MessageBox.critical( | 966 E5MessageBox.critical( |
962 self.ui, | 967 self.ui, |
963 self.trUtf8("Read tasks"), | 968 self.tr("Read tasks"), |
964 self.trUtf8("Please save the project first.")) | 969 self.tr("Please save the project first.")) |
965 return | 970 return |
966 | 971 |
967 fn, ext = os.path.splitext(os.path.basename(self.pfile)) | 972 fn, ext = os.path.splitext(os.path.basename(self.pfile)) |
968 fn = os.path.join(self.getProjectManagementDir(), '{0}.e4t'.format(fn)) | 973 fn = os.path.join(self.getProjectManagementDir(), '{0}.e4t'.format(fn)) |
969 if not os.path.exists(fn): | 974 if not os.path.exists(fn): |
975 reader.readXML() | 980 reader.readXML() |
976 f.close() | 981 f.close() |
977 else: | 982 else: |
978 E5MessageBox.critical( | 983 E5MessageBox.critical( |
979 self.ui, | 984 self.ui, |
980 self.trUtf8("Read tasks"), | 985 self.tr("Read tasks"), |
981 self.trUtf8( | 986 self.tr( |
982 "<p>The tasks file <b>{0}</b> could not be read.</p>") | 987 "<p>The tasks file <b>{0}</b> could not be read.</p>") |
983 .format(fn)) | 988 .format(fn)) |
984 | 989 |
985 def writeTasks(self): | 990 def writeTasks(self): |
986 """ | 991 """ |
995 f = QFile(fn) | 1000 f = QFile(fn) |
996 ok = f.open(QIODevice.WriteOnly) | 1001 ok = f.open(QIODevice.WriteOnly) |
997 if not ok: | 1002 if not ok: |
998 E5MessageBox.critical( | 1003 E5MessageBox.critical( |
999 self.ui, | 1004 self.ui, |
1000 self.trUtf8("Save tasks"), | 1005 self.tr("Save tasks"), |
1001 self.trUtf8( | 1006 self.tr( |
1002 "<p>The tasks file <b>{0}</b> could not be written.</p>") | 1007 "<p>The tasks file <b>{0}</b> could not be written.</p>") |
1003 .format(fn)) | 1008 .format(fn)) |
1004 return | 1009 return |
1005 | 1010 |
1006 from E5XML.TasksWriter import TasksWriter | 1011 from E5XML.TasksWriter import TasksWriter |
1023 self.dbgActGrp.findChild( | 1028 self.dbgActGrp.findChild( |
1024 QAction, "project_debugger_properties_load").setEnabled(enable) | 1029 QAction, "project_debugger_properties_load").setEnabled(enable) |
1025 self.dbgActGrp.findChild( | 1030 self.dbgActGrp.findChild( |
1026 QAction, "project_debugger_properties_delete").setEnabled(enable) | 1031 QAction, "project_debugger_properties_delete").setEnabled(enable) |
1027 | 1032 |
1033 @pyqtSlot() | |
1028 def __readDebugProperties(self, quiet=False): | 1034 def __readDebugProperties(self, quiet=False): |
1029 """ | 1035 """ |
1030 Private method to read in the project debugger properties file (.e4d). | 1036 Private method to read in the project debugger properties file (.e4d). |
1031 | 1037 |
1032 @param quiet flag indicating quiet operations. | 1038 @param quiet flag indicating quiet operations. |
1034 """ | 1040 """ |
1035 if self.pfile is None: | 1041 if self.pfile is None: |
1036 if not quiet: | 1042 if not quiet: |
1037 E5MessageBox.critical( | 1043 E5MessageBox.critical( |
1038 self.ui, | 1044 self.ui, |
1039 self.trUtf8("Read debugger properties"), | 1045 self.tr("Read debugger properties"), |
1040 self.trUtf8("Please save the project first.")) | 1046 self.tr("Please save the project first.")) |
1041 return | 1047 return |
1042 | 1048 |
1043 fn, ext = os.path.splitext(os.path.basename(self.pfile)) | 1049 fn, ext = os.path.splitext(os.path.basename(self.pfile)) |
1044 fn = os.path.join(self.getProjectManagementDir(), '{0}.e4d'.format(fn)) | 1050 fn = os.path.join(self.getProjectManagementDir(), '{0}.e4d'.format(fn)) |
1045 | 1051 |
1051 f.close() | 1057 f.close() |
1052 else: | 1058 else: |
1053 if not quiet: | 1059 if not quiet: |
1054 E5MessageBox.critical( | 1060 E5MessageBox.critical( |
1055 self.ui, | 1061 self.ui, |
1056 self.trUtf8("Read debugger properties"), | 1062 self.tr("Read debugger properties"), |
1057 self.trUtf8( | 1063 self.tr( |
1058 "<p>The project debugger properties file <b>{0}</b>" | 1064 "<p>The project debugger properties file <b>{0}</b>" |
1059 " could not be read.</p>").format(fn)) | 1065 " could not be read.</p>").format(fn)) |
1060 | 1066 |
1067 @pyqtSlot() | |
1061 def __writeDebugProperties(self, quiet=False): | 1068 def __writeDebugProperties(self, quiet=False): |
1062 """ | 1069 """ |
1063 Private method to write the project debugger properties file (.e4d). | 1070 Private method to write the project debugger properties file (.e4d). |
1064 | 1071 |
1065 @param quiet flag indicating quiet operations. | 1072 @param quiet flag indicating quiet operations. |
1067 """ | 1074 """ |
1068 if self.pfile is None: | 1075 if self.pfile is None: |
1069 if not quiet: | 1076 if not quiet: |
1070 E5MessageBox.critical( | 1077 E5MessageBox.critical( |
1071 self.ui, | 1078 self.ui, |
1072 self.trUtf8("Save debugger properties"), | 1079 self.tr("Save debugger properties"), |
1073 self.trUtf8("Please save the project first.")) | 1080 self.tr("Please save the project first.")) |
1074 return | 1081 return |
1075 | 1082 |
1076 fn, ext = os.path.splitext(os.path.basename(self.pfile)) | 1083 fn, ext = os.path.splitext(os.path.basename(self.pfile)) |
1077 fn = os.path.join(self.getProjectManagementDir(), '{0}.e4d'.format(fn)) | 1084 fn = os.path.join(self.getProjectManagementDir(), '{0}.e4d'.format(fn)) |
1078 | 1085 |
1084 f.close() | 1091 f.close() |
1085 else: | 1092 else: |
1086 if not quiet: | 1093 if not quiet: |
1087 E5MessageBox.critical( | 1094 E5MessageBox.critical( |
1088 self.ui, | 1095 self.ui, |
1089 self.trUtf8("Save debugger properties"), | 1096 self.tr("Save debugger properties"), |
1090 self.trUtf8( | 1097 self.tr( |
1091 "<p>The project debugger properties file <b>{0}</b>" | 1098 "<p>The project debugger properties file <b>{0}</b>" |
1092 " could not be written.</p>").format(fn)) | 1099 " could not be written.</p>").format(fn)) |
1093 | 1100 |
1094 def __deleteDebugProperties(self): | 1101 def __deleteDebugProperties(self): |
1095 """ | 1102 """ |
1096 Private method to delete the project debugger properties file (.e4d). | 1103 Private method to delete the project debugger properties file (.e4d). |
1097 """ | 1104 """ |
1098 if self.pfile is None: | 1105 if self.pfile is None: |
1099 E5MessageBox.critical( | 1106 E5MessageBox.critical( |
1100 self.ui, | 1107 self.ui, |
1101 self.trUtf8("Delete debugger properties"), | 1108 self.tr("Delete debugger properties"), |
1102 self.trUtf8("Please save the project first.")) | 1109 self.tr("Please save the project first.")) |
1103 return | 1110 return |
1104 | 1111 |
1105 fname, ext = os.path.splitext(os.path.basename(self.pfile)) | 1112 fname, ext = os.path.splitext(os.path.basename(self.pfile)) |
1106 | 1113 |
1107 for fn in [os.path.join(self.getProjectManagementDir(), | 1114 for fn in [os.path.join(self.getProjectManagementDir(), |
1110 try: | 1117 try: |
1111 os.remove(fn) | 1118 os.remove(fn) |
1112 except OSError: | 1119 except OSError: |
1113 E5MessageBox.critical( | 1120 E5MessageBox.critical( |
1114 self.ui, | 1121 self.ui, |
1115 self.trUtf8("Delete debugger properties"), | 1122 self.tr("Delete debugger properties"), |
1116 self.trUtf8( | 1123 self.tr( |
1117 "<p>The project debugger properties file" | 1124 "<p>The project debugger properties file" |
1118 " <b>{0}</b> could not be deleted.</p>") | 1125 " <b>{0}</b> could not be deleted.</p>") |
1119 .format(fn)) | 1126 .format(fn)) |
1120 | 1127 |
1121 def __initDebugProperties(self): | 1128 def __initDebugProperties(self): |
1206 """ | 1213 """ |
1207 if len(self.pdata["TRANSLATIONPATTERN"]) == 0 or \ | 1214 if len(self.pdata["TRANSLATIONPATTERN"]) == 0 or \ |
1208 self.pdata["TRANSLATIONPATTERN"][0] == '': | 1215 self.pdata["TRANSLATIONPATTERN"][0] == '': |
1209 E5MessageBox.critical( | 1216 E5MessageBox.critical( |
1210 self.ui, | 1217 self.ui, |
1211 self.trUtf8("Add Language"), | 1218 self.tr("Add Language"), |
1212 self.trUtf8( | 1219 self.tr( |
1213 "You have to specify a translation pattern first.")) | 1220 "You have to specify a translation pattern first.")) |
1214 return | 1221 return |
1215 | 1222 |
1216 from .AddLanguageDialog import AddLanguageDialog | 1223 from .AddLanguageDialog import AddLanguageDialog |
1217 dlg = AddLanguageDialog(self.parent()) | 1224 dlg = AddLanguageDialog(self.parent()) |
1301 if os.path.exists(fn): | 1308 if os.path.exists(fn): |
1302 os.remove(fn) | 1309 os.remove(fn) |
1303 except IOError: | 1310 except IOError: |
1304 E5MessageBox.critical( | 1311 E5MessageBox.critical( |
1305 self.ui, | 1312 self.ui, |
1306 self.trUtf8("Delete translation"), | 1313 self.tr("Delete translation"), |
1307 self.trUtf8( | 1314 self.tr( |
1308 "<p>The selected translation file <b>{0}</b> could not be" | 1315 "<p>The selected translation file <b>{0}</b> could not be" |
1309 " deleted.</p>").format(langFile)) | 1316 " deleted.</p>").format(langFile)) |
1310 return | 1317 return |
1311 | 1318 |
1312 self.removeLanguageFile(langFile) | 1319 self.removeLanguageFile(langFile) |
1322 if os.path.exists(fn): | 1329 if os.path.exists(fn): |
1323 os.remove(fn) | 1330 os.remove(fn) |
1324 except IOError: | 1331 except IOError: |
1325 E5MessageBox.critical( | 1332 E5MessageBox.critical( |
1326 self.ui, | 1333 self.ui, |
1327 self.trUtf8("Delete translation"), | 1334 self.tr("Delete translation"), |
1328 self.trUtf8( | 1335 self.tr( |
1329 "<p>The selected translation file <b>{0}</b> could" | 1336 "<p>The selected translation file <b>{0}</b> could" |
1330 " not be deleted.</p>").format(qmFile)) | 1337 " not be deleted.</p>").format(qmFile)) |
1331 return | 1338 return |
1332 | 1339 |
1333 def appendFile(self, fn, isSourceFile=False, updateModel=True): | 1340 def appendFile(self, fn, isSourceFile=False, updateModel=True): |
1422 self.otherssubdirs.append(newdir) | 1429 self.otherssubdirs.append(newdir) |
1423 | 1430 |
1424 if dirty: | 1431 if dirty: |
1425 self.setDirty(True) | 1432 self.setDirty(True) |
1426 | 1433 |
1434 @pyqtSlot() | |
1427 def addFiles(self, filter=None, startdir=None): | 1435 def addFiles(self, filter=None, startdir=None): |
1428 """ | 1436 """ |
1429 Public slot used to add files to the project. | 1437 Public slot used to add files to the project. |
1430 | 1438 |
1431 @param filter filter to be used by the add file dialog | 1439 @param filter filter to be used by the add file dialog |
1447 os.makedirs(target) | 1455 os.makedirs(target) |
1448 | 1456 |
1449 if os.path.exists(targetfile): | 1457 if os.path.exists(targetfile): |
1450 res = E5MessageBox.yesNo( | 1458 res = E5MessageBox.yesNo( |
1451 self.ui, | 1459 self.ui, |
1452 self.trUtf8("Add file"), | 1460 self.tr("Add file"), |
1453 self.trUtf8( | 1461 self.tr( |
1454 "<p>The file <b>{0}</b> already" | 1462 "<p>The file <b>{0}</b> already" |
1455 " exists.</p><p>Overwrite it?</p>") | 1463 " exists.</p><p>Overwrite it?</p>") |
1456 .format(targetfile), | 1464 .format(targetfile), |
1457 icon=E5MessageBox.Warning) | 1465 icon=E5MessageBox.Warning) |
1458 if not res: | 1466 if not res: |
1460 | 1468 |
1461 shutil.copy(fn, target) | 1469 shutil.copy(fn, target) |
1462 except IOError as why: | 1470 except IOError as why: |
1463 E5MessageBox.critical( | 1471 E5MessageBox.critical( |
1464 self.ui, | 1472 self.ui, |
1465 self.trUtf8("Add file"), | 1473 self.tr("Add file"), |
1466 self.trUtf8( | 1474 self.tr( |
1467 "<p>The selected file <b>{0}</b> could" | 1475 "<p>The selected file <b>{0}</b> could" |
1468 " not be added to <b>{1}</b>.</p>" | 1476 " not be added to <b>{1}</b>.</p>" |
1469 "<p>Reason: {2}</p>") | 1477 "<p>Reason: {2}</p>") |
1470 .format(fn, target, str(why))) | 1478 .format(fn, target, str(why))) |
1471 continue | 1479 continue |
1472 | 1480 |
1473 self.appendFile(targetfile, isSource or filter == 'source') | 1481 self.appendFile(targetfile, isSource or filter == 'source') |
1474 else: | 1482 else: |
1475 E5MessageBox.critical( | 1483 E5MessageBox.critical( |
1476 self.ui, | 1484 self.ui, |
1477 self.trUtf8("Add file"), | 1485 self.tr("Add file"), |
1478 self.trUtf8("The target directory must not be empty.")) | 1486 self.tr("The target directory must not be empty.")) |
1479 | 1487 |
1480 def __addSingleDirectory(self, filetype, source, target, quiet=False): | 1488 def __addSingleDirectory(self, filetype, source, target, quiet=False): |
1481 """ | 1489 """ |
1482 Private method used to add all files of a single directory to the | 1490 Private method used to add all files of a single directory to the |
1483 project. | 1491 project. |
1503 | 1511 |
1504 if len(files) == 0: | 1512 if len(files) == 0: |
1505 if not quiet: | 1513 if not quiet: |
1506 E5MessageBox.information( | 1514 E5MessageBox.information( |
1507 self.ui, | 1515 self.ui, |
1508 self.trUtf8("Add directory"), | 1516 self.tr("Add directory"), |
1509 self.trUtf8( | 1517 self.tr( |
1510 "<p>The source directory doesn't contain" | 1518 "<p>The source directory doesn't contain" |
1511 " any files belonging to the selected category.</p>")) | 1519 " any files belonging to the selected category.</p>")) |
1512 return | 1520 return |
1513 | 1521 |
1514 if not Utilities.samepath(target, source) and \ | 1522 if not Utilities.samepath(target, source) and \ |
1516 try: | 1524 try: |
1517 os.makedirs(target) | 1525 os.makedirs(target) |
1518 except IOError as why: | 1526 except IOError as why: |
1519 E5MessageBox.critical( | 1527 E5MessageBox.critical( |
1520 self.ui, | 1528 self.ui, |
1521 self.trUtf8("Add directory"), | 1529 self.tr("Add directory"), |
1522 self.trUtf8( | 1530 self.tr( |
1523 "<p>The target directory <b>{0}</b> could not be" | 1531 "<p>The target directory <b>{0}</b> could not be" |
1524 " created.</p><p>Reason: {1}</p>") | 1532 " created.</p><p>Reason: {1}</p>") |
1525 .format(target, str(why))) | 1533 .format(target, str(why))) |
1526 return | 1534 return |
1527 | 1535 |
1534 if not Utilities.samepath(target, source): | 1542 if not Utilities.samepath(target, source): |
1535 try: | 1543 try: |
1536 if os.path.exists(targetfile): | 1544 if os.path.exists(targetfile): |
1537 res = E5MessageBox.yesNo( | 1545 res = E5MessageBox.yesNo( |
1538 self.ui, | 1546 self.ui, |
1539 self.trUtf8("Add directory"), | 1547 self.tr("Add directory"), |
1540 self.trUtf8( | 1548 self.tr( |
1541 "<p>The file <b>{0}</b> already exists.</p>" | 1549 "<p>The file <b>{0}</b> already exists.</p>" |
1542 "<p>Overwrite it?</p>") | 1550 "<p>Overwrite it?</p>") |
1543 .format(targetfile), | 1551 .format(targetfile), |
1544 icon=E5MessageBox.Warning) | 1552 icon=E5MessageBox.Warning) |
1545 if not res: | 1553 if not res: |
1570 ns = os.path.join(source, name) | 1578 ns = os.path.join(source, name) |
1571 if os.path.isdir(ns): | 1579 if os.path.isdir(ns): |
1572 nt = os.path.join(target, name) | 1580 nt = os.path.join(target, name) |
1573 self.__addRecursiveDirectory(filetype, ns, nt) | 1581 self.__addRecursiveDirectory(filetype, ns, nt) |
1574 | 1582 |
1583 @pyqtSlot() | |
1575 def addDirectory(self, filter=None, startdir=None): | 1584 def addDirectory(self, filter=None, startdir=None): |
1576 """ | 1585 """ |
1577 Public method used to add all files of a directory to the project. | 1586 Public method used to add all files of a directory to the project. |
1578 | 1587 |
1579 @param filter filter to be used by the add directory dialog | 1588 @param filter filter to be used by the add directory dialog |
1588 if dlg.exec_() == QDialog.Accepted: | 1597 if dlg.exec_() == QDialog.Accepted: |
1589 filetype, source, target, recursive = dlg.getData() | 1598 filetype, source, target, recursive = dlg.getData() |
1590 if target == '': | 1599 if target == '': |
1591 E5MessageBox.critical( | 1600 E5MessageBox.critical( |
1592 self.ui, | 1601 self.ui, |
1593 self.trUtf8("Add directory"), | 1602 self.tr("Add directory"), |
1594 self.trUtf8("The target directory must not be empty.")) | 1603 self.tr("The target directory must not be empty.")) |
1595 return | 1604 return |
1596 | 1605 |
1597 if filetype == 'OTHERS': | 1606 if filetype == 'OTHERS': |
1598 self.addToOthers(source) | 1607 self.addToOthers(source) |
1599 return | 1608 return |
1600 | 1609 |
1601 if source == '': | 1610 if source == '': |
1602 E5MessageBox.critical( | 1611 E5MessageBox.critical( |
1603 self.ui, | 1612 self.ui, |
1604 self.trUtf8("Add directory"), | 1613 self.tr("Add directory"), |
1605 self.trUtf8("The source directory must not be empty.")) | 1614 self.tr("The source directory must not be empty.")) |
1606 return | 1615 return |
1607 | 1616 |
1608 if recursive: | 1617 if recursive: |
1609 self.__addRecursiveDirectory(filetype, source, target) | 1618 self.__addRecursiveDirectory(filetype, source, target) |
1610 else: | 1619 else: |
1723 isSourceFile = fn in self.pdata["SOURCES"] | 1732 isSourceFile = fn in self.pdata["SOURCES"] |
1724 | 1733 |
1725 if newfn is None: | 1734 if newfn is None: |
1726 newfn = E5FileDialog.getSaveFileName( | 1735 newfn = E5FileDialog.getSaveFileName( |
1727 None, | 1736 None, |
1728 self.trUtf8("Rename file"), | 1737 self.tr("Rename file"), |
1729 oldfn, | 1738 oldfn, |
1730 "", | 1739 "", |
1731 E5FileDialog.Options(E5FileDialog.DontConfirmOverwrite)) | 1740 E5FileDialog.Options(E5FileDialog.DontConfirmOverwrite)) |
1732 if not newfn: | 1741 if not newfn: |
1733 return False | 1742 return False |
1734 newfn = Utilities.toNativeSeparators(newfn) | 1743 newfn = Utilities.toNativeSeparators(newfn) |
1735 | 1744 |
1736 if os.path.exists(newfn): | 1745 if os.path.exists(newfn): |
1737 res = E5MessageBox.yesNo( | 1746 res = E5MessageBox.yesNo( |
1738 self.ui, | 1747 self.ui, |
1739 self.trUtf8("Rename File"), | 1748 self.tr("Rename File"), |
1740 self.trUtf8("""<p>The file <b>{0}</b> already exists.""" | 1749 self.tr("""<p>The file <b>{0}</b> already exists.""" |
1741 """ Overwrite it?</p>""") | 1750 """ Overwrite it?</p>""") |
1742 .format(newfn), | 1751 .format(newfn), |
1743 icon=E5MessageBox.Warning) | 1752 icon=E5MessageBox.Warning) |
1744 if not res: | 1753 if not res: |
1745 return False | 1754 return False |
1746 | 1755 |
1747 try: | 1756 try: |
1748 os.rename(oldfn, newfn) | 1757 os.rename(oldfn, newfn) |
1749 except OSError as msg: | 1758 except OSError as msg: |
1750 E5MessageBox.critical( | 1759 E5MessageBox.critical( |
1751 self.ui, | 1760 self.ui, |
1752 self.trUtf8("Rename File"), | 1761 self.tr("Rename File"), |
1753 self.trUtf8( | 1762 self.tr( |
1754 """<p>The file <b>{0}</b> could not be renamed.<br />""" | 1763 """<p>The file <b>{0}</b> could not be renamed.<br />""" |
1755 """Reason: {1}</p>""").format(oldfn, str(msg))) | 1764 """Reason: {1}</p>""").format(oldfn, str(msg))) |
1756 return False | 1765 return False |
1757 | 1766 |
1758 if fn in self.pdata["SOURCES"] or \ | 1767 if fn in self.pdata["SOURCES"] or \ |
1939 for f in glob.glob(pat): | 1948 for f in glob.glob(pat): |
1940 os.remove(f) | 1949 os.remove(f) |
1941 except EnvironmentError: | 1950 except EnvironmentError: |
1942 E5MessageBox.critical( | 1951 E5MessageBox.critical( |
1943 self.ui, | 1952 self.ui, |
1944 self.trUtf8("Delete file"), | 1953 self.tr("Delete file"), |
1945 self.trUtf8( | 1954 self.tr( |
1946 "<p>The selected file <b>{0}</b> could not be" | 1955 "<p>The selected file <b>{0}</b> could not be" |
1947 " deleted.</p>").format(fn)) | 1956 " deleted.</p>").format(fn)) |
1948 return False | 1957 return False |
1949 | 1958 |
1950 self.removeFile(fn) | 1959 self.removeFile(fn) |
1964 try: | 1973 try: |
1965 shutil.rmtree(dn, True) | 1974 shutil.rmtree(dn, True) |
1966 except EnvironmentError: | 1975 except EnvironmentError: |
1967 E5MessageBox.critical( | 1976 E5MessageBox.critical( |
1968 self.ui, | 1977 self.ui, |
1969 self.trUtf8("Delete directory"), | 1978 self.tr("Delete directory"), |
1970 self.trUtf8( | 1979 self.tr( |
1971 "<p>The selected directory <b>{0}</b> could not be" | 1980 "<p>The selected directory <b>{0}</b> could not be" |
1972 " deleted.</p>").format(dn)) | 1981 " deleted.</p>").format(dn)) |
1973 return False | 1982 return False |
1974 | 1983 |
1975 self.removeDirectory(dn) | 1984 self.removeDirectory(dn) |
2047 try: | 2056 try: |
2048 os.makedirs(self.ppath) | 2057 os.makedirs(self.ppath) |
2049 except EnvironmentError: | 2058 except EnvironmentError: |
2050 E5MessageBox.critical( | 2059 E5MessageBox.critical( |
2051 self.ui, | 2060 self.ui, |
2052 self.trUtf8("Create project directory"), | 2061 self.tr("Create project directory"), |
2053 self.trUtf8( | 2062 self.tr( |
2054 "<p>The project directory <b>{0}</b> could not" | 2063 "<p>The project directory <b>{0}</b> could not" |
2055 " be created.</p>") | 2064 " be created.</p>") |
2056 .format(self.ppath)) | 2065 .format(self.ppath)) |
2057 self.vcs = self.initVCS() | 2066 self.vcs = self.initVCS() |
2058 return | 2067 return |
2101 f = open(ms, "w") | 2110 f = open(ms, "w") |
2102 f.close() | 2111 f.close() |
2103 except IOError as err: | 2112 except IOError as err: |
2104 E5MessageBox.critical( | 2113 E5MessageBox.critical( |
2105 self.ui, | 2114 self.ui, |
2106 self.trUtf8("Create main script"), | 2115 self.tr("Create main script"), |
2107 self.trUtf8( | 2116 self.tr( |
2108 "<p>The mainscript <b>{0}</b> could not" | 2117 "<p>The mainscript <b>{0}</b> could not" |
2109 " be created.<br/>Reason: {1}</p>") | 2118 " be created.<br/>Reason: {1}</p>") |
2110 .format(self.ppath, str(err))) | 2119 .format(self.ppath, str(err))) |
2111 self.appendFile(ms) | 2120 self.appendFile(ms) |
2112 except IndexError: | 2121 except IndexError: |
2113 ms = "" | 2122 ms = "" |
2114 | 2123 |
2115 # add existing files to the project | 2124 # add existing files to the project |
2116 res = E5MessageBox.yesNo( | 2125 res = E5MessageBox.yesNo( |
2117 self.ui, | 2126 self.ui, |
2118 self.trUtf8("New Project"), | 2127 self.tr("New Project"), |
2119 self.trUtf8("""Add existing files to the project?"""), | 2128 self.tr("""Add existing files to the project?"""), |
2120 yesDefault=True) | 2129 yesDefault=True) |
2121 if res: | 2130 if res: |
2122 self.newProjectAddFiles(ms) | 2131 self.newProjectAddFiles(ms) |
2123 # create an empty __init__.py file to make it a Python package | 2132 # create an empty __init__.py file to make it a Python package |
2124 # if none exists (only for Python and Python3) | 2133 # if none exists (only for Python and Python3) |
2141 vcsList = [] | 2150 vcsList = [] |
2142 for vcsSystemStr, vcsSystemDisplay in vcsData: | 2151 for vcsSystemStr, vcsSystemDisplay in vcsData: |
2143 vcsList.append(vcsSystemDisplay) | 2152 vcsList.append(vcsSystemDisplay) |
2144 res, vcs_ok = QInputDialog.getItem( | 2153 res, vcs_ok = QInputDialog.getItem( |
2145 None, | 2154 None, |
2146 self.trUtf8("New Project"), | 2155 self.tr("New Project"), |
2147 self.trUtf8("Select Version Control System"), | 2156 self.tr("Select Version Control System"), |
2148 vcsList, | 2157 vcsList, |
2149 0, False) | 2158 0, False) |
2150 if vcs_ok: | 2159 if vcs_ok: |
2151 for vcsSystemStr, vcsSystemDisplay in vcsData: | 2160 for vcsSystemStr, vcsSystemDisplay in vcsData: |
2152 if res == vcsSystemDisplay: | 2161 if res == vcsSystemDisplay: |
2161 self.pdata["VCS"] = [vcsSystem] | 2170 self.pdata["VCS"] = [vcsSystem] |
2162 self.vcs = self.initVCS() | 2171 self.vcs = self.initVCS() |
2163 self.setDirty(True) | 2172 self.setDirty(True) |
2164 if self.vcs is not None: | 2173 if self.vcs is not None: |
2165 # edit VCS command options | 2174 # edit VCS command options |
2166 vcores = E5MessageBox.yesNo( | 2175 if self.vcs.vcsSupportCommandOptions(): |
2167 self.ui, | 2176 vcores = E5MessageBox.yesNo( |
2168 self.trUtf8("New Project"), | 2177 self.ui, |
2169 self.trUtf8( | 2178 self.tr("New Project"), |
2170 """Would you like to edit the VCS""" | 2179 self.tr( |
2171 """ command options?""")) | 2180 """Would you like to edit the VCS""" |
2181 """ command options?""")) | |
2182 else: | |
2183 vcores = False | |
2172 if vcores: | 2184 if vcores: |
2173 from VCS.CommandOptionsDialog import \ | 2185 from VCS.CommandOptionsDialog import \ |
2174 VcsCommandOptionsDialog | 2186 VcsCommandOptionsDialog |
2175 codlg = VcsCommandOptionsDialog(self.vcs) | 2187 codlg = VcsCommandOptionsDialog(self.vcs) |
2176 if codlg.exec_() == QDialog.Accepted: | 2188 if codlg.exec_() == QDialog.Accepted: |
2177 self.vcs.vcsSetOptions(codlg.getOptions()) | 2189 self.vcs.vcsSetOptions(codlg.getOptions()) |
2178 # add project file to repository | 2190 # add project file to repository |
2179 if res == 0: | 2191 if res == 0: |
2180 apres = E5MessageBox.yesNo( | 2192 apres = E5MessageBox.yesNo( |
2181 self.ui, | 2193 self.ui, |
2182 self.trUtf8("New project"), | 2194 self.tr("New project"), |
2183 self.trUtf8( | 2195 self.tr( |
2184 "Shall the project file be added" | 2196 "Shall the project file be added" |
2185 " to the repository?"), | 2197 " to the repository?"), |
2186 yesDefault=True) | 2198 yesDefault=True) |
2187 if apres: | 2199 if apres: |
2188 self.saveProject() | 2200 self.saveProject() |
2195 # put the project under VCS control | 2207 # put the project under VCS control |
2196 if self.vcs is None and self.vcsSoftwareAvailable() and \ | 2208 if self.vcs is None and self.vcsSoftwareAvailable() and \ |
2197 self.vcsRequested: | 2209 self.vcsRequested: |
2198 vcsSystemsDict = e5App().getObject("PluginManager")\ | 2210 vcsSystemsDict = e5App().getObject("PluginManager")\ |
2199 .getPluginDisplayStrings("version_control") | 2211 .getPluginDisplayStrings("version_control") |
2200 vcsSystemsDisplay = [self.trUtf8("None")] | 2212 vcsSystemsDisplay = [self.tr("None")] |
2201 keys = sorted(vcsSystemsDict.keys()) | 2213 keys = sorted(vcsSystemsDict.keys()) |
2202 for key in keys: | 2214 for key in keys: |
2203 vcsSystemsDisplay.append(vcsSystemsDict[key]) | 2215 vcsSystemsDisplay.append(vcsSystemsDict[key]) |
2204 vcsSelected, ok = QInputDialog.getItem( | 2216 vcsSelected, ok = QInputDialog.getItem( |
2205 None, | 2217 None, |
2206 self.trUtf8("New Project"), | 2218 self.tr("New Project"), |
2207 self.trUtf8( | 2219 self.tr( |
2208 "Select version control system for the project"), | 2220 "Select version control system for the project"), |
2209 vcsSystemsDisplay, | 2221 vcsSystemsDisplay, |
2210 0, False) | 2222 0, False) |
2211 if ok and vcsSelected != self.trUtf8("None"): | 2223 if ok and vcsSelected != self.tr("None"): |
2212 for vcsSystem, vcsSystemDisplay in vcsSystemsDict.items(): | 2224 for vcsSystem, vcsSystemDisplay in vcsSystemsDict.items(): |
2213 if vcsSystemDisplay == vcsSelected: | 2225 if vcsSystemDisplay == vcsSelected: |
2214 break | 2226 break |
2215 else: | 2227 else: |
2216 vcsSystem = "None" | 2228 vcsSystem = "None" |
2226 self.pdata["VCS"] = ['None'] | 2238 self.pdata["VCS"] = ['None'] |
2227 self.vcs = self.initVCS() | 2239 self.vcs = self.initVCS() |
2228 self.setDirty(True) | 2240 self.setDirty(True) |
2229 if self.vcs is not None: | 2241 if self.vcs is not None: |
2230 # edit VCS command options | 2242 # edit VCS command options |
2231 vcores = E5MessageBox.yesNo( | 2243 if self.vcs.vcsSupportCommandOptions(): |
2232 self.ui, | 2244 vcores = E5MessageBox.yesNo( |
2233 self.trUtf8("New Project"), | 2245 self.ui, |
2234 self.trUtf8( | 2246 self.tr("New Project"), |
2235 """Would you like to edit the VCS command""" | 2247 self.tr( |
2236 """ options?""")) | 2248 """Would you like to edit the VCS command""" |
2249 """ options?""")) | |
2250 else: | |
2251 vcores = False | |
2237 if vcores: | 2252 if vcores: |
2238 from VCS.CommandOptionsDialog import \ | 2253 from VCS.CommandOptionsDialog import \ |
2239 VcsCommandOptionsDialog | 2254 VcsCommandOptionsDialog |
2240 codlg = VcsCommandOptionsDialog(self.vcs) | 2255 codlg = VcsCommandOptionsDialog(self.vcs) |
2241 if codlg.exec_() == QDialog.Accepted: | 2256 if codlg.exec_() == QDialog.Accepted: |
2257 """ | 2272 """ |
2258 Public method to add files to a new project. | 2273 Public method to add files to a new project. |
2259 | 2274 |
2260 @param mainscript name of the mainscript (string) | 2275 @param mainscript name of the mainscript (string) |
2261 """ | 2276 """ |
2277 # Show the file type associations for the user to change | |
2278 self.__showFiletypeAssociations() | |
2279 | |
2262 QApplication.setOverrideCursor(QCursor(Qt.WaitCursor)) | 2280 QApplication.setOverrideCursor(QCursor(Qt.WaitCursor)) |
2263 QApplication.processEvents() | 2281 QApplication.processEvents() |
2264 | 2282 |
2265 # search the project directory for files with known extensions | 2283 # search the project directory for files with known extensions |
2266 filespecs = list(self.pdata["FILETYPES"].keys()) | 2284 filespecs = list(self.pdata["FILETYPES"].keys()) |
2301 os.path.basename(tslist[0]).split('_')[0], | 2319 os.path.basename(tslist[0]).split('_')[0], |
2302 os.path.splitext(tslist[0])[1]))] | 2320 os.path.splitext(tslist[0])[1]))] |
2303 else: | 2321 else: |
2304 pattern, ok = QInputDialog.getText( | 2322 pattern, ok = QInputDialog.getText( |
2305 None, | 2323 None, |
2306 self.trUtf8("Translation Pattern"), | 2324 self.tr("Translation Pattern"), |
2307 self.trUtf8( | 2325 self.tr( |
2308 "Enter the path pattern for translation files " | 2326 "Enter the path pattern for translation files " |
2309 "(use '%language%' in place of the language code):"), | 2327 "(use '%language%' in place of the language code):"), |
2310 QLineEdit.Normal, | 2328 QLineEdit.Normal, |
2311 tslist[0]) | 2329 tslist[0]) |
2312 if pattern: | 2330 if pattern: |
2477 pass | 2495 pass |
2478 | 2496 |
2479 # return empty string to signal to use the global setting | 2497 # return empty string to signal to use the global setting |
2480 return "" | 2498 return "" |
2481 | 2499 |
2500 @pyqtSlot() | |
2501 @pyqtSlot(str) | |
2482 def openProject(self, fn=None, restoreSession=True, reopen=False): | 2502 def openProject(self, fn=None, restoreSession=True, reopen=False): |
2483 """ | 2503 """ |
2484 Public slot to open a project. | 2504 Public slot to open a project. |
2485 | 2505 |
2486 @param fn optional filename of the project file to be read | 2506 @param fn optional filename of the project file to be read |
2492 return | 2512 return |
2493 | 2513 |
2494 if fn is None: | 2514 if fn is None: |
2495 fn = E5FileDialog.getOpenFileName( | 2515 fn = E5FileDialog.getOpenFileName( |
2496 self.parent(), | 2516 self.parent(), |
2497 self.trUtf8("Open project"), | 2517 self.tr("Open project"), |
2498 Preferences.getMultiProject("Workspace") or | 2518 Preferences.getMultiProject("Workspace") or |
2499 Utilities.getHomeDir(), | 2519 Utilities.getHomeDir(), |
2500 self.trUtf8("Project Files (*.e4p)")) | 2520 self.tr("Project Files (*.e4p)")) |
2501 | 2521 |
2502 QApplication.processEvents() | 2522 QApplication.processEvents() |
2503 | 2523 |
2504 if fn: | 2524 if fn: |
2505 if self.closeProject(): | 2525 if self.closeProject(): |
2539 vcsData: | 2559 vcsData: |
2540 vcsList.append(vcsSystemDisplay) | 2560 vcsList.append(vcsSystemDisplay) |
2541 QApplication.restoreOverrideCursor() | 2561 QApplication.restoreOverrideCursor() |
2542 res, vcs_ok = QInputDialog.getItem( | 2562 res, vcs_ok = QInputDialog.getItem( |
2543 None, | 2563 None, |
2544 self.trUtf8("New Project"), | 2564 self.tr("New Project"), |
2545 self.trUtf8( | 2565 self.tr( |
2546 "Select Version Control System"), | 2566 "Select Version Control System"), |
2547 vcsList, | 2567 vcsList, |
2548 0, False) | 2568 0, False) |
2549 QApplication.setOverrideCursor( | 2569 QApplication.setOverrideCursor( |
2550 QCursor(Qt.WaitCursor)) | 2570 QCursor(Qt.WaitCursor)) |
2664 """ | 2684 """ |
2665 Public slot to save the current project to a different file. | 2685 Public slot to save the current project to a different file. |
2666 | 2686 |
2667 @return flag indicating success (boolean) | 2687 @return flag indicating success (boolean) |
2668 """ | 2688 """ |
2669 defaultFilter = self.trUtf8("Project Files (*.e4p)") | 2689 defaultFilter = self.tr("Project Files (*.e4p)") |
2670 if self.ppath: | 2690 if self.ppath: |
2671 defaultPath = self.ppath | 2691 defaultPath = self.ppath |
2672 else: | 2692 else: |
2673 defaultPath = Preferences.getMultiProject("Workspace") or \ | 2693 defaultPath = Preferences.getMultiProject("Workspace") or \ |
2674 Utilities.getHomeDir() | 2694 Utilities.getHomeDir() |
2675 fn, selectedFilter = E5FileDialog.getSaveFileNameAndFilter( | 2695 fn, selectedFilter = E5FileDialog.getSaveFileNameAndFilter( |
2676 self.parent(), | 2696 self.parent(), |
2677 self.trUtf8("Save project as"), | 2697 self.tr("Save project as"), |
2678 defaultPath, | 2698 defaultPath, |
2679 self.trUtf8("Project Files (*.e4p)"), | 2699 self.tr("Project Files (*.e4p)"), |
2680 defaultFilter, | 2700 defaultFilter, |
2681 E5FileDialog.Options(E5FileDialog.DontConfirmOverwrite)) | 2701 E5FileDialog.Options(E5FileDialog.DontConfirmOverwrite)) |
2682 | 2702 |
2683 if fn: | 2703 if fn: |
2684 ext = QFileInfo(fn).suffix() | 2704 ext = QFileInfo(fn).suffix() |
2687 if ex: | 2707 if ex: |
2688 fn += ex | 2708 fn += ex |
2689 if QFileInfo(fn).exists(): | 2709 if QFileInfo(fn).exists(): |
2690 res = E5MessageBox.yesNo( | 2710 res = E5MessageBox.yesNo( |
2691 self.ui, | 2711 self.ui, |
2692 self.trUtf8("Save File"), | 2712 self.tr("Save File"), |
2693 self.trUtf8("""<p>The file <b>{0}</b> already exists.""" | 2713 self.tr("""<p>The file <b>{0}</b> already exists.""" |
2694 """ Overwrite it?</p>""").format(fn), | 2714 """ Overwrite it?</p>""").format(fn), |
2695 icon=E5MessageBox.Warning) | 2715 icon=E5MessageBox.Warning) |
2696 if not res: | 2716 if not res: |
2697 return False | 2717 return False |
2698 | 2718 |
2699 self.name = QFileInfo(fn).baseName() | 2719 self.name = QFileInfo(fn).baseName() |
2723 @return flag indicating whether this operation was successful (boolean) | 2743 @return flag indicating whether this operation was successful (boolean) |
2724 """ | 2744 """ |
2725 if self.isDirty(): | 2745 if self.isDirty(): |
2726 res = E5MessageBox.okToClearData( | 2746 res = E5MessageBox.okToClearData( |
2727 self.parent(), | 2747 self.parent(), |
2728 self.trUtf8("Close Project"), | 2748 self.tr("Close Project"), |
2729 self.trUtf8("The current project has unsaved changes."), | 2749 self.tr("The current project has unsaved changes."), |
2730 self.saveProject) | 2750 self.saveProject) |
2731 if res: | 2751 if res: |
2732 self.setDirty(False) | 2752 self.setDirty(False) |
2733 return res | 2753 return res |
2734 | 2754 |
2742 self.codecoverage and self.codecoverage.close() | 2762 self.codecoverage and self.codecoverage.close() |
2743 self.profiledata and self.profiledata.close() | 2763 self.profiledata and self.profiledata.close() |
2744 self.applicationDiagram and self.applicationDiagram.close() | 2764 self.applicationDiagram and self.applicationDiagram.close() |
2745 self.loadedDiagram and self.loadedDiagram.close() | 2765 self.loadedDiagram and self.loadedDiagram.close() |
2746 | 2766 |
2767 @pyqtSlot() | |
2747 def closeProject(self, reopen=False, noSave=False): | 2768 def closeProject(self, reopen=False, noSave=False): |
2748 """ | 2769 """ |
2749 Public slot to close the current project. | 2770 Public slot to close the current project. |
2750 | 2771 |
2751 @keyparam reopen flag indicating a reopening of the project (boolean) | 2772 @keyparam reopen flag indicating a reopening of the project (boolean) |
2853 filesWithSyntaxErrors += 1 | 2874 filesWithSyntaxErrors += 1 |
2854 | 2875 |
2855 if reportSyntaxErrors and filesWithSyntaxErrors > 0: | 2876 if reportSyntaxErrors and filesWithSyntaxErrors > 0: |
2856 E5MessageBox.critical( | 2877 E5MessageBox.critical( |
2857 self.ui, | 2878 self.ui, |
2858 self.trUtf8("Syntax errors detected"), | 2879 self.tr("Syntax errors detected"), |
2859 self.trUtf8( | 2880 self.tr( |
2860 """The project contains %n file(s) with syntax errors.""", | 2881 """The project contains %n file(s) with syntax errors.""", |
2861 "", filesWithSyntaxErrors) | 2882 "", filesWithSyntaxErrors) |
2862 ) | 2883 ) |
2863 return False | 2884 return False |
2864 else: | 2885 else: |
2885 filesWithSyntaxErrors += 1 | 2906 filesWithSyntaxErrors += 1 |
2886 | 2907 |
2887 if reportSyntaxErrors and filesWithSyntaxErrors > 0: | 2908 if reportSyntaxErrors and filesWithSyntaxErrors > 0: |
2888 E5MessageBox.critical( | 2909 E5MessageBox.critical( |
2889 self.ui, | 2910 self.ui, |
2890 self.trUtf8("Syntax errors detected"), | 2911 self.tr("Syntax errors detected"), |
2891 self.trUtf8( | 2912 self.tr( |
2892 """The project contains %n file(s) with syntax errors.""", | 2913 """The project contains %n file(s) with syntax errors.""", |
2893 "", filesWithSyntaxErrors) | 2914 "", filesWithSyntaxErrors) |
2894 ) | 2915 ) |
2895 return False | 2916 return False |
2896 else: | 2917 else: |
3261 self.actions = [] | 3282 self.actions = [] |
3262 | 3283 |
3263 self.actGrp1 = createActionGroup(self) | 3284 self.actGrp1 = createActionGroup(self) |
3264 | 3285 |
3265 act = E5Action( | 3286 act = E5Action( |
3266 self.trUtf8('New project'), | 3287 self.tr('New project'), |
3267 UI.PixmapCache.getIcon("projectNew.png"), | 3288 UI.PixmapCache.getIcon("projectNew.png"), |
3268 self.trUtf8('&New...'), 0, 0, | 3289 self.tr('&New...'), 0, 0, |
3269 self.actGrp1, 'project_new') | 3290 self.actGrp1, 'project_new') |
3270 act.setStatusTip(self.trUtf8('Generate a new project')) | 3291 act.setStatusTip(self.tr('Generate a new project')) |
3271 act.setWhatsThis(self.trUtf8( | 3292 act.setWhatsThis(self.tr( |
3272 """<b>New...</b>""" | 3293 """<b>New...</b>""" |
3273 """<p>This opens a dialog for entering the info for a""" | 3294 """<p>This opens a dialog for entering the info for a""" |
3274 """ new project.</p>""" | 3295 """ new project.</p>""" |
3275 )) | 3296 )) |
3276 act.triggered[()].connect(self.createNewProject) | 3297 act.triggered.connect(self.createNewProject) |
3277 self.actions.append(act) | 3298 self.actions.append(act) |
3278 | 3299 |
3279 act = E5Action( | 3300 act = E5Action( |
3280 self.trUtf8('Open project'), | 3301 self.tr('Open project'), |
3281 UI.PixmapCache.getIcon("projectOpen.png"), | 3302 UI.PixmapCache.getIcon("projectOpen.png"), |
3282 self.trUtf8('&Open...'), 0, 0, | 3303 self.tr('&Open...'), 0, 0, |
3283 self.actGrp1, 'project_open') | 3304 self.actGrp1, 'project_open') |
3284 act.setStatusTip(self.trUtf8('Open an existing project')) | 3305 act.setStatusTip(self.tr('Open an existing project')) |
3285 act.setWhatsThis(self.trUtf8( | 3306 act.setWhatsThis(self.tr( |
3286 """<b>Open...</b>""" | 3307 """<b>Open...</b>""" |
3287 """<p>This opens an existing project.</p>""" | 3308 """<p>This opens an existing project.</p>""" |
3288 )) | 3309 )) |
3289 act.triggered[()].connect(self.openProject) | 3310 act.triggered.connect(self.openProject) |
3290 self.actions.append(act) | 3311 self.actions.append(act) |
3291 | 3312 |
3292 self.closeAct = E5Action( | 3313 self.closeAct = E5Action( |
3293 self.trUtf8('Close project'), | 3314 self.tr('Close project'), |
3294 UI.PixmapCache.getIcon("projectClose.png"), | 3315 UI.PixmapCache.getIcon("projectClose.png"), |
3295 self.trUtf8('&Close'), 0, 0, self, 'project_close') | 3316 self.tr('&Close'), 0, 0, self, 'project_close') |
3296 self.closeAct.setStatusTip(self.trUtf8('Close the current project')) | 3317 self.closeAct.setStatusTip(self.tr('Close the current project')) |
3297 self.closeAct.setWhatsThis(self.trUtf8( | 3318 self.closeAct.setWhatsThis(self.tr( |
3298 """<b>Close</b>""" | 3319 """<b>Close</b>""" |
3299 """<p>This closes the current project.</p>""" | 3320 """<p>This closes the current project.</p>""" |
3300 )) | 3321 )) |
3301 self.closeAct.triggered[()].connect(self.closeProject) | 3322 self.closeAct.triggered.connect(self.closeProject) |
3302 self.actions.append(self.closeAct) | 3323 self.actions.append(self.closeAct) |
3303 | 3324 |
3304 self.saveAct = E5Action( | 3325 self.saveAct = E5Action( |
3305 self.trUtf8('Save project'), | 3326 self.tr('Save project'), |
3306 UI.PixmapCache.getIcon("projectSave.png"), | 3327 UI.PixmapCache.getIcon("projectSave.png"), |
3307 self.trUtf8('&Save'), 0, 0, self, 'project_save') | 3328 self.tr('&Save'), 0, 0, self, 'project_save') |
3308 self.saveAct.setStatusTip(self.trUtf8('Save the current project')) | 3329 self.saveAct.setStatusTip(self.tr('Save the current project')) |
3309 self.saveAct.setWhatsThis(self.trUtf8( | 3330 self.saveAct.setWhatsThis(self.tr( |
3310 """<b>Save</b>""" | 3331 """<b>Save</b>""" |
3311 """<p>This saves the current project.</p>""" | 3332 """<p>This saves the current project.</p>""" |
3312 )) | 3333 )) |
3313 self.saveAct.triggered[()].connect(self.saveProject) | 3334 self.saveAct.triggered.connect(self.saveProject) |
3314 self.actions.append(self.saveAct) | 3335 self.actions.append(self.saveAct) |
3315 | 3336 |
3316 self.saveasAct = E5Action( | 3337 self.saveasAct = E5Action( |
3317 self.trUtf8('Save project as'), | 3338 self.tr('Save project as'), |
3318 UI.PixmapCache.getIcon("projectSaveAs.png"), | 3339 UI.PixmapCache.getIcon("projectSaveAs.png"), |
3319 self.trUtf8('Save &as...'), 0, 0, self, 'project_save_as') | 3340 self.tr('Save &as...'), 0, 0, self, 'project_save_as') |
3320 self.saveasAct.setStatusTip(self.trUtf8( | 3341 self.saveasAct.setStatusTip(self.tr( |
3321 'Save the current project to a new file')) | 3342 'Save the current project to a new file')) |
3322 self.saveasAct.setWhatsThis(self.trUtf8( | 3343 self.saveasAct.setWhatsThis(self.tr( |
3323 """<b>Save as</b>""" | 3344 """<b>Save as</b>""" |
3324 """<p>This saves the current project to a new file.</p>""" | 3345 """<p>This saves the current project to a new file.</p>""" |
3325 )) | 3346 )) |
3326 self.saveasAct.triggered[()].connect(self.saveProjectAs) | 3347 self.saveasAct.triggered.connect(self.saveProjectAs) |
3327 self.actions.append(self.saveasAct) | 3348 self.actions.append(self.saveasAct) |
3328 | 3349 |
3329 self.actGrp2 = createActionGroup(self) | 3350 self.actGrp2 = createActionGroup(self) |
3330 | 3351 |
3331 self.addFilesAct = E5Action( | 3352 self.addFilesAct = E5Action( |
3332 self.trUtf8('Add files to project'), | 3353 self.tr('Add files to project'), |
3333 UI.PixmapCache.getIcon("fileMisc.png"), | 3354 UI.PixmapCache.getIcon("fileMisc.png"), |
3334 self.trUtf8('Add &files...'), 0, 0, | 3355 self.tr('Add &files...'), 0, 0, |
3335 self.actGrp2, 'project_add_file') | 3356 self.actGrp2, 'project_add_file') |
3336 self.addFilesAct.setStatusTip(self.trUtf8( | 3357 self.addFilesAct.setStatusTip(self.tr( |
3337 'Add files to the current project')) | 3358 'Add files to the current project')) |
3338 self.addFilesAct.setWhatsThis(self.trUtf8( | 3359 self.addFilesAct.setWhatsThis(self.tr( |
3339 """<b>Add files...</b>""" | 3360 """<b>Add files...</b>""" |
3340 """<p>This opens a dialog for adding files""" | 3361 """<p>This opens a dialog for adding files""" |
3341 """ to the current project. The place to add is""" | 3362 """ to the current project. The place to add is""" |
3342 """ determined by the file extension.</p>""" | 3363 """ determined by the file extension.</p>""" |
3343 )) | 3364 )) |
3344 self.addFilesAct.triggered[()].connect(self.addFiles) | 3365 self.addFilesAct.triggered.connect(self.addFiles) |
3345 self.actions.append(self.addFilesAct) | 3366 self.actions.append(self.addFilesAct) |
3346 | 3367 |
3347 self.addDirectoryAct = E5Action( | 3368 self.addDirectoryAct = E5Action( |
3348 self.trUtf8('Add directory to project'), | 3369 self.tr('Add directory to project'), |
3349 UI.PixmapCache.getIcon("dirOpen.png"), | 3370 UI.PixmapCache.getIcon("dirOpen.png"), |
3350 self.trUtf8('Add directory...'), 0, 0, | 3371 self.tr('Add directory...'), 0, 0, |
3351 self.actGrp2, 'project_add_directory') | 3372 self.actGrp2, 'project_add_directory') |
3352 self.addDirectoryAct.setStatusTip( | 3373 self.addDirectoryAct.setStatusTip( |
3353 self.trUtf8('Add a directory to the current project')) | 3374 self.tr('Add a directory to the current project')) |
3354 self.addDirectoryAct.setWhatsThis(self.trUtf8( | 3375 self.addDirectoryAct.setWhatsThis(self.tr( |
3355 """<b>Add directory...</b>""" | 3376 """<b>Add directory...</b>""" |
3356 """<p>This opens a dialog for adding a directory""" | 3377 """<p>This opens a dialog for adding a directory""" |
3357 """ to the current project.</p>""" | 3378 """ to the current project.</p>""" |
3358 )) | 3379 )) |
3359 self.addDirectoryAct.triggered[()].connect(self.addDirectory) | 3380 self.addDirectoryAct.triggered.connect(self.addDirectory) |
3360 self.actions.append(self.addDirectoryAct) | 3381 self.actions.append(self.addDirectoryAct) |
3361 | 3382 |
3362 self.addLanguageAct = E5Action( | 3383 self.addLanguageAct = E5Action( |
3363 self.trUtf8('Add translation to project'), | 3384 self.tr('Add translation to project'), |
3364 UI.PixmapCache.getIcon("linguist4.png"), | 3385 UI.PixmapCache.getIcon("linguist4.png"), |
3365 self.trUtf8('Add &translation...'), 0, 0, | 3386 self.tr('Add &translation...'), 0, 0, |
3366 self.actGrp2, 'project_add_translation') | 3387 self.actGrp2, 'project_add_translation') |
3367 self.addLanguageAct.setStatusTip( | 3388 self.addLanguageAct.setStatusTip( |
3368 self.trUtf8('Add a translation to the current project')) | 3389 self.tr('Add a translation to the current project')) |
3369 self.addLanguageAct.setWhatsThis(self.trUtf8( | 3390 self.addLanguageAct.setWhatsThis(self.tr( |
3370 """<b>Add translation...</b>""" | 3391 """<b>Add translation...</b>""" |
3371 """<p>This opens a dialog for add a translation""" | 3392 """<p>This opens a dialog for add a translation""" |
3372 """ to the current project.</p>""" | 3393 """ to the current project.</p>""" |
3373 )) | 3394 )) |
3374 self.addLanguageAct.triggered[()].connect(self.addLanguage) | 3395 self.addLanguageAct.triggered.connect(self.addLanguage) |
3375 self.actions.append(self.addLanguageAct) | 3396 self.actions.append(self.addLanguageAct) |
3376 | 3397 |
3377 act = E5Action( | 3398 act = E5Action( |
3378 self.trUtf8('Search new files'), | 3399 self.tr('Search new files'), |
3379 self.trUtf8('Searc&h new files...'), 0, 0, | 3400 self.tr('Searc&h new files...'), 0, 0, |
3380 self.actGrp2, 'project_search_new_files') | 3401 self.actGrp2, 'project_search_new_files') |
3381 act.setStatusTip(self.trUtf8( | 3402 act.setStatusTip(self.tr( |
3382 'Search new files in the project directory.')) | 3403 'Search new files in the project directory.')) |
3383 act.setWhatsThis(self.trUtf8( | 3404 act.setWhatsThis(self.tr( |
3384 """<b>Search new files...</b>""" | 3405 """<b>Search new files...</b>""" |
3385 """<p>This searches for new files (sources, *.ui, *.idl) in""" | 3406 """<p>This searches for new files (sources, *.ui, *.idl) in""" |
3386 """ the project directory and registered subdirectories.</p>""" | 3407 """ the project directory and registered subdirectories.</p>""" |
3387 )) | 3408 )) |
3388 act.triggered[()].connect(self.__searchNewFiles) | 3409 act.triggered.connect(self.__searchNewFiles) |
3389 self.actions.append(act) | 3410 self.actions.append(act) |
3390 | 3411 |
3391 self.propsAct = E5Action( | 3412 self.propsAct = E5Action( |
3392 self.trUtf8('Project properties'), | 3413 self.tr('Project properties'), |
3393 UI.PixmapCache.getIcon("projectProps.png"), | 3414 UI.PixmapCache.getIcon("projectProps.png"), |
3394 self.trUtf8('&Properties...'), 0, 0, self, | 3415 self.tr('&Properties...'), 0, 0, self, |
3395 'project_properties') | 3416 'project_properties') |
3396 self.propsAct.setStatusTip(self.trUtf8('Show the project properties')) | 3417 self.propsAct.setStatusTip(self.tr('Show the project properties')) |
3397 self.propsAct.setWhatsThis(self.trUtf8( | 3418 self.propsAct.setWhatsThis(self.tr( |
3398 """<b>Properties...</b>""" | 3419 """<b>Properties...</b>""" |
3399 """<p>This shows a dialog to edit the project properties.</p>""" | 3420 """<p>This shows a dialog to edit the project properties.</p>""" |
3400 )) | 3421 )) |
3401 self.propsAct.triggered[()].connect(self.__showProperties) | 3422 self.propsAct.triggered.connect(self.__showProperties) |
3402 self.actions.append(self.propsAct) | 3423 self.actions.append(self.propsAct) |
3403 | 3424 |
3404 self.userPropsAct = E5Action( | 3425 self.userPropsAct = E5Action( |
3405 self.trUtf8('User project properties'), | 3426 self.tr('User project properties'), |
3406 UI.PixmapCache.getIcon("projectUserProps.png"), | 3427 UI.PixmapCache.getIcon("projectUserProps.png"), |
3407 self.trUtf8('&User Properties...'), 0, 0, self, | 3428 self.tr('&User Properties...'), 0, 0, self, |
3408 'project_user_properties') | 3429 'project_user_properties') |
3409 self.userPropsAct.setStatusTip(self.trUtf8( | 3430 self.userPropsAct.setStatusTip(self.tr( |
3410 'Show the user specific project properties')) | 3431 'Show the user specific project properties')) |
3411 self.userPropsAct.setWhatsThis(self.trUtf8( | 3432 self.userPropsAct.setWhatsThis(self.tr( |
3412 """<b>User Properties...</b>""" | 3433 """<b>User Properties...</b>""" |
3413 """<p>This shows a dialog to edit the user specific project""" | 3434 """<p>This shows a dialog to edit the user specific project""" |
3414 """ properties.</p>""" | 3435 """ properties.</p>""" |
3415 )) | 3436 )) |
3416 self.userPropsAct.triggered[()].connect(self.__showUserProperties) | 3437 self.userPropsAct.triggered.connect(self.__showUserProperties) |
3417 self.actions.append(self.userPropsAct) | 3438 self.actions.append(self.userPropsAct) |
3418 | 3439 |
3419 self.filetypesAct = E5Action( | 3440 self.filetypesAct = E5Action( |
3420 self.trUtf8('Filetype Associations'), | 3441 self.tr('Filetype Associations'), |
3421 self.trUtf8('Filetype Associations...'), 0, 0, | 3442 self.tr('Filetype Associations...'), 0, 0, |
3422 self, 'project_filetype_associatios') | 3443 self, 'project_filetype_associatios') |
3423 self.filetypesAct.setStatusTip( | 3444 self.filetypesAct.setStatusTip( |
3424 self.trUtf8('Show the project filetype associations')) | 3445 self.tr('Show the project filetype associations')) |
3425 self.filetypesAct.setWhatsThis(self.trUtf8( | 3446 self.filetypesAct.setWhatsThis(self.tr( |
3426 """<b>Filetype Associations...</b>""" | 3447 """<b>Filetype Associations...</b>""" |
3427 """<p>This shows a dialog to edit the filetype associations of""" | 3448 """<p>This shows a dialog to edit the filetype associations of""" |
3428 """ the project. These associations determine the type""" | 3449 """ the project. These associations determine the type""" |
3429 """ (source, form, interface or others) with a filename""" | 3450 """ (source, form, interface or others) with a filename""" |
3430 """ pattern. They are used when adding a file to the project""" | 3451 """ pattern. They are used when adding a file to the project""" |
3431 """ and when performing a search for new files.</p>""" | 3452 """ and when performing a search for new files.</p>""" |
3432 )) | 3453 )) |
3433 self.filetypesAct.triggered[()].connect( | 3454 self.filetypesAct.triggered.connect( |
3434 self.__showFiletypeAssociations) | 3455 self.__showFiletypeAssociations) |
3435 self.actions.append(self.filetypesAct) | 3456 self.actions.append(self.filetypesAct) |
3436 | 3457 |
3437 self.lexersAct = E5Action( | 3458 self.lexersAct = E5Action( |
3438 self.trUtf8('Lexer Associations'), | 3459 self.tr('Lexer Associations'), |
3439 self.trUtf8('Lexer Associations...'), 0, 0, | 3460 self.tr('Lexer Associations...'), 0, 0, |
3440 self, 'project_lexer_associatios') | 3461 self, 'project_lexer_associatios') |
3441 self.lexersAct.setStatusTip(self.trUtf8( | 3462 self.lexersAct.setStatusTip(self.tr( |
3442 'Show the project lexer associations (overriding defaults)')) | 3463 'Show the project lexer associations (overriding defaults)')) |
3443 self.lexersAct.setWhatsThis(self.trUtf8( | 3464 self.lexersAct.setWhatsThis(self.tr( |
3444 """<b>Lexer Associations...</b>""" | 3465 """<b>Lexer Associations...</b>""" |
3445 """<p>This shows a dialog to edit the lexer associations of""" | 3466 """<p>This shows a dialog to edit the lexer associations of""" |
3446 """ the project. These associations override the global lexer""" | 3467 """ the project. These associations override the global lexer""" |
3447 """ associations. Lexers are used to highlight the editor""" | 3468 """ associations. Lexers are used to highlight the editor""" |
3448 """ text.</p>""" | 3469 """ text.</p>""" |
3449 )) | 3470 )) |
3450 self.lexersAct.triggered[()].connect(self.__showLexerAssociations) | 3471 self.lexersAct.triggered.connect(self.__showLexerAssociations) |
3451 self.actions.append(self.lexersAct) | 3472 self.actions.append(self.lexersAct) |
3452 | 3473 |
3453 self.dbgActGrp = createActionGroup(self) | 3474 self.dbgActGrp = createActionGroup(self) |
3454 | 3475 |
3455 act = E5Action( | 3476 act = E5Action( |
3456 self.trUtf8('Debugger Properties'), | 3477 self.tr('Debugger Properties'), |
3457 self.trUtf8('Debugger &Properties...'), 0, 0, | 3478 self.tr('Debugger &Properties...'), 0, 0, |
3458 self.dbgActGrp, 'project_debugger_properties') | 3479 self.dbgActGrp, 'project_debugger_properties') |
3459 act.setStatusTip(self.trUtf8('Show the debugger properties')) | 3480 act.setStatusTip(self.tr('Show the debugger properties')) |
3460 act.setWhatsThis(self.trUtf8( | 3481 act.setWhatsThis(self.tr( |
3461 """<b>Debugger Properties...</b>""" | 3482 """<b>Debugger Properties...</b>""" |
3462 """<p>This shows a dialog to edit project specific debugger""" | 3483 """<p>This shows a dialog to edit project specific debugger""" |
3463 """ settings.</p>""" | 3484 """ settings.</p>""" |
3464 )) | 3485 )) |
3465 act.triggered[()].connect(self.__showDebugProperties) | 3486 act.triggered.connect(self.__showDebugProperties) |
3466 self.actions.append(act) | 3487 self.actions.append(act) |
3467 | 3488 |
3468 act = E5Action( | 3489 act = E5Action( |
3469 self.trUtf8('Load'), | 3490 self.tr('Load'), |
3470 self.trUtf8('&Load'), 0, 0, | 3491 self.tr('&Load'), 0, 0, |
3471 self.dbgActGrp, 'project_debugger_properties_load') | 3492 self.dbgActGrp, 'project_debugger_properties_load') |
3472 act.setStatusTip(self.trUtf8('Load the debugger properties')) | 3493 act.setStatusTip(self.tr('Load the debugger properties')) |
3473 act.setWhatsThis(self.trUtf8( | 3494 act.setWhatsThis(self.tr( |
3474 """<b>Load Debugger Properties</b>""" | 3495 """<b>Load Debugger Properties</b>""" |
3475 """<p>This loads the project specific debugger settings.</p>""" | 3496 """<p>This loads the project specific debugger settings.</p>""" |
3476 )) | 3497 )) |
3477 act.triggered[()].connect(self.__readDebugProperties) | 3498 act.triggered.connect(self.__readDebugProperties) |
3478 self.actions.append(act) | 3499 self.actions.append(act) |
3479 | 3500 |
3480 act = E5Action( | 3501 act = E5Action( |
3481 self.trUtf8('Save'), | 3502 self.tr('Save'), |
3482 self.trUtf8('&Save'), 0, 0, | 3503 self.tr('&Save'), 0, 0, |
3483 self.dbgActGrp, 'project_debugger_properties_save') | 3504 self.dbgActGrp, 'project_debugger_properties_save') |
3484 act.setStatusTip(self.trUtf8('Save the debugger properties')) | 3505 act.setStatusTip(self.tr('Save the debugger properties')) |
3485 act.setWhatsThis(self.trUtf8( | 3506 act.setWhatsThis(self.tr( |
3486 """<b>Save Debugger Properties</b>""" | 3507 """<b>Save Debugger Properties</b>""" |
3487 """<p>This saves the project specific debugger settings.</p>""" | 3508 """<p>This saves the project specific debugger settings.</p>""" |
3488 )) | 3509 )) |
3489 act.triggered[()].connect(self.__writeDebugProperties) | 3510 act.triggered.connect(self.__writeDebugProperties) |
3490 self.actions.append(act) | 3511 self.actions.append(act) |
3491 | 3512 |
3492 act = E5Action( | 3513 act = E5Action( |
3493 self.trUtf8('Delete'), | 3514 self.tr('Delete'), |
3494 self.trUtf8('&Delete'), 0, 0, | 3515 self.tr('&Delete'), 0, 0, |
3495 self.dbgActGrp, 'project_debugger_properties_delete') | 3516 self.dbgActGrp, 'project_debugger_properties_delete') |
3496 act.setStatusTip(self.trUtf8('Delete the debugger properties')) | 3517 act.setStatusTip(self.tr('Delete the debugger properties')) |
3497 act.setWhatsThis(self.trUtf8( | 3518 act.setWhatsThis(self.tr( |
3498 """<b>Delete Debugger Properties</b>""" | 3519 """<b>Delete Debugger Properties</b>""" |
3499 """<p>This deletes the file containing the project specific""" | 3520 """<p>This deletes the file containing the project specific""" |
3500 """ debugger settings.</p>""" | 3521 """ debugger settings.</p>""" |
3501 )) | 3522 )) |
3502 act.triggered[()].connect(self.__deleteDebugProperties) | 3523 act.triggered.connect(self.__deleteDebugProperties) |
3503 self.actions.append(act) | 3524 self.actions.append(act) |
3504 | 3525 |
3505 act = E5Action( | 3526 act = E5Action( |
3506 self.trUtf8('Reset'), | 3527 self.tr('Reset'), |
3507 self.trUtf8('&Reset'), 0, 0, | 3528 self.tr('&Reset'), 0, 0, |
3508 self.dbgActGrp, 'project_debugger_properties_resets') | 3529 self.dbgActGrp, 'project_debugger_properties_resets') |
3509 act.setStatusTip(self.trUtf8('Reset the debugger properties')) | 3530 act.setStatusTip(self.tr('Reset the debugger properties')) |
3510 act.setWhatsThis(self.trUtf8( | 3531 act.setWhatsThis(self.tr( |
3511 """<b>Reset Debugger Properties</b>""" | 3532 """<b>Reset Debugger Properties</b>""" |
3512 """<p>This resets the project specific debugger settings.</p>""" | 3533 """<p>This resets the project specific debugger settings.</p>""" |
3513 )) | 3534 )) |
3514 act.triggered[()].connect(self.__initDebugProperties) | 3535 act.triggered.connect(self.__initDebugProperties) |
3515 self.actions.append(act) | 3536 self.actions.append(act) |
3516 | 3537 |
3517 self.sessActGrp = createActionGroup(self) | 3538 self.sessActGrp = createActionGroup(self) |
3518 | 3539 |
3519 act = E5Action( | 3540 act = E5Action( |
3520 self.trUtf8('Load session'), | 3541 self.tr('Load session'), |
3521 self.trUtf8('Load session'), 0, 0, | 3542 self.tr('Load session'), 0, 0, |
3522 self.sessActGrp, 'project_load_session') | 3543 self.sessActGrp, 'project_load_session') |
3523 act.setStatusTip(self.trUtf8('Load the projects session file.')) | 3544 act.setStatusTip(self.tr('Load the projects session file.')) |
3524 act.setWhatsThis(self.trUtf8( | 3545 act.setWhatsThis(self.tr( |
3525 """<b>Load session</b>""" | 3546 """<b>Load session</b>""" |
3526 """<p>This loads the projects session file. The session consists""" | 3547 """<p>This loads the projects session file. The session consists""" |
3527 """ of the following data.<br>""" | 3548 """ of the following data.<br>""" |
3528 """- all open source files<br>""" | 3549 """- all open source files<br>""" |
3529 """- all breakpoint<br>""" | 3550 """- all breakpoint<br>""" |
3530 """- the commandline arguments<br>""" | 3551 """- the commandline arguments<br>""" |
3531 """- the working directory<br>""" | 3552 """- the working directory<br>""" |
3532 """- the exception reporting flag</p>""" | 3553 """- the exception reporting flag</p>""" |
3533 )) | 3554 )) |
3534 act.triggered[()].connect(self.__readSession) | 3555 act.triggered.connect(self.__readSession) |
3535 self.actions.append(act) | 3556 self.actions.append(act) |
3536 | 3557 |
3537 act = E5Action( | 3558 act = E5Action( |
3538 self.trUtf8('Save session'), | 3559 self.tr('Save session'), |
3539 self.trUtf8('Save session'), 0, 0, | 3560 self.tr('Save session'), 0, 0, |
3540 self.sessActGrp, 'project_save_session') | 3561 self.sessActGrp, 'project_save_session') |
3541 act.setStatusTip(self.trUtf8('Save the projects session file.')) | 3562 act.setStatusTip(self.tr('Save the projects session file.')) |
3542 act.setWhatsThis(self.trUtf8( | 3563 act.setWhatsThis(self.tr( |
3543 """<b>Save session</b>""" | 3564 """<b>Save session</b>""" |
3544 """<p>This saves the projects session file. The session consists""" | 3565 """<p>This saves the projects session file. The session consists""" |
3545 """ of the following data.<br>""" | 3566 """ of the following data.<br>""" |
3546 """- all open source files<br>""" | 3567 """- all open source files<br>""" |
3547 """- all breakpoint<br>""" | 3568 """- all breakpoint<br>""" |
3548 """- the commandline arguments<br>""" | 3569 """- the commandline arguments<br>""" |
3549 """- the working directory<br>""" | 3570 """- the working directory<br>""" |
3550 """- the exception reporting flag</p>""" | 3571 """- the exception reporting flag</p>""" |
3551 )) | 3572 )) |
3552 act.triggered[()].connect(self.__writeSession) | 3573 act.triggered.connect(self.__writeSession) |
3553 self.actions.append(act) | 3574 self.actions.append(act) |
3554 | 3575 |
3555 act = E5Action( | 3576 act = E5Action( |
3556 self.trUtf8('Delete session'), | 3577 self.tr('Delete session'), |
3557 self.trUtf8('Delete session'), 0, 0, | 3578 self.tr('Delete session'), 0, 0, |
3558 self.sessActGrp, 'project_delete_session') | 3579 self.sessActGrp, 'project_delete_session') |
3559 act.setStatusTip(self.trUtf8('Delete the projects session file.')) | 3580 act.setStatusTip(self.tr('Delete the projects session file.')) |
3560 act.setWhatsThis(self.trUtf8( | 3581 act.setWhatsThis(self.tr( |
3561 """<b>Delete session</b>""" | 3582 """<b>Delete session</b>""" |
3562 """<p>This deletes the projects session file</p>""" | 3583 """<p>This deletes the projects session file</p>""" |
3563 )) | 3584 )) |
3564 act.triggered[()].connect(self.__deleteSession) | 3585 act.triggered.connect(self.__deleteSession) |
3565 self.actions.append(act) | 3586 self.actions.append(act) |
3566 | 3587 |
3567 self.chkGrp = createActionGroup(self) | 3588 self.chkGrp = createActionGroup(self) |
3568 | 3589 |
3569 self.codeMetricsAct = E5Action( | 3590 self.codeMetricsAct = E5Action( |
3570 self.trUtf8('Code Metrics'), | 3591 self.tr('Code Metrics'), |
3571 self.trUtf8('&Code Metrics...'), 0, 0, | 3592 self.tr('&Code Metrics...'), 0, 0, |
3572 self.chkGrp, 'project_code_metrics') | 3593 self.chkGrp, 'project_code_metrics') |
3573 self.codeMetricsAct.setStatusTip( | 3594 self.codeMetricsAct.setStatusTip( |
3574 self.trUtf8('Show some code metrics for the project.')) | 3595 self.tr('Show some code metrics for the project.')) |
3575 self.codeMetricsAct.setWhatsThis(self.trUtf8( | 3596 self.codeMetricsAct.setWhatsThis(self.tr( |
3576 """<b>Code Metrics...</b>""" | 3597 """<b>Code Metrics...</b>""" |
3577 """<p>This shows some code metrics for all Python files in""" | 3598 """<p>This shows some code metrics for all Python files in""" |
3578 """ the project.</p>""" | 3599 """ the project.</p>""" |
3579 )) | 3600 )) |
3580 self.codeMetricsAct.triggered[()].connect(self.__showCodeMetrics) | 3601 self.codeMetricsAct.triggered.connect(self.__showCodeMetrics) |
3581 self.actions.append(self.codeMetricsAct) | 3602 self.actions.append(self.codeMetricsAct) |
3582 | 3603 |
3583 self.codeCoverageAct = E5Action( | 3604 self.codeCoverageAct = E5Action( |
3584 self.trUtf8('Python Code Coverage'), | 3605 self.tr('Python Code Coverage'), |
3585 self.trUtf8('Code Co&verage...'), 0, 0, | 3606 self.tr('Code Co&verage...'), 0, 0, |
3586 self.chkGrp, 'project_code_coverage') | 3607 self.chkGrp, 'project_code_coverage') |
3587 self.codeCoverageAct.setStatusTip( | 3608 self.codeCoverageAct.setStatusTip( |
3588 self.trUtf8('Show code coverage information for the project.')) | 3609 self.tr('Show code coverage information for the project.')) |
3589 self.codeCoverageAct.setWhatsThis(self.trUtf8( | 3610 self.codeCoverageAct.setWhatsThis(self.tr( |
3590 """<b>Code Coverage...</b>""" | 3611 """<b>Code Coverage...</b>""" |
3591 """<p>This shows the code coverage information for all Python""" | 3612 """<p>This shows the code coverage information for all Python""" |
3592 """ files in the project.</p>""" | 3613 """ files in the project.</p>""" |
3593 )) | 3614 )) |
3594 self.codeCoverageAct.triggered[()].connect(self.__showCodeCoverage) | 3615 self.codeCoverageAct.triggered.connect(self.__showCodeCoverage) |
3595 self.actions.append(self.codeCoverageAct) | 3616 self.actions.append(self.codeCoverageAct) |
3596 | 3617 |
3597 self.codeProfileAct = E5Action( | 3618 self.codeProfileAct = E5Action( |
3598 self.trUtf8('Profile Data'), | 3619 self.tr('Profile Data'), |
3599 self.trUtf8('&Profile Data...'), 0, 0, | 3620 self.tr('&Profile Data...'), 0, 0, |
3600 self.chkGrp, 'project_profile_data') | 3621 self.chkGrp, 'project_profile_data') |
3601 self.codeProfileAct.setStatusTip( | 3622 self.codeProfileAct.setStatusTip( |
3602 self.trUtf8('Show profiling data for the project.')) | 3623 self.tr('Show profiling data for the project.')) |
3603 self.codeProfileAct.setWhatsThis(self.trUtf8( | 3624 self.codeProfileAct.setWhatsThis(self.tr( |
3604 """<b>Profile Data...</b>""" | 3625 """<b>Profile Data...</b>""" |
3605 """<p>This shows the profiling data for the project.</p>""" | 3626 """<p>This shows the profiling data for the project.</p>""" |
3606 )) | 3627 )) |
3607 self.codeProfileAct.triggered[()].connect(self.__showProfileData) | 3628 self.codeProfileAct.triggered.connect(self.__showProfileData) |
3608 self.actions.append(self.codeProfileAct) | 3629 self.actions.append(self.codeProfileAct) |
3609 | 3630 |
3610 self.graphicsGrp = createActionGroup(self) | 3631 self.graphicsGrp = createActionGroup(self) |
3611 | 3632 |
3612 self.applicationDiagramAct = E5Action( | 3633 self.applicationDiagramAct = E5Action( |
3613 self.trUtf8('Application Diagram'), | 3634 self.tr('Application Diagram'), |
3614 self.trUtf8('&Application Diagram...'), 0, 0, | 3635 self.tr('&Application Diagram...'), 0, 0, |
3615 self.graphicsGrp, 'project_application_diagram') | 3636 self.graphicsGrp, 'project_application_diagram') |
3616 self.applicationDiagramAct.setStatusTip( | 3637 self.applicationDiagramAct.setStatusTip( |
3617 self.trUtf8('Show a diagram of the project.')) | 3638 self.tr('Show a diagram of the project.')) |
3618 self.applicationDiagramAct.setWhatsThis(self.trUtf8( | 3639 self.applicationDiagramAct.setWhatsThis(self.tr( |
3619 """<b>Application Diagram...</b>""" | 3640 """<b>Application Diagram...</b>""" |
3620 """<p>This shows a diagram of the project.</p>""" | 3641 """<p>This shows a diagram of the project.</p>""" |
3621 )) | 3642 )) |
3622 self.applicationDiagramAct.triggered[()].connect( | 3643 self.applicationDiagramAct.triggered.connect( |
3623 self.handleApplicationDiagram) | 3644 self.handleApplicationDiagram) |
3624 self.actions.append(self.applicationDiagramAct) | 3645 self.actions.append(self.applicationDiagramAct) |
3625 | 3646 |
3626 self.loadDiagramAct = E5Action( | 3647 self.loadDiagramAct = E5Action( |
3627 self.trUtf8('Load Diagram'), | 3648 self.tr('Load Diagram'), |
3628 self.trUtf8('&Load Diagram...'), 0, 0, | 3649 self.tr('&Load Diagram...'), 0, 0, |
3629 self.graphicsGrp, 'project_load_diagram') | 3650 self.graphicsGrp, 'project_load_diagram') |
3630 self.loadDiagramAct.setStatusTip( | 3651 self.loadDiagramAct.setStatusTip( |
3631 self.trUtf8('Load a diagram from file.')) | 3652 self.tr('Load a diagram from file.')) |
3632 self.loadDiagramAct.setWhatsThis(self.trUtf8( | 3653 self.loadDiagramAct.setWhatsThis(self.tr( |
3633 """<b>Load Diagram...</b>""" | 3654 """<b>Load Diagram...</b>""" |
3634 """<p>This loads a diagram from file.</p>""" | 3655 """<p>This loads a diagram from file.</p>""" |
3635 )) | 3656 )) |
3636 self.loadDiagramAct.triggered[()].connect(self.__loadDiagram) | 3657 self.loadDiagramAct.triggered.connect(self.__loadDiagram) |
3637 self.actions.append(self.loadDiagramAct) | 3658 self.actions.append(self.loadDiagramAct) |
3638 | 3659 |
3639 self.pluginGrp = createActionGroup(self) | 3660 self.pluginGrp = createActionGroup(self) |
3640 | 3661 |
3641 self.pluginPkgListAct = E5Action( | 3662 self.pluginPkgListAct = E5Action( |
3642 self.trUtf8('Create Package List'), | 3663 self.tr('Create Package List'), |
3643 UI.PixmapCache.getIcon("pluginArchiveList.png"), | 3664 UI.PixmapCache.getIcon("pluginArchiveList.png"), |
3644 self.trUtf8('Create &Package List'), 0, 0, | 3665 self.tr('Create &Package List'), 0, 0, |
3645 self.pluginGrp, 'project_plugin_pkglist') | 3666 self.pluginGrp, 'project_plugin_pkglist') |
3646 self.pluginPkgListAct.setStatusTip( | 3667 self.pluginPkgListAct.setStatusTip( |
3647 self.trUtf8('Create an initial PKGLIST file for an eric5 plugin.')) | 3668 self.tr('Create an initial PKGLIST file for an eric5 plugin.')) |
3648 self.pluginPkgListAct.setWhatsThis(self.trUtf8( | 3669 self.pluginPkgListAct.setWhatsThis(self.tr( |
3649 """<b>Create Package List</b>""" | 3670 """<b>Create Package List</b>""" |
3650 """<p>This creates an initial list of files to include in an""" | 3671 """<p>This creates an initial list of files to include in an""" |
3651 """ eric5 plugin archive. The list is created from the project""" | 3672 """ eric5 plugin archive. The list is created from the project""" |
3652 """ file.</p>""" | 3673 """ file.</p>""" |
3653 )) | 3674 )) |
3654 self.pluginPkgListAct.triggered[()].connect(self.__pluginCreatePkgList) | 3675 self.pluginPkgListAct.triggered.connect(self.__pluginCreatePkgList) |
3655 self.actions.append(self.pluginPkgListAct) | 3676 self.actions.append(self.pluginPkgListAct) |
3656 | 3677 |
3657 self.pluginArchiveAct = E5Action( | 3678 self.pluginArchiveAct = E5Action( |
3658 self.trUtf8('Create Plugin Archive'), | 3679 self.tr('Create Plugin Archive'), |
3659 UI.PixmapCache.getIcon("pluginArchive.png"), | 3680 UI.PixmapCache.getIcon("pluginArchive.png"), |
3660 self.trUtf8('Create Plugin &Archive'), 0, 0, | 3681 self.tr('Create Plugin &Archive'), 0, 0, |
3661 self.pluginGrp, 'project_plugin_archive') | 3682 self.pluginGrp, 'project_plugin_archive') |
3662 self.pluginArchiveAct.setStatusTip( | 3683 self.pluginArchiveAct.setStatusTip( |
3663 self.trUtf8('Create an eric5 plugin archive file.')) | 3684 self.tr('Create an eric5 plugin archive file.')) |
3664 self.pluginArchiveAct.setWhatsThis(self.trUtf8( | 3685 self.pluginArchiveAct.setWhatsThis(self.tr( |
3665 """<b>Create Plugin Archive</b>""" | 3686 """<b>Create Plugin Archive</b>""" |
3666 """<p>This creates an eric5 plugin archive file using the list""" | 3687 """<p>This creates an eric5 plugin archive file using the list""" |
3667 """ of files given in the PKGLIST file. The archive name is""" | 3688 """ of files given in the PKGLIST file. The archive name is""" |
3668 """ built from the main script name.</p>""" | 3689 """ built from the main script name.</p>""" |
3669 )) | 3690 )) |
3670 self.pluginArchiveAct.triggered[()].connect(self.__pluginCreateArchive) | 3691 self.pluginArchiveAct.triggered.connect(self.__pluginCreateArchive) |
3671 self.actions.append(self.pluginArchiveAct) | 3692 self.actions.append(self.pluginArchiveAct) |
3672 | 3693 |
3673 self.pluginSArchiveAct = E5Action( | 3694 self.pluginSArchiveAct = E5Action( |
3674 self.trUtf8('Create Plugin Archive (Snapshot)'), | 3695 self.tr('Create Plugin Archive (Snapshot)'), |
3675 UI.PixmapCache.getIcon("pluginArchiveSnapshot.png"), | 3696 UI.PixmapCache.getIcon("pluginArchiveSnapshot.png"), |
3676 self.trUtf8('Create Plugin Archive (&Snapshot)'), 0, 0, | 3697 self.tr('Create Plugin Archive (&Snapshot)'), 0, 0, |
3677 self.pluginGrp, 'project_plugin_sarchive') | 3698 self.pluginGrp, 'project_plugin_sarchive') |
3678 self.pluginSArchiveAct.setStatusTip(self.trUtf8( | 3699 self.pluginSArchiveAct.setStatusTip(self.tr( |
3679 'Create an eric5 plugin archive file (snapshot release).')) | 3700 'Create an eric5 plugin archive file (snapshot release).')) |
3680 self.pluginSArchiveAct.setWhatsThis(self.trUtf8( | 3701 self.pluginSArchiveAct.setWhatsThis(self.tr( |
3681 """<b>Create Plugin Archive (Snapshot)</b>""" | 3702 """<b>Create Plugin Archive (Snapshot)</b>""" |
3682 """<p>This creates an eric5 plugin archive file using the list""" | 3703 """<p>This creates an eric5 plugin archive file using the list""" |
3683 """ of files given in the PKGLIST file. The archive name is""" | 3704 """ of files given in the PKGLIST file. The archive name is""" |
3684 """ built from the main script name. The version entry of the""" | 3705 """ built from the main script name. The version entry of the""" |
3685 """ main script is modified to reflect a snapshot release.</p>""" | 3706 """ main script is modified to reflect a snapshot release.</p>""" |
3686 )) | 3707 )) |
3687 self.pluginSArchiveAct.triggered[()].connect( | 3708 self.pluginSArchiveAct.triggered.connect( |
3688 self.__pluginCreateSnapshotArchive) | 3709 self.__pluginCreateSnapshotArchive) |
3689 self.actions.append(self.pluginSArchiveAct) | 3710 self.actions.append(self.pluginSArchiveAct) |
3690 | 3711 |
3691 self.closeAct.setEnabled(False) | 3712 self.closeAct.setEnabled(False) |
3692 self.saveAct.setEnabled(False) | 3713 self.saveAct.setEnabled(False) |
3704 """ | 3725 """ |
3705 Public slot to initialize the project menu. | 3726 Public slot to initialize the project menu. |
3706 | 3727 |
3707 @return the menu generated (QMenu) | 3728 @return the menu generated (QMenu) |
3708 """ | 3729 """ |
3709 menu = QMenu(self.trUtf8('&Project'), self.parent()) | 3730 menu = QMenu(self.tr('&Project'), self.parent()) |
3710 self.recentMenu = QMenu(self.trUtf8('Open &Recent Projects'), menu) | 3731 self.recentMenu = QMenu(self.tr('Open &Recent Projects'), menu) |
3711 self.vcsMenu = QMenu(self.trUtf8('&Version Control'), menu) | 3732 self.vcsMenu = QMenu(self.tr('&Version Control'), menu) |
3712 self.vcsMenu.setTearOffEnabled(True) | 3733 self.vcsMenu.setTearOffEnabled(True) |
3713 self.vcsProjectHelper.initMenu(self.vcsMenu) | 3734 self.vcsProjectHelper.initMenu(self.vcsMenu) |
3714 self.vcsMenu.setEnabled(self.vcsSoftwareAvailable()) | 3735 self.vcsMenu.setEnabled(self.vcsSoftwareAvailable()) |
3715 self.checksMenu = QMenu(self.trUtf8('Chec&k'), menu) | 3736 self.checksMenu = QMenu(self.tr('Chec&k'), menu) |
3716 self.checksMenu.setTearOffEnabled(True) | 3737 self.checksMenu.setTearOffEnabled(True) |
3717 self.menuShow = QMenu(self.trUtf8('Sho&w'), menu) | 3738 self.menuShow = QMenu(self.tr('Sho&w'), menu) |
3718 self.graphicsMenu = QMenu(self.trUtf8('&Diagrams'), menu) | 3739 self.graphicsMenu = QMenu(self.tr('&Diagrams'), menu) |
3719 self.sessionMenu = QMenu(self.trUtf8('Session'), menu) | 3740 self.sessionMenu = QMenu(self.tr('Session'), menu) |
3720 self.apidocMenu = QMenu(self.trUtf8('Source &Documentation'), menu) | 3741 self.apidocMenu = QMenu(self.tr('Source &Documentation'), menu) |
3721 self.apidocMenu.setTearOffEnabled(True) | 3742 self.apidocMenu.setTearOffEnabled(True) |
3722 self.debuggerMenu = QMenu(self.trUtf8('Debugger'), menu) | 3743 self.debuggerMenu = QMenu(self.tr('Debugger'), menu) |
3723 self.packagersMenu = QMenu(self.trUtf8('Pac&kagers'), menu) | 3744 self.packagersMenu = QMenu(self.tr('Pac&kagers'), menu) |
3724 self.packagersMenu.setTearOffEnabled(True) | 3745 self.packagersMenu.setTearOffEnabled(True) |
3725 | 3746 |
3726 self.__menus = { | 3747 self.__menus = { |
3727 "Main": menu, | 3748 "Main": menu, |
3728 "Recent": self.recentMenu, | 3749 "Recent": self.recentMenu, |
3822 | 3843 |
3823 @param toolbarManager reference to a toolbar manager object | 3844 @param toolbarManager reference to a toolbar manager object |
3824 (E5ToolBarManager) | 3845 (E5ToolBarManager) |
3825 @return the toolbar generated (QToolBar) | 3846 @return the toolbar generated (QToolBar) |
3826 """ | 3847 """ |
3827 tb = QToolBar(self.trUtf8("Project"), self.ui) | 3848 tb = QToolBar(self.tr("Project"), self.ui) |
3828 tb.setIconSize(UI.Config.ToolBarIconSize) | 3849 tb.setIconSize(UI.Config.ToolBarIconSize) |
3829 tb.setObjectName("ProjectToolbar") | 3850 tb.setObjectName("ProjectToolbar") |
3830 tb.setToolTip(self.trUtf8('Project')) | 3851 tb.setToolTip(self.tr('Project')) |
3831 | 3852 |
3832 tb.addActions(self.actGrp1.actions()) | 3853 tb.addActions(self.actGrp1.actions()) |
3833 tb.addAction(self.closeAct) | 3854 tb.addAction(self.closeAct) |
3834 tb.addSeparator() | 3855 tb.addSeparator() |
3835 tb.addAction(self.saveAct) | 3856 tb.addAction(self.saveAct) |
3887 act.setData(rp) | 3908 act.setData(rp) |
3888 act.setEnabled(QFileInfo(rp).exists()) | 3909 act.setEnabled(QFileInfo(rp).exists()) |
3889 idx += 1 | 3910 idx += 1 |
3890 | 3911 |
3891 self.recentMenu.addSeparator() | 3912 self.recentMenu.addSeparator() |
3892 self.recentMenu.addAction(self.trUtf8('&Clear'), self.__clearRecent) | 3913 self.recentMenu.addAction(self.tr('&Clear'), self.__clearRecent) |
3893 | 3914 |
3894 def __openRecent(self, act): | 3915 def __openRecent(self, act): |
3895 """ | 3916 """ |
3896 Private method to open a project from the list of rencently opened | 3917 Private method to open a project from the list of rencently opened |
3897 projects. | 3918 projects. |
4009 # if newfiles is empty, put up message box informing user nothing found | 4030 # if newfiles is empty, put up message box informing user nothing found |
4010 if not newFiles: | 4031 if not newFiles: |
4011 if onUserDemand: | 4032 if onUserDemand: |
4012 E5MessageBox.information( | 4033 E5MessageBox.information( |
4013 self.ui, | 4034 self.ui, |
4014 self.trUtf8("Search New Files"), | 4035 self.tr("Search New Files"), |
4015 self.trUtf8("There were no new files found to be added.")) | 4036 self.tr("There were no new files found to be added.")) |
4016 return | 4037 return |
4017 | 4038 |
4018 # autoInclude is not set, show a dialog | 4039 # autoInclude is not set, show a dialog |
4019 from .AddFoundFilesDialog import AddFoundFilesDialog | 4040 from .AddFoundFilesDialog import AddFoundFilesDialog |
4020 dlg = AddFoundFilesDialog(newFiles, self.parent(), None) | 4041 dlg = AddFoundFilesDialog(newFiles, self.parent(), None) |
4144 if override: | 4165 if override: |
4145 # override failed, revert to original | 4166 # override failed, revert to original |
4146 QApplication.restoreOverrideCursor() | 4167 QApplication.restoreOverrideCursor() |
4147 E5MessageBox.critical( | 4168 E5MessageBox.critical( |
4148 self.ui, | 4169 self.ui, |
4149 self.trUtf8("Version Control System"), | 4170 self.tr("Version Control System"), |
4150 self.trUtf8( | 4171 self.tr( |
4151 "<p>The selected VCS <b>{0}</b> could not be" | 4172 "<p>The selected VCS <b>{0}</b> could not be" |
4152 " found. <br/>Reverting override.</p><p>{1}</p>") | 4173 " found. <br/>Reverting override.</p><p>{1}</p>") |
4153 .format(vcsSystem, msg)) | 4174 .format(vcsSystem, msg)) |
4154 self.pudata["VCSOVERRIDE"] = [] | 4175 self.pudata["VCSOVERRIDE"] = [] |
4155 return self.initVCS(nooverride=True) | 4176 return self.initVCS(nooverride=True) |
4156 | 4177 |
4157 QApplication.restoreOverrideCursor() | 4178 QApplication.restoreOverrideCursor() |
4158 E5MessageBox.critical( | 4179 E5MessageBox.critical( |
4159 self.ui, | 4180 self.ui, |
4160 self.trUtf8("Version Control System"), | 4181 self.tr("Version Control System"), |
4161 self.trUtf8( | 4182 self.tr( |
4162 "<p>The selected VCS <b>{0}</b> could not be" | 4183 "<p>The selected VCS <b>{0}</b> could not be" |
4163 " found.<br/>Disabling version control.</p>" | 4184 " found.<br/>Disabling version control.</p>" |
4164 "<p>{1}</p>").format(vcsSystem, msg)) | 4185 "<p>{1}</p>").format(vcsSystem, msg)) |
4165 vcs = None | 4186 vcs = None |
4166 if forProject: | 4187 if forProject: |
4169 else: | 4190 else: |
4170 vcs.vcsInitConfig(self) | 4191 vcs.vcsInitConfig(self) |
4171 | 4192 |
4172 if vcs and forProject: | 4193 if vcs and forProject: |
4173 # set the vcs options | 4194 # set the vcs options |
4174 try: | 4195 if vcs.vcsSupportCommandOptions(): |
4175 vcsopt = copy.deepcopy(self.pdata["VCSOPTIONS"][0]) | 4196 try: |
4176 vcs.vcsSetOptions(vcsopt) | 4197 vcsopt = copy.deepcopy(self.pdata["VCSOPTIONS"][0]) |
4177 except LookupError: | 4198 vcs.vcsSetOptions(vcsopt) |
4178 pass | 4199 except LookupError: |
4200 pass | |
4179 # set vcs specific data | 4201 # set vcs specific data |
4180 try: | 4202 try: |
4181 vcsother = copy.deepcopy(self.pdata["VCSOTHERDATA"][0]) | 4203 vcsother = copy.deepcopy(self.pdata["VCSOTHERDATA"][0]) |
4182 vcs.vcsSetOtherData(vcsother) | 4204 vcs.vcsSetOtherData(vcsother) |
4183 except LookupError: | 4205 except LookupError: |
4272 """ | 4294 """ |
4273 fn = self.getMainScript(True) | 4295 fn = self.getMainScript(True) |
4274 if fn is None: | 4296 if fn is None: |
4275 E5MessageBox.critical( | 4297 E5MessageBox.critical( |
4276 self.ui, | 4298 self.ui, |
4277 self.trUtf8("Coverage Data"), | 4299 self.tr("Coverage Data"), |
4278 self.trUtf8( | 4300 self.tr( |
4279 "There is no main script defined for the" | 4301 "There is no main script defined for the" |
4280 " current project. Aborting")) | 4302 " current project. Aborting")) |
4281 return | 4303 return |
4282 | 4304 |
4283 tfn = Utilities.getTestFileName(fn) | 4305 tfn = Utilities.getTestFileName(fn) |
4295 | 4317 |
4296 if files: | 4318 if files: |
4297 if len(files) > 1: | 4319 if len(files) > 1: |
4298 fn, ok = QInputDialog.getItem( | 4320 fn, ok = QInputDialog.getItem( |
4299 None, | 4321 None, |
4300 self.trUtf8("Code Coverage"), | 4322 self.tr("Code Coverage"), |
4301 self.trUtf8("Please select a coverage file"), | 4323 self.tr("Please select a coverage file"), |
4302 files, | 4324 files, |
4303 0, False) | 4325 0, False) |
4304 if not ok: | 4326 if not ok: |
4305 return | 4327 return |
4306 else: | 4328 else: |
4321 """ | 4343 """ |
4322 fn = self.getMainScript(True) | 4344 fn = self.getMainScript(True) |
4323 if fn is None: | 4345 if fn is None: |
4324 E5MessageBox.critical( | 4346 E5MessageBox.critical( |
4325 self.ui, | 4347 self.ui, |
4326 self.trUtf8("Profile Data"), | 4348 self.tr("Profile Data"), |
4327 self.trUtf8( | 4349 self.tr( |
4328 "There is no main script defined for the" | 4350 "There is no main script defined for the" |
4329 " current project. Aborting")) | 4351 " current project. Aborting")) |
4330 return | 4352 return |
4331 | 4353 |
4332 tfn = Utilities.getTestFileName(fn) | 4354 tfn = Utilities.getTestFileName(fn) |
4344 | 4366 |
4345 if files: | 4367 if files: |
4346 if len(files) > 1: | 4368 if len(files) > 1: |
4347 fn, ok = QInputDialog.getItem( | 4369 fn, ok = QInputDialog.getItem( |
4348 None, | 4370 None, |
4349 self.trUtf8("Profile Data"), | 4371 self.tr("Profile Data"), |
4350 self.trUtf8("Please select a profile file"), | 4372 self.tr("Please select a profile file"), |
4351 files, | 4373 files, |
4352 0, False) | 4374 0, False) |
4353 if not ok: | 4375 if not ok: |
4354 return | 4376 return |
4355 else: | 4377 else: |
4398 """ | 4420 """ |
4399 Private method to handle the application diagram context menu action. | 4421 Private method to handle the application diagram context menu action. |
4400 """ | 4422 """ |
4401 res = E5MessageBox.yesNo( | 4423 res = E5MessageBox.yesNo( |
4402 self.ui, | 4424 self.ui, |
4403 self.trUtf8("Application Diagram"), | 4425 self.tr("Application Diagram"), |
4404 self.trUtf8("""Include module names?"""), | 4426 self.tr("""Include module names?"""), |
4405 yesDefault=True) | 4427 yesDefault=True) |
4406 | 4428 |
4407 from Graphics.UMLDialog import UMLDialog | 4429 from Graphics.UMLDialog import UMLDialog |
4408 self.applicationDiagram = UMLDialog(UMLDialog.ApplicationDiagram, self, | 4430 self.applicationDiagram = UMLDialog(UMLDialog.ApplicationDiagram, self, |
4409 self.parent(), noModules=not res) | 4431 self.parent(), noModules=not res) |
4516 """ | 4538 """ |
4517 pkglist = os.path.join(self.ppath, "PKGLIST") | 4539 pkglist = os.path.join(self.ppath, "PKGLIST") |
4518 if os.path.exists(pkglist): | 4540 if os.path.exists(pkglist): |
4519 res = E5MessageBox.yesNo( | 4541 res = E5MessageBox.yesNo( |
4520 self.ui, | 4542 self.ui, |
4521 self.trUtf8("Create Package List"), | 4543 self.tr("Create Package List"), |
4522 self.trUtf8( | 4544 self.tr( |
4523 "<p>The file <b>PKGLIST</b> already" | 4545 "<p>The file <b>PKGLIST</b> already" |
4524 " exists.</p><p>Overwrite it?</p>"), | 4546 " exists.</p><p>Overwrite it?</p>"), |
4525 icon=E5MessageBox.Warning) | 4547 icon=E5MessageBox.Warning) |
4526 if not res: | 4548 if not res: |
4527 return # don't overwrite | 4549 return # don't overwrite |
4556 pkglistFile.write("\n") # ensure the file ends with an empty line | 4578 pkglistFile.write("\n") # ensure the file ends with an empty line |
4557 pkglistFile.close() | 4579 pkglistFile.close() |
4558 except IOError as why: | 4580 except IOError as why: |
4559 E5MessageBox.critical( | 4581 E5MessageBox.critical( |
4560 self.ui, | 4582 self.ui, |
4561 self.trUtf8("Create Package List"), | 4583 self.tr("Create Package List"), |
4562 self.trUtf8( | 4584 self.tr( |
4563 """<p>The file <b>PKGLIST</b> could not be created.</p>""" | 4585 """<p>The file <b>PKGLIST</b> could not be created.</p>""" |
4564 """<p>Reason: {0}</p>""").format(str(why))) | 4586 """<p>Reason: {0}</p>""").format(str(why))) |
4565 return | 4587 return |
4566 | 4588 |
4567 if not "PKGLIST" in self.pdata["OTHERS"]: | 4589 if not "PKGLIST" in self.pdata["OTHERS"]: |
4568 self.appendFile("PKGLIST") | 4590 self.appendFile("PKGLIST") |
4569 | 4591 |
4592 @pyqtSlot() | |
4570 def __pluginCreateArchive(self, snapshot=False): | 4593 def __pluginCreateArchive(self, snapshot=False): |
4571 """ | 4594 """ |
4572 Private slot to create an eric5 plugin archive. | 4595 Private slot to create an eric5 plugin archive. |
4573 | 4596 |
4574 @param snapshot flag indicating a snapshot archive (boolean) | 4597 @param snapshot flag indicating a snapshot archive (boolean) |
4575 """ | 4598 """ |
4576 pkglist = os.path.join(self.ppath, "PKGLIST") | 4599 pkglist = os.path.join(self.ppath, "PKGLIST") |
4577 if not os.path.exists(pkglist): | 4600 if not os.path.exists(pkglist): |
4578 E5MessageBox.critical( | 4601 E5MessageBox.critical( |
4579 self.ui, | 4602 self.ui, |
4580 self.trUtf8("Create Plugin Archive"), | 4603 self.tr("Create Plugin Archive"), |
4581 self.trUtf8("""<p>The file <b>PKGLIST</b> does not exist. """ | 4604 self.tr("""<p>The file <b>PKGLIST</b> does not exist. """ |
4582 """Aborting...</p>""")) | 4605 """Aborting...</p>""")) |
4583 return | 4606 return |
4584 | 4607 |
4585 if len(self.pdata["MAINSCRIPT"]) == 0 or \ | 4608 if len(self.pdata["MAINSCRIPT"]) == 0 or \ |
4586 len(self.pdata["MAINSCRIPT"][0]) == 0: | 4609 len(self.pdata["MAINSCRIPT"][0]) == 0: |
4587 E5MessageBox.critical( | 4610 E5MessageBox.critical( |
4588 self.ui, | 4611 self.ui, |
4589 self.trUtf8("Create Plugin Archive"), | 4612 self.tr("Create Plugin Archive"), |
4590 self.trUtf8( | 4613 self.tr( |
4591 """The project does not have a main script defined. """ | 4614 """The project does not have a main script defined. """ |
4592 """Aborting...""")) | 4615 """Aborting...""")) |
4593 return | 4616 return |
4594 | 4617 |
4595 try: | 4618 try: |
4598 pkglistFile.close() | 4621 pkglistFile.close() |
4599 names = sorted(names.splitlines()) | 4622 names = sorted(names.splitlines()) |
4600 except IOError as why: | 4623 except IOError as why: |
4601 E5MessageBox.critical( | 4624 E5MessageBox.critical( |
4602 self.ui, | 4625 self.ui, |
4603 self.trUtf8("Create Plugin Archive"), | 4626 self.tr("Create Plugin Archive"), |
4604 self.trUtf8( | 4627 self.tr( |
4605 """<p>The file <b>PKGLIST</b> could not be read.</p>""" | 4628 """<p>The file <b>PKGLIST</b> could not be read.</p>""" |
4606 """<p>Reason: {0}</p>""").format(str(why))) | 4629 """<p>Reason: {0}</p>""").format(str(why))) |
4607 return | 4630 return |
4608 | 4631 |
4609 archive = os.path.join( | 4632 archive = os.path.join( |
4611 try: | 4634 try: |
4612 archiveFile = zipfile.ZipFile(archive, "w") | 4635 archiveFile = zipfile.ZipFile(archive, "w") |
4613 except IOError as why: | 4636 except IOError as why: |
4614 E5MessageBox.critical( | 4637 E5MessageBox.critical( |
4615 self.ui, | 4638 self.ui, |
4616 self.trUtf8("Create Plugin Archive"), | 4639 self.tr("Create Plugin Archive"), |
4617 self.trUtf8( | 4640 self.tr( |
4618 """<p>The eric5 plugin archive file <b>{0}</b> could """ | 4641 """<p>The eric5 plugin archive file <b>{0}</b> could """ |
4619 """not be created.</p>""" | 4642 """not be created.</p>""" |
4620 """<p>Reason: {1}</p>""").format(archive, str(why))) | 4643 """<p>Reason: {1}</p>""").format(archive, str(why))) |
4621 return | 4644 return |
4622 | 4645 |
4637 os.path.join(self.ppath, | 4660 os.path.join(self.ppath, |
4638 self.pdata["MAINSCRIPT"][0])) | 4661 self.pdata["MAINSCRIPT"][0])) |
4639 except OSError as why: | 4662 except OSError as why: |
4640 E5MessageBox.critical( | 4663 E5MessageBox.critical( |
4641 self.ui, | 4664 self.ui, |
4642 self.trUtf8("Create Plugin Archive"), | 4665 self.tr("Create Plugin Archive"), |
4643 self.trUtf8( | 4666 self.tr( |
4644 """<p>The file <b>{0}</b> could not be stored """ | 4667 """<p>The file <b>{0}</b> could not be stored """ |
4645 """in the archive. Ignoring it.</p>""" | 4668 """in the archive. Ignoring it.</p>""" |
4646 """<p>Reason: {1}</p>""") | 4669 """<p>Reason: {1}</p>""") |
4647 .format(os.path.join(self.ppath, name), str(why))) | 4670 .format(os.path.join(self.ppath, name), str(why))) |
4648 archiveFile.writestr("VERSION", version.encode("utf-8")) | 4671 archiveFile.writestr("VERSION", version.encode("utf-8")) |
4652 self.appendFile(archive) | 4675 self.appendFile(archive) |
4653 | 4676 |
4654 if self.ui.notificationsEnabled(): | 4677 if self.ui.notificationsEnabled(): |
4655 self.ui.showNotification( | 4678 self.ui.showNotification( |
4656 UI.PixmapCache.getPixmap("pluginArchive48.png"), | 4679 UI.PixmapCache.getPixmap("pluginArchive48.png"), |
4657 self.trUtf8("Create Plugin Archive"), | 4680 self.tr("Create Plugin Archive"), |
4658 self.trUtf8( | 4681 self.tr( |
4659 """<p>The eric5 plugin archive file <b>{0}</b> was """ | 4682 """<p>The eric5 plugin archive file <b>{0}</b> was """ |
4660 """created successfully.</p>""") | 4683 """created successfully.</p>""") |
4661 .format(os.path.basename(archive))) | 4684 .format(os.path.basename(archive))) |
4662 else: | 4685 else: |
4663 E5MessageBox.information( | 4686 E5MessageBox.information( |
4664 self.ui, | 4687 self.ui, |
4665 self.trUtf8("Create Plugin Archive"), | 4688 self.tr("Create Plugin Archive"), |
4666 self.trUtf8( | 4689 self.tr( |
4667 """<p>The eric5 plugin archive file <b>{0}</b> was """ | 4690 """<p>The eric5 plugin archive file <b>{0}</b> was """ |
4668 """created successfully.</p>""").format(archive)) | 4691 """created successfully.</p>""").format(archive)) |
4669 | 4692 |
4670 def __pluginCreateSnapshotArchive(self): | 4693 def __pluginCreateSnapshotArchive(self): |
4671 """ | 4694 """ |
4705 sourcelines, encoding = Utilities.readEncodedFile(filename) | 4728 sourcelines, encoding = Utilities.readEncodedFile(filename) |
4706 sourcelines = sourcelines.splitlines(True) | 4729 sourcelines = sourcelines.splitlines(True) |
4707 except (IOError, UnicodeError) as why: | 4730 except (IOError, UnicodeError) as why: |
4708 E5MessageBox.critical( | 4731 E5MessageBox.critical( |
4709 self.ui, | 4732 self.ui, |
4710 self.trUtf8("Create Plugin Archive"), | 4733 self.tr("Create Plugin Archive"), |
4711 self.trUtf8("""<p>The plugin file <b>{0}</b> could """ | 4734 self.tr("""<p>The plugin file <b>{0}</b> could """ |
4712 """not be read.</p>""" | 4735 """not be read.</p>""" |
4713 """<p>Reason: {1}</p>""") | 4736 """<p>Reason: {1}</p>""") |
4714 .format(filename, str(why))) | 4737 .format(filename, str(why))) |
4715 return b"", "" | 4738 return b"", "" |
4716 | 4739 |
4717 lineno = 0 | 4740 lineno = 0 |
4718 while lineno < len(sourcelines): | 4741 while lineno < len(sourcelines): |
4746 sourcelines = Utilities.readEncodedFile(filename)[0] | 4769 sourcelines = Utilities.readEncodedFile(filename)[0] |
4747 sourcelines = sourcelines.splitlines(True) | 4770 sourcelines = sourcelines.splitlines(True) |
4748 except (IOError, UnicodeError) as why: | 4771 except (IOError, UnicodeError) as why: |
4749 E5MessageBox.critical( | 4772 E5MessageBox.critical( |
4750 self.ui, | 4773 self.ui, |
4751 self.trUtf8("Create Plugin Archive"), | 4774 self.tr("Create Plugin Archive"), |
4752 self.trUtf8( | 4775 self.tr( |
4753 """<p>The plugin file <b>{0}</b> could """ | 4776 """<p>The plugin file <b>{0}</b> could """ |
4754 """not be read.</p> <p>Reason: {1}</p>""") | 4777 """not be read.</p> <p>Reason: {1}</p>""") |
4755 .format(filename, str(why))) | 4778 .format(filename, str(why))) |
4756 return "" | 4779 return "" |
4757 | 4780 |