Project/Project.py

changeset 3190
a9a94491c4fd
parent 3164
a027fc190f82
child 3302
e92f0dd51979
equal deleted inserted replaced
3189:9a21c547de5f 3190:a9a94491c4fd
180 "Ruby": ['.rb'], 180 "Ruby": ['.rb'],
181 "Mixed": Preferences.getPython("Python3Extensions") + ['.rb'], 181 "Mixed": Preferences.getPython("Python3Extensions") + ['.rb'],
182 } 182 }
183 183
184 self.dbgFilters = { 184 self.dbgFilters = {
185 "Python2": self.trUtf8( 185 "Python2": self.tr(
186 "Python2 Files (*.py2);;" 186 "Python2 Files (*.py2);;"
187 "Python2 GUI Files (*.pyw2);;"), 187 "Python2 GUI Files (*.pyw2);;"),
188 "Python3": self.trUtf8( 188 "Python3": self.tr(
189 "Python3 Files (*.py *.py3);;" 189 "Python3 Files (*.py *.py3);;"
190 "Python3 GUI Files (*.pyw *.pyw3);;"), 190 "Python3 GUI Files (*.pyw *.pyw3);;"),
191 "Ruby": self.trUtf8("Ruby Files (*.rb);;"), 191 "Ruby": self.tr("Ruby Files (*.rb);;"),
192 } 192 }
193 193
194 self.vcsMenu = None 194 self.vcsMenu = None
195 195
196 self.__initProjectTypes() 196 self.__initProjectTypes()
229 self.__projectTypes = {} 229 self.__projectTypes = {}
230 self.__fileTypeCallbacks = {} 230 self.__fileTypeCallbacks = {}
231 self.__lexerAssociationCallbacks = {} 231 self.__lexerAssociationCallbacks = {}
232 self.__binaryTranslationsCallbacks = {} 232 self.__binaryTranslationsCallbacks = {}
233 233
234 self.__projectTypes["Qt4"] = self.trUtf8("Qt GUI") 234 self.__projectTypes["Qt4"] = self.tr("Qt GUI")
235 self.__projectTypes["Qt4C"] = self.trUtf8("Qt Console") 235 self.__projectTypes["Qt4C"] = self.tr("Qt Console")
236 self.__projectTypes["PyQt5"] = self.trUtf8("PyQt5 GUI") 236 self.__projectTypes["PyQt5"] = self.tr("PyQt5 GUI")
237 self.__projectTypes["PyQt5C"] = self.trUtf8("PyQt5 Console") 237 self.__projectTypes["PyQt5C"] = self.tr("PyQt5 Console")
238 self.__projectTypes["E4Plugin"] = self.trUtf8("Eric Plugin") 238 self.__projectTypes["E4Plugin"] = self.tr("Eric Plugin")
239 self.__projectTypes["Console"] = self.trUtf8("Console") 239 self.__projectTypes["Console"] = self.tr("Console")
240 self.__projectTypes["Other"] = self.trUtf8("Other") 240 self.__projectTypes["Other"] = self.tr("Other")
241 241
242 self.__projectProgLanguages = { 242 self.__projectProgLanguages = {
243 "Python2": ["Qt4", "Qt4C", "PyQt5", "PyQt5C", "E4Plugin", 243 "Python2": ["Qt4", "Qt4C", "PyQt5", "PyQt5C", "E4Plugin",
244 "Console", "Other"], 244 "Console", "Other"],
245 "Python3": ["Qt4", "Qt4C", "PyQt5", "PyQt5C", "E4Plugin", 245 "Python3": ["Qt4", "Qt4C", "PyQt5", "PyQt5C", "E4Plugin",
247 "Ruby": ["Qt4", "Qt4C", "Console", "Other"], 247 "Ruby": ["Qt4", "Qt4C", "Console", "Other"],
248 } 248 }
249 249
250 pyside2, pyside3 = Utilities.checkPyside() 250 pyside2, pyside3 = Utilities.checkPyside()
251 if pyside2 or pyside3: 251 if pyside2 or pyside3:
252 self.__projectTypes["PySide"] = self.trUtf8("PySide GUI") 252 self.__projectTypes["PySide"] = self.tr("PySide GUI")
253 self.__projectTypes["PySideC"] = self.trUtf8("PySide Console") 253 self.__projectTypes["PySideC"] = self.tr("PySide Console")
254 if pyside2: 254 if pyside2:
255 self.__projectProgLanguages["Python2"].extend( 255 self.__projectProgLanguages["Python2"].extend(
256 ["PySide", "PySideC"]) 256 ["PySide", "PySideC"])
257 if pyside3: 257 if pyside3:
258 self.__projectProgLanguages["Python3"].extend( 258 self.__projectProgLanguages["Python3"].extend(
310 if progLanguages: 310 if progLanguages:
311 for progLanguage in progLanguages: 311 for progLanguage in progLanguages:
312 if progLanguage not in self.__projectProgLanguages: 312 if progLanguage not in self.__projectProgLanguages:
313 E5MessageBox.critical( 313 E5MessageBox.critical(
314 self.ui, 314 self.ui,
315 self.trUtf8("Registering Project Type"), 315 self.tr("Registering Project Type"),
316 self.trUtf8( 316 self.tr(
317 """<p>The Programming Language <b>{0}</b> is not""" 317 """<p>The Programming Language <b>{0}</b> is not"""
318 """ supported.</p>""") 318 """ supported.</p>""")
319 .format(progLanguage) 319 .format(progLanguage)
320 ) 320 )
321 return 321 return
322 322
323 if type_ in self.__projectProgLanguages[progLanguage]: 323 if type_ in self.__projectProgLanguages[progLanguage]:
324 E5MessageBox.critical( 324 E5MessageBox.critical(
325 self.ui, 325 self.ui,
326 self.trUtf8("Registering Project Type"), 326 self.tr("Registering Project Type"),
327 self.trUtf8( 327 self.tr(
328 """<p>The Project type <b>{0}</b> is already""" 328 """<p>The Project type <b>{0}</b> is already"""
329 """ registered with Programming Language""" 329 """ registered with Programming Language"""
330 """ <b>{1}</b>.</p>""") 330 """ <b>{1}</b>.</p>""")
331 .format(type_, progLanguage) 331 .format(type_, progLanguage)
332 ) 332 )
333 return 333 return
334 334
335 if type_ in self.__projectTypes: 335 if type_ in self.__projectTypes:
336 E5MessageBox.critical( 336 E5MessageBox.critical(
337 self.ui, 337 self.ui,
338 self.trUtf8("Registering Project Type"), 338 self.tr("Registering Project Type"),
339 self.trUtf8("""<p>The Project type <b>{0}</b> is already""" 339 self.tr("""<p>The Project type <b>{0}</b> is already"""
340 """ registered.</p>""").format(type_) 340 """ registered.</p>""").format(type_)
341 ) 341 )
342 else: 342 else:
343 self.__projectTypes[type_] = description 343 self.__projectTypes[type_] = description
344 self.__fileTypeCallbacks[type_] = fileTypeCallback 344 self.__fileTypeCallbacks[type_] = fileTypeCallback
345 self.__lexerAssociationCallbacks[type_] = lexerAssociationCallback 345 self.__lexerAssociationCallbacks[type_] = lexerAssociationCallback
667 f.close() 667 f.close()
668 else: 668 else:
669 QApplication.restoreOverrideCursor() 669 QApplication.restoreOverrideCursor()
670 E5MessageBox.critical( 670 E5MessageBox.critical(
671 self.ui, 671 self.ui,
672 self.trUtf8("Read project file"), 672 self.tr("Read project file"),
673 self.trUtf8( 673 self.tr(
674 "<p>The project file <b>{0}</b> could not be read.</p>") 674 "<p>The project file <b>{0}</b> could not be read.</p>")
675 .format(fn)) 675 .format(fn))
676 return False 676 return False
677 677
678 self.pfile = os.path.abspath(fn) 678 self.pfile = os.path.abspath(fn)
767 os.path.basename(fn))[0]).writeXML() 767 os.path.basename(fn))[0]).writeXML()
768 res = True 768 res = True
769 else: 769 else:
770 E5MessageBox.critical( 770 E5MessageBox.critical(
771 self.ui, 771 self.ui,
772 self.trUtf8("Save project file"), 772 self.tr("Save project file"),
773 self.trUtf8( 773 self.tr(
774 "<p>The project file <b>{0}</b> could not be" 774 "<p>The project file <b>{0}</b> could not be"
775 " written.</p>").format(fn)) 775 " written.</p>").format(fn))
776 res = False 776 res = False
777 777
778 if res: 778 if res:
803 reader.readXML() 803 reader.readXML()
804 f.close() 804 f.close()
805 else: 805 else:
806 E5MessageBox.critical( 806 E5MessageBox.critical(
807 self.ui, 807 self.ui,
808 self.trUtf8("Read user project properties"), 808 self.tr("Read user project properties"),
809 self.trUtf8( 809 self.tr(
810 "<p>The user specific project properties file" 810 "<p>The user specific project properties file"
811 " <b>{0}</b> could not be read.</p>").format(fn)) 811 " <b>{0}</b> could not be read.</p>").format(fn))
812 812
813 def __writeUserProperties(self): 813 def __writeUserProperties(self):
814 """ 814 """
827 f, os.path.splitext(os.path.basename(fn))[0]).writeXML() 827 f, os.path.splitext(os.path.basename(fn))[0]).writeXML()
828 f.close() 828 f.close()
829 else: 829 else:
830 E5MessageBox.critical( 830 E5MessageBox.critical(
831 self.ui, 831 self.ui,
832 self.trUtf8("Save user project properties"), 832 self.tr("Save user project properties"),
833 self.trUtf8( 833 self.tr(
834 "<p>The user specific project properties file <b>{0}</b>" 834 "<p>The user specific project properties file <b>{0}</b>"
835 " could not be written.</p>").format(fn)) 835 " could not be written.</p>").format(fn))
836 836
837 def __showContextMenuSession(self): 837 def __showContextMenuSession(self):
838 """ 838 """
861 """ 861 """
862 if self.pfile is None: 862 if self.pfile is None:
863 if not quiet: 863 if not quiet:
864 E5MessageBox.critical( 864 E5MessageBox.critical(
865 self.ui, 865 self.ui,
866 self.trUtf8("Read project session"), 866 self.tr("Read project session"),
867 self.trUtf8("Please save the project first.")) 867 self.tr("Please save the project first."))
868 return 868 return
869 869
870 fn, ext = os.path.splitext(os.path.basename(self.pfile)) 870 fn, ext = os.path.splitext(os.path.basename(self.pfile))
871 fn = os.path.join(self.getProjectManagementDir(), 871 fn = os.path.join(self.getProjectManagementDir(),
872 '{0}{1}.e4s'.format(fn, indicator)) 872 '{0}{1}.e4s'.format(fn, indicator))
879 f.close() 879 f.close()
880 else: 880 else:
881 if not quiet: 881 if not quiet:
882 E5MessageBox.critical( 882 E5MessageBox.critical(
883 self.ui, 883 self.ui,
884 self.trUtf8("Read project session"), 884 self.tr("Read project session"),
885 self.trUtf8( 885 self.tr(
886 "<p>The project session file <b>{0}</b> could not be" 886 "<p>The project session file <b>{0}</b> could not be"
887 " read.</p>").format(fn)) 887 " read.</p>").format(fn))
888 888
889 def __writeSession(self, quiet=False, indicator=""): 889 def __writeSession(self, quiet=False, indicator=""):
890 """ 890 """
896 """ 896 """
897 if self.pfile is None: 897 if self.pfile is None:
898 if not quiet: 898 if not quiet:
899 E5MessageBox.critical( 899 E5MessageBox.critical(
900 self.ui, 900 self.ui,
901 self.trUtf8("Save project session"), 901 self.tr("Save project session"),
902 self.trUtf8("Please save the project first.")) 902 self.tr("Please save the project first."))
903 return 903 return
904 904
905 fn, ext = os.path.splitext(os.path.basename(self.pfile)) 905 fn, ext = os.path.splitext(os.path.basename(self.pfile))
906 fn = os.path.join(self.getProjectManagementDir(), 906 fn = os.path.join(self.getProjectManagementDir(),
907 '{0}{1}.e4s'.format(fn, indicator)) 907 '{0}{1}.e4s'.format(fn, indicator))
914 f.close() 914 f.close()
915 else: 915 else:
916 if not quiet: 916 if not quiet:
917 E5MessageBox.critical( 917 E5MessageBox.critical(
918 self.ui, 918 self.ui,
919 self.trUtf8("Save project session"), 919 self.tr("Save project session"),
920 self.trUtf8( 920 self.tr(
921 "<p>The project session file <b>{0}</b> could not be" 921 "<p>The project session file <b>{0}</b> could not be"
922 " written.</p>").format(fn)) 922 " written.</p>").format(fn))
923 923
924 def __deleteSession(self): 924 def __deleteSession(self):
925 """ 925 """
926 Private method to delete the session file. 926 Private method to delete the session file.
927 """ 927 """
928 if self.pfile is None: 928 if self.pfile is None:
929 E5MessageBox.critical( 929 E5MessageBox.critical(
930 self.ui, 930 self.ui,
931 self.trUtf8("Delete project session"), 931 self.tr("Delete project session"),
932 self.trUtf8("Please save the project first.")) 932 self.tr("Please save the project first."))
933 return 933 return
934 934
935 fname, ext = os.path.splitext(os.path.basename(self.pfile)) 935 fname, ext = os.path.splitext(os.path.basename(self.pfile))
936 936
937 for fn in [os.path.join( 937 for fn in [os.path.join(
940 try: 940 try:
941 os.remove(fn) 941 os.remove(fn)
942 except OSError: 942 except OSError:
943 E5MessageBox.critical( 943 E5MessageBox.critical(
944 self.ui, 944 self.ui,
945 self.trUtf8("Delete project session"), 945 self.tr("Delete project session"),
946 self.trUtf8( 946 self.tr(
947 "<p>The project session file <b>{0}</b> could" 947 "<p>The project session file <b>{0}</b> could"
948 " not be deleted.</p>").format(fn)) 948 " not be deleted.</p>").format(fn))
949 949
950 def __readTasks(self): 950 def __readTasks(self):
951 """ 951 """
952 Private method to read in the project tasks file (.e4t). 952 Private method to read in the project tasks file (.e4t).
953 """ 953 """
954 if self.pfile is None: 954 if self.pfile is None:
955 E5MessageBox.critical( 955 E5MessageBox.critical(
956 self.ui, 956 self.ui,
957 self.trUtf8("Read tasks"), 957 self.tr("Read tasks"),
958 self.trUtf8("Please save the project first.")) 958 self.tr("Please save the project first."))
959 return 959 return
960 960
961 fn, ext = os.path.splitext(os.path.basename(self.pfile)) 961 fn, ext = os.path.splitext(os.path.basename(self.pfile))
962 fn = os.path.join(self.getProjectManagementDir(), '{0}.e4t'.format(fn)) 962 fn = os.path.join(self.getProjectManagementDir(), '{0}.e4t'.format(fn))
963 if not os.path.exists(fn): 963 if not os.path.exists(fn):
969 reader.readXML() 969 reader.readXML()
970 f.close() 970 f.close()
971 else: 971 else:
972 E5MessageBox.critical( 972 E5MessageBox.critical(
973 self.ui, 973 self.ui,
974 self.trUtf8("Read tasks"), 974 self.tr("Read tasks"),
975 self.trUtf8( 975 self.tr(
976 "<p>The tasks file <b>{0}</b> could not be read.</p>") 976 "<p>The tasks file <b>{0}</b> could not be read.</p>")
977 .format(fn)) 977 .format(fn))
978 978
979 def writeTasks(self): 979 def writeTasks(self):
980 """ 980 """
989 f = QFile(fn) 989 f = QFile(fn)
990 ok = f.open(QIODevice.WriteOnly) 990 ok = f.open(QIODevice.WriteOnly)
991 if not ok: 991 if not ok:
992 E5MessageBox.critical( 992 E5MessageBox.critical(
993 self.ui, 993 self.ui,
994 self.trUtf8("Save tasks"), 994 self.tr("Save tasks"),
995 self.trUtf8( 995 self.tr(
996 "<p>The tasks file <b>{0}</b> could not be written.</p>") 996 "<p>The tasks file <b>{0}</b> could not be written.</p>")
997 .format(fn)) 997 .format(fn))
998 return 998 return
999 999
1000 from E5XML.TasksWriter import TasksWriter 1000 from E5XML.TasksWriter import TasksWriter
1028 """ 1028 """
1029 if self.pfile is None: 1029 if self.pfile is None:
1030 if not quiet: 1030 if not quiet:
1031 E5MessageBox.critical( 1031 E5MessageBox.critical(
1032 self.ui, 1032 self.ui,
1033 self.trUtf8("Read debugger properties"), 1033 self.tr("Read debugger properties"),
1034 self.trUtf8("Please save the project first.")) 1034 self.tr("Please save the project first."))
1035 return 1035 return
1036 1036
1037 fn, ext = os.path.splitext(os.path.basename(self.pfile)) 1037 fn, ext = os.path.splitext(os.path.basename(self.pfile))
1038 fn = os.path.join(self.getProjectManagementDir(), '{0}.e4d'.format(fn)) 1038 fn = os.path.join(self.getProjectManagementDir(), '{0}.e4d'.format(fn))
1039 1039
1045 f.close() 1045 f.close()
1046 else: 1046 else:
1047 if not quiet: 1047 if not quiet:
1048 E5MessageBox.critical( 1048 E5MessageBox.critical(
1049 self.ui, 1049 self.ui,
1050 self.trUtf8("Read debugger properties"), 1050 self.tr("Read debugger properties"),
1051 self.trUtf8( 1051 self.tr(
1052 "<p>The project debugger properties file <b>{0}</b>" 1052 "<p>The project debugger properties file <b>{0}</b>"
1053 " could not be read.</p>").format(fn)) 1053 " could not be read.</p>").format(fn))
1054 1054
1055 def __writeDebugProperties(self, quiet=False): 1055 def __writeDebugProperties(self, quiet=False):
1056 """ 1056 """
1061 """ 1061 """
1062 if self.pfile is None: 1062 if self.pfile is None:
1063 if not quiet: 1063 if not quiet:
1064 E5MessageBox.critical( 1064 E5MessageBox.critical(
1065 self.ui, 1065 self.ui,
1066 self.trUtf8("Save debugger properties"), 1066 self.tr("Save debugger properties"),
1067 self.trUtf8("Please save the project first.")) 1067 self.tr("Please save the project first."))
1068 return 1068 return
1069 1069
1070 fn, ext = os.path.splitext(os.path.basename(self.pfile)) 1070 fn, ext = os.path.splitext(os.path.basename(self.pfile))
1071 fn = os.path.join(self.getProjectManagementDir(), '{0}.e4d'.format(fn)) 1071 fn = os.path.join(self.getProjectManagementDir(), '{0}.e4d'.format(fn))
1072 1072
1078 f.close() 1078 f.close()
1079 else: 1079 else:
1080 if not quiet: 1080 if not quiet:
1081 E5MessageBox.critical( 1081 E5MessageBox.critical(
1082 self.ui, 1082 self.ui,
1083 self.trUtf8("Save debugger properties"), 1083 self.tr("Save debugger properties"),
1084 self.trUtf8( 1084 self.tr(
1085 "<p>The project debugger properties file <b>{0}</b>" 1085 "<p>The project debugger properties file <b>{0}</b>"
1086 " could not be written.</p>").format(fn)) 1086 " could not be written.</p>").format(fn))
1087 1087
1088 def __deleteDebugProperties(self): 1088 def __deleteDebugProperties(self):
1089 """ 1089 """
1090 Private method to delete the project debugger properties file (.e4d). 1090 Private method to delete the project debugger properties file (.e4d).
1091 """ 1091 """
1092 if self.pfile is None: 1092 if self.pfile is None:
1093 E5MessageBox.critical( 1093 E5MessageBox.critical(
1094 self.ui, 1094 self.ui,
1095 self.trUtf8("Delete debugger properties"), 1095 self.tr("Delete debugger properties"),
1096 self.trUtf8("Please save the project first.")) 1096 self.tr("Please save the project first."))
1097 return 1097 return
1098 1098
1099 fname, ext = os.path.splitext(os.path.basename(self.pfile)) 1099 fname, ext = os.path.splitext(os.path.basename(self.pfile))
1100 1100
1101 for fn in [os.path.join(self.getProjectManagementDir(), 1101 for fn in [os.path.join(self.getProjectManagementDir(),
1104 try: 1104 try:
1105 os.remove(fn) 1105 os.remove(fn)
1106 except OSError: 1106 except OSError:
1107 E5MessageBox.critical( 1107 E5MessageBox.critical(
1108 self.ui, 1108 self.ui,
1109 self.trUtf8("Delete debugger properties"), 1109 self.tr("Delete debugger properties"),
1110 self.trUtf8( 1110 self.tr(
1111 "<p>The project debugger properties file" 1111 "<p>The project debugger properties file"
1112 " <b>{0}</b> could not be deleted.</p>") 1112 " <b>{0}</b> could not be deleted.</p>")
1113 .format(fn)) 1113 .format(fn))
1114 1114
1115 def __initDebugProperties(self): 1115 def __initDebugProperties(self):
1200 """ 1200 """
1201 if len(self.pdata["TRANSLATIONPATTERN"]) == 0 or \ 1201 if len(self.pdata["TRANSLATIONPATTERN"]) == 0 or \
1202 self.pdata["TRANSLATIONPATTERN"][0] == '': 1202 self.pdata["TRANSLATIONPATTERN"][0] == '':
1203 E5MessageBox.critical( 1203 E5MessageBox.critical(
1204 self.ui, 1204 self.ui,
1205 self.trUtf8("Add Language"), 1205 self.tr("Add Language"),
1206 self.trUtf8( 1206 self.tr(
1207 "You have to specify a translation pattern first.")) 1207 "You have to specify a translation pattern first."))
1208 return 1208 return
1209 1209
1210 from .AddLanguageDialog import AddLanguageDialog 1210 from .AddLanguageDialog import AddLanguageDialog
1211 dlg = AddLanguageDialog(self.parent()) 1211 dlg = AddLanguageDialog(self.parent())
1295 if os.path.exists(fn): 1295 if os.path.exists(fn):
1296 os.remove(fn) 1296 os.remove(fn)
1297 except IOError: 1297 except IOError:
1298 E5MessageBox.critical( 1298 E5MessageBox.critical(
1299 self.ui, 1299 self.ui,
1300 self.trUtf8("Delete translation"), 1300 self.tr("Delete translation"),
1301 self.trUtf8( 1301 self.tr(
1302 "<p>The selected translation file <b>{0}</b> could not be" 1302 "<p>The selected translation file <b>{0}</b> could not be"
1303 " deleted.</p>").format(langFile)) 1303 " deleted.</p>").format(langFile))
1304 return 1304 return
1305 1305
1306 self.removeLanguageFile(langFile) 1306 self.removeLanguageFile(langFile)
1316 if os.path.exists(fn): 1316 if os.path.exists(fn):
1317 os.remove(fn) 1317 os.remove(fn)
1318 except IOError: 1318 except IOError:
1319 E5MessageBox.critical( 1319 E5MessageBox.critical(
1320 self.ui, 1320 self.ui,
1321 self.trUtf8("Delete translation"), 1321 self.tr("Delete translation"),
1322 self.trUtf8( 1322 self.tr(
1323 "<p>The selected translation file <b>{0}</b> could" 1323 "<p>The selected translation file <b>{0}</b> could"
1324 " not be deleted.</p>").format(qmFile)) 1324 " not be deleted.</p>").format(qmFile))
1325 return 1325 return
1326 1326
1327 def appendFile(self, fn, isSourceFile=False, updateModel=True): 1327 def appendFile(self, fn, isSourceFile=False, updateModel=True):
1441 os.makedirs(target) 1441 os.makedirs(target)
1442 1442
1443 if os.path.exists(targetfile): 1443 if os.path.exists(targetfile):
1444 res = E5MessageBox.yesNo( 1444 res = E5MessageBox.yesNo(
1445 self.ui, 1445 self.ui,
1446 self.trUtf8("Add file"), 1446 self.tr("Add file"),
1447 self.trUtf8( 1447 self.tr(
1448 "<p>The file <b>{0}</b> already" 1448 "<p>The file <b>{0}</b> already"
1449 " exists.</p><p>Overwrite it?</p>") 1449 " exists.</p><p>Overwrite it?</p>")
1450 .format(targetfile), 1450 .format(targetfile),
1451 icon=E5MessageBox.Warning) 1451 icon=E5MessageBox.Warning)
1452 if not res: 1452 if not res:
1454 1454
1455 shutil.copy(fn, target) 1455 shutil.copy(fn, target)
1456 except IOError as why: 1456 except IOError as why:
1457 E5MessageBox.critical( 1457 E5MessageBox.critical(
1458 self.ui, 1458 self.ui,
1459 self.trUtf8("Add file"), 1459 self.tr("Add file"),
1460 self.trUtf8( 1460 self.tr(
1461 "<p>The selected file <b>{0}</b> could" 1461 "<p>The selected file <b>{0}</b> could"
1462 " not be added to <b>{1}</b>.</p>" 1462 " not be added to <b>{1}</b>.</p>"
1463 "<p>Reason: {2}</p>") 1463 "<p>Reason: {2}</p>")
1464 .format(fn, target, str(why))) 1464 .format(fn, target, str(why)))
1465 continue 1465 continue
1466 1466
1467 self.appendFile(targetfile, isSource or filter == 'source') 1467 self.appendFile(targetfile, isSource or filter == 'source')
1468 else: 1468 else:
1469 E5MessageBox.critical( 1469 E5MessageBox.critical(
1470 self.ui, 1470 self.ui,
1471 self.trUtf8("Add file"), 1471 self.tr("Add file"),
1472 self.trUtf8("The target directory must not be empty.")) 1472 self.tr("The target directory must not be empty."))
1473 1473
1474 def __addSingleDirectory(self, filetype, source, target, quiet=False): 1474 def __addSingleDirectory(self, filetype, source, target, quiet=False):
1475 """ 1475 """
1476 Private method used to add all files of a single directory to the 1476 Private method used to add all files of a single directory to the
1477 project. 1477 project.
1497 1497
1498 if len(files) == 0: 1498 if len(files) == 0:
1499 if not quiet: 1499 if not quiet:
1500 E5MessageBox.information( 1500 E5MessageBox.information(
1501 self.ui, 1501 self.ui,
1502 self.trUtf8("Add directory"), 1502 self.tr("Add directory"),
1503 self.trUtf8( 1503 self.tr(
1504 "<p>The source directory doesn't contain" 1504 "<p>The source directory doesn't contain"
1505 " any files belonging to the selected category.</p>")) 1505 " any files belonging to the selected category.</p>"))
1506 return 1506 return
1507 1507
1508 if not Utilities.samepath(target, source) and \ 1508 if not Utilities.samepath(target, source) and \
1510 try: 1510 try:
1511 os.makedirs(target) 1511 os.makedirs(target)
1512 except IOError as why: 1512 except IOError as why:
1513 E5MessageBox.critical( 1513 E5MessageBox.critical(
1514 self.ui, 1514 self.ui,
1515 self.trUtf8("Add directory"), 1515 self.tr("Add directory"),
1516 self.trUtf8( 1516 self.tr(
1517 "<p>The target directory <b>{0}</b> could not be" 1517 "<p>The target directory <b>{0}</b> could not be"
1518 " created.</p><p>Reason: {1}</p>") 1518 " created.</p><p>Reason: {1}</p>")
1519 .format(target, str(why))) 1519 .format(target, str(why)))
1520 return 1520 return
1521 1521
1528 if not Utilities.samepath(target, source): 1528 if not Utilities.samepath(target, source):
1529 try: 1529 try:
1530 if os.path.exists(targetfile): 1530 if os.path.exists(targetfile):
1531 res = E5MessageBox.yesNo( 1531 res = E5MessageBox.yesNo(
1532 self.ui, 1532 self.ui,
1533 self.trUtf8("Add directory"), 1533 self.tr("Add directory"),
1534 self.trUtf8( 1534 self.tr(
1535 "<p>The file <b>{0}</b> already exists.</p>" 1535 "<p>The file <b>{0}</b> already exists.</p>"
1536 "<p>Overwrite it?</p>") 1536 "<p>Overwrite it?</p>")
1537 .format(targetfile), 1537 .format(targetfile),
1538 icon=E5MessageBox.Warning) 1538 icon=E5MessageBox.Warning)
1539 if not res: 1539 if not res:
1582 if dlg.exec_() == QDialog.Accepted: 1582 if dlg.exec_() == QDialog.Accepted:
1583 filetype, source, target, recursive = dlg.getData() 1583 filetype, source, target, recursive = dlg.getData()
1584 if target == '': 1584 if target == '':
1585 E5MessageBox.critical( 1585 E5MessageBox.critical(
1586 self.ui, 1586 self.ui,
1587 self.trUtf8("Add directory"), 1587 self.tr("Add directory"),
1588 self.trUtf8("The target directory must not be empty.")) 1588 self.tr("The target directory must not be empty."))
1589 return 1589 return
1590 1590
1591 if filetype == 'OTHERS': 1591 if filetype == 'OTHERS':
1592 self.addToOthers(source) 1592 self.addToOthers(source)
1593 return 1593 return
1594 1594
1595 if source == '': 1595 if source == '':
1596 E5MessageBox.critical( 1596 E5MessageBox.critical(
1597 self.ui, 1597 self.ui,
1598 self.trUtf8("Add directory"), 1598 self.tr("Add directory"),
1599 self.trUtf8("The source directory must not be empty.")) 1599 self.tr("The source directory must not be empty."))
1600 return 1600 return
1601 1601
1602 if recursive: 1602 if recursive:
1603 self.__addRecursiveDirectory(filetype, source, target) 1603 self.__addRecursiveDirectory(filetype, source, target)
1604 else: 1604 else:
1717 isSourceFile = fn in self.pdata["SOURCES"] 1717 isSourceFile = fn in self.pdata["SOURCES"]
1718 1718
1719 if newfn is None: 1719 if newfn is None:
1720 newfn = E5FileDialog.getSaveFileName( 1720 newfn = E5FileDialog.getSaveFileName(
1721 None, 1721 None,
1722 self.trUtf8("Rename file"), 1722 self.tr("Rename file"),
1723 oldfn, 1723 oldfn,
1724 "", 1724 "",
1725 E5FileDialog.Options(E5FileDialog.DontConfirmOverwrite)) 1725 E5FileDialog.Options(E5FileDialog.DontConfirmOverwrite))
1726 if not newfn: 1726 if not newfn:
1727 return False 1727 return False
1728 newfn = Utilities.toNativeSeparators(newfn) 1728 newfn = Utilities.toNativeSeparators(newfn)
1729 1729
1730 if os.path.exists(newfn): 1730 if os.path.exists(newfn):
1731 res = E5MessageBox.yesNo( 1731 res = E5MessageBox.yesNo(
1732 self.ui, 1732 self.ui,
1733 self.trUtf8("Rename File"), 1733 self.tr("Rename File"),
1734 self.trUtf8("""<p>The file <b>{0}</b> already exists.""" 1734 self.tr("""<p>The file <b>{0}</b> already exists."""
1735 """ Overwrite it?</p>""") 1735 """ Overwrite it?</p>""")
1736 .format(newfn), 1736 .format(newfn),
1737 icon=E5MessageBox.Warning) 1737 icon=E5MessageBox.Warning)
1738 if not res: 1738 if not res:
1739 return False 1739 return False
1740 1740
1741 try: 1741 try:
1742 os.rename(oldfn, newfn) 1742 os.rename(oldfn, newfn)
1743 except OSError as msg: 1743 except OSError as msg:
1744 E5MessageBox.critical( 1744 E5MessageBox.critical(
1745 self.ui, 1745 self.ui,
1746 self.trUtf8("Rename File"), 1746 self.tr("Rename File"),
1747 self.trUtf8( 1747 self.tr(
1748 """<p>The file <b>{0}</b> could not be renamed.<br />""" 1748 """<p>The file <b>{0}</b> could not be renamed.<br />"""
1749 """Reason: {1}</p>""").format(oldfn, str(msg))) 1749 """Reason: {1}</p>""").format(oldfn, str(msg)))
1750 return False 1750 return False
1751 1751
1752 if fn in self.pdata["SOURCES"] or \ 1752 if fn in self.pdata["SOURCES"] or \
1933 for f in glob.glob(pat): 1933 for f in glob.glob(pat):
1934 os.remove(f) 1934 os.remove(f)
1935 except EnvironmentError: 1935 except EnvironmentError:
1936 E5MessageBox.critical( 1936 E5MessageBox.critical(
1937 self.ui, 1937 self.ui,
1938 self.trUtf8("Delete file"), 1938 self.tr("Delete file"),
1939 self.trUtf8( 1939 self.tr(
1940 "<p>The selected file <b>{0}</b> could not be" 1940 "<p>The selected file <b>{0}</b> could not be"
1941 " deleted.</p>").format(fn)) 1941 " deleted.</p>").format(fn))
1942 return False 1942 return False
1943 1943
1944 self.removeFile(fn) 1944 self.removeFile(fn)
1958 try: 1958 try:
1959 shutil.rmtree(dn, True) 1959 shutil.rmtree(dn, True)
1960 except EnvironmentError: 1960 except EnvironmentError:
1961 E5MessageBox.critical( 1961 E5MessageBox.critical(
1962 self.ui, 1962 self.ui,
1963 self.trUtf8("Delete directory"), 1963 self.tr("Delete directory"),
1964 self.trUtf8( 1964 self.tr(
1965 "<p>The selected directory <b>{0}</b> could not be" 1965 "<p>The selected directory <b>{0}</b> could not be"
1966 " deleted.</p>").format(dn)) 1966 " deleted.</p>").format(dn))
1967 return False 1967 return False
1968 1968
1969 self.removeDirectory(dn) 1969 self.removeDirectory(dn)
2041 try: 2041 try:
2042 os.makedirs(self.ppath) 2042 os.makedirs(self.ppath)
2043 except EnvironmentError: 2043 except EnvironmentError:
2044 E5MessageBox.critical( 2044 E5MessageBox.critical(
2045 self.ui, 2045 self.ui,
2046 self.trUtf8("Create project directory"), 2046 self.tr("Create project directory"),
2047 self.trUtf8( 2047 self.tr(
2048 "<p>The project directory <b>{0}</b> could not" 2048 "<p>The project directory <b>{0}</b> could not"
2049 " be created.</p>") 2049 " be created.</p>")
2050 .format(self.ppath)) 2050 .format(self.ppath))
2051 self.vcs = self.initVCS() 2051 self.vcs = self.initVCS()
2052 return 2052 return
2095 f = open(ms, "w") 2095 f = open(ms, "w")
2096 f.close() 2096 f.close()
2097 except IOError as err: 2097 except IOError as err:
2098 E5MessageBox.critical( 2098 E5MessageBox.critical(
2099 self.ui, 2099 self.ui,
2100 self.trUtf8("Create main script"), 2100 self.tr("Create main script"),
2101 self.trUtf8( 2101 self.tr(
2102 "<p>The mainscript <b>{0}</b> could not" 2102 "<p>The mainscript <b>{0}</b> could not"
2103 " be created.<br/>Reason: {1}</p>") 2103 " be created.<br/>Reason: {1}</p>")
2104 .format(self.ppath, str(err))) 2104 .format(self.ppath, str(err)))
2105 self.appendFile(ms) 2105 self.appendFile(ms)
2106 except IndexError: 2106 except IndexError:
2107 ms = "" 2107 ms = ""
2108 2108
2109 # add existing files to the project 2109 # add existing files to the project
2110 res = E5MessageBox.yesNo( 2110 res = E5MessageBox.yesNo(
2111 self.ui, 2111 self.ui,
2112 self.trUtf8("New Project"), 2112 self.tr("New Project"),
2113 self.trUtf8("""Add existing files to the project?"""), 2113 self.tr("""Add existing files to the project?"""),
2114 yesDefault=True) 2114 yesDefault=True)
2115 if res: 2115 if res:
2116 self.newProjectAddFiles(ms) 2116 self.newProjectAddFiles(ms)
2117 # create an empty __init__.py file to make it a Python package 2117 # create an empty __init__.py file to make it a Python package
2118 # if none exists (only for Python and Python3) 2118 # if none exists (only for Python and Python3)
2135 vcsList = [] 2135 vcsList = []
2136 for vcsSystemStr, vcsSystemDisplay in vcsData: 2136 for vcsSystemStr, vcsSystemDisplay in vcsData:
2137 vcsList.append(vcsSystemDisplay) 2137 vcsList.append(vcsSystemDisplay)
2138 res, vcs_ok = QInputDialog.getItem( 2138 res, vcs_ok = QInputDialog.getItem(
2139 None, 2139 None,
2140 self.trUtf8("New Project"), 2140 self.tr("New Project"),
2141 self.trUtf8("Select Version Control System"), 2141 self.tr("Select Version Control System"),
2142 vcsList, 2142 vcsList,
2143 0, False) 2143 0, False)
2144 if vcs_ok: 2144 if vcs_ok:
2145 for vcsSystemStr, vcsSystemDisplay in vcsData: 2145 for vcsSystemStr, vcsSystemDisplay in vcsData:
2146 if res == vcsSystemDisplay: 2146 if res == vcsSystemDisplay:
2157 self.setDirty(True) 2157 self.setDirty(True)
2158 if self.vcs is not None: 2158 if self.vcs is not None:
2159 # edit VCS command options 2159 # edit VCS command options
2160 vcores = E5MessageBox.yesNo( 2160 vcores = E5MessageBox.yesNo(
2161 self.ui, 2161 self.ui,
2162 self.trUtf8("New Project"), 2162 self.tr("New Project"),
2163 self.trUtf8( 2163 self.tr(
2164 """Would you like to edit the VCS""" 2164 """Would you like to edit the VCS"""
2165 """ command options?""")) 2165 """ command options?"""))
2166 if vcores: 2166 if vcores:
2167 from VCS.CommandOptionsDialog import \ 2167 from VCS.CommandOptionsDialog import \
2168 VcsCommandOptionsDialog 2168 VcsCommandOptionsDialog
2171 self.vcs.vcsSetOptions(codlg.getOptions()) 2171 self.vcs.vcsSetOptions(codlg.getOptions())
2172 # add project file to repository 2172 # add project file to repository
2173 if res == 0: 2173 if res == 0:
2174 apres = E5MessageBox.yesNo( 2174 apres = E5MessageBox.yesNo(
2175 self.ui, 2175 self.ui,
2176 self.trUtf8("New project"), 2176 self.tr("New project"),
2177 self.trUtf8( 2177 self.tr(
2178 "Shall the project file be added" 2178 "Shall the project file be added"
2179 " to the repository?"), 2179 " to the repository?"),
2180 yesDefault=True) 2180 yesDefault=True)
2181 if apres: 2181 if apres:
2182 self.saveProject() 2182 self.saveProject()
2189 # put the project under VCS control 2189 # put the project under VCS control
2190 if self.vcs is None and self.vcsSoftwareAvailable() and \ 2190 if self.vcs is None and self.vcsSoftwareAvailable() and \
2191 self.vcsRequested: 2191 self.vcsRequested:
2192 vcsSystemsDict = e5App().getObject("PluginManager")\ 2192 vcsSystemsDict = e5App().getObject("PluginManager")\
2193 .getPluginDisplayStrings("version_control") 2193 .getPluginDisplayStrings("version_control")
2194 vcsSystemsDisplay = [self.trUtf8("None")] 2194 vcsSystemsDisplay = [self.tr("None")]
2195 keys = sorted(vcsSystemsDict.keys()) 2195 keys = sorted(vcsSystemsDict.keys())
2196 for key in keys: 2196 for key in keys:
2197 vcsSystemsDisplay.append(vcsSystemsDict[key]) 2197 vcsSystemsDisplay.append(vcsSystemsDict[key])
2198 vcsSelected, ok = QInputDialog.getItem( 2198 vcsSelected, ok = QInputDialog.getItem(
2199 None, 2199 None,
2200 self.trUtf8("New Project"), 2200 self.tr("New Project"),
2201 self.trUtf8( 2201 self.tr(
2202 "Select version control system for the project"), 2202 "Select version control system for the project"),
2203 vcsSystemsDisplay, 2203 vcsSystemsDisplay,
2204 0, False) 2204 0, False)
2205 if ok and vcsSelected != self.trUtf8("None"): 2205 if ok and vcsSelected != self.tr("None"):
2206 for vcsSystem, vcsSystemDisplay in vcsSystemsDict.items(): 2206 for vcsSystem, vcsSystemDisplay in vcsSystemsDict.items():
2207 if vcsSystemDisplay == vcsSelected: 2207 if vcsSystemDisplay == vcsSelected:
2208 break 2208 break
2209 else: 2209 else:
2210 vcsSystem = "None" 2210 vcsSystem = "None"
2222 self.setDirty(True) 2222 self.setDirty(True)
2223 if self.vcs is not None: 2223 if self.vcs is not None:
2224 # edit VCS command options 2224 # edit VCS command options
2225 vcores = E5MessageBox.yesNo( 2225 vcores = E5MessageBox.yesNo(
2226 self.ui, 2226 self.ui,
2227 self.trUtf8("New Project"), 2227 self.tr("New Project"),
2228 self.trUtf8( 2228 self.tr(
2229 """Would you like to edit the VCS command""" 2229 """Would you like to edit the VCS command"""
2230 """ options?""")) 2230 """ options?"""))
2231 if vcores: 2231 if vcores:
2232 from VCS.CommandOptionsDialog import \ 2232 from VCS.CommandOptionsDialog import \
2233 VcsCommandOptionsDialog 2233 VcsCommandOptionsDialog
2295 os.path.basename(tslist[0]).split('_')[0], 2295 os.path.basename(tslist[0]).split('_')[0],
2296 os.path.splitext(tslist[0])[1]))] 2296 os.path.splitext(tslist[0])[1]))]
2297 else: 2297 else:
2298 pattern, ok = QInputDialog.getText( 2298 pattern, ok = QInputDialog.getText(
2299 None, 2299 None,
2300 self.trUtf8("Translation Pattern"), 2300 self.tr("Translation Pattern"),
2301 self.trUtf8( 2301 self.tr(
2302 "Enter the path pattern for translation files " 2302 "Enter the path pattern for translation files "
2303 "(use '%language%' in place of the language code):"), 2303 "(use '%language%' in place of the language code):"),
2304 QLineEdit.Normal, 2304 QLineEdit.Normal,
2305 tslist[0]) 2305 tslist[0])
2306 if pattern: 2306 if pattern:
2486 return 2486 return
2487 2487
2488 if fn is None: 2488 if fn is None:
2489 fn = E5FileDialog.getOpenFileName( 2489 fn = E5FileDialog.getOpenFileName(
2490 self.parent(), 2490 self.parent(),
2491 self.trUtf8("Open project"), 2491 self.tr("Open project"),
2492 Preferences.getMultiProject("Workspace") or 2492 Preferences.getMultiProject("Workspace") or
2493 Utilities.getHomeDir(), 2493 Utilities.getHomeDir(),
2494 self.trUtf8("Project Files (*.e4p)")) 2494 self.tr("Project Files (*.e4p)"))
2495 2495
2496 QApplication.processEvents() 2496 QApplication.processEvents()
2497 2497
2498 if fn: 2498 if fn:
2499 if self.closeProject(): 2499 if self.closeProject():
2533 vcsData: 2533 vcsData:
2534 vcsList.append(vcsSystemDisplay) 2534 vcsList.append(vcsSystemDisplay)
2535 QApplication.restoreOverrideCursor() 2535 QApplication.restoreOverrideCursor()
2536 res, vcs_ok = QInputDialog.getItem( 2536 res, vcs_ok = QInputDialog.getItem(
2537 None, 2537 None,
2538 self.trUtf8("New Project"), 2538 self.tr("New Project"),
2539 self.trUtf8( 2539 self.tr(
2540 "Select Version Control System"), 2540 "Select Version Control System"),
2541 vcsList, 2541 vcsList,
2542 0, False) 2542 0, False)
2543 QApplication.setOverrideCursor( 2543 QApplication.setOverrideCursor(
2544 QCursor(Qt.WaitCursor)) 2544 QCursor(Qt.WaitCursor))
2658 """ 2658 """
2659 Public slot to save the current project to a different file. 2659 Public slot to save the current project to a different file.
2660 2660
2661 @return flag indicating success (boolean) 2661 @return flag indicating success (boolean)
2662 """ 2662 """
2663 defaultFilter = self.trUtf8("Project Files (*.e4p)") 2663 defaultFilter = self.tr("Project Files (*.e4p)")
2664 if self.ppath: 2664 if self.ppath:
2665 defaultPath = self.ppath 2665 defaultPath = self.ppath
2666 else: 2666 else:
2667 defaultPath = Preferences.getMultiProject("Workspace") or \ 2667 defaultPath = Preferences.getMultiProject("Workspace") or \
2668 Utilities.getHomeDir() 2668 Utilities.getHomeDir()
2669 fn, selectedFilter = E5FileDialog.getSaveFileNameAndFilter( 2669 fn, selectedFilter = E5FileDialog.getSaveFileNameAndFilter(
2670 self.parent(), 2670 self.parent(),
2671 self.trUtf8("Save project as"), 2671 self.tr("Save project as"),
2672 defaultPath, 2672 defaultPath,
2673 self.trUtf8("Project Files (*.e4p)"), 2673 self.tr("Project Files (*.e4p)"),
2674 defaultFilter, 2674 defaultFilter,
2675 E5FileDialog.Options(E5FileDialog.DontConfirmOverwrite)) 2675 E5FileDialog.Options(E5FileDialog.DontConfirmOverwrite))
2676 2676
2677 if fn: 2677 if fn:
2678 ext = QFileInfo(fn).suffix() 2678 ext = QFileInfo(fn).suffix()
2681 if ex: 2681 if ex:
2682 fn += ex 2682 fn += ex
2683 if QFileInfo(fn).exists(): 2683 if QFileInfo(fn).exists():
2684 res = E5MessageBox.yesNo( 2684 res = E5MessageBox.yesNo(
2685 self.ui, 2685 self.ui,
2686 self.trUtf8("Save File"), 2686 self.tr("Save File"),
2687 self.trUtf8("""<p>The file <b>{0}</b> already exists.""" 2687 self.tr("""<p>The file <b>{0}</b> already exists."""
2688 """ Overwrite it?</p>""").format(fn), 2688 """ Overwrite it?</p>""").format(fn),
2689 icon=E5MessageBox.Warning) 2689 icon=E5MessageBox.Warning)
2690 if not res: 2690 if not res:
2691 return False 2691 return False
2692 2692
2693 self.name = QFileInfo(fn).baseName() 2693 self.name = QFileInfo(fn).baseName()
2717 @return flag indicating whether this operation was successful (boolean) 2717 @return flag indicating whether this operation was successful (boolean)
2718 """ 2718 """
2719 if self.isDirty(): 2719 if self.isDirty():
2720 res = E5MessageBox.okToClearData( 2720 res = E5MessageBox.okToClearData(
2721 self.parent(), 2721 self.parent(),
2722 self.trUtf8("Close Project"), 2722 self.tr("Close Project"),
2723 self.trUtf8("The current project has unsaved changes."), 2723 self.tr("The current project has unsaved changes."),
2724 self.saveProject) 2724 self.saveProject)
2725 if res: 2725 if res:
2726 self.setDirty(False) 2726 self.setDirty(False)
2727 return res 2727 return res
2728 2728
2847 filesWithSyntaxErrors += 1 2847 filesWithSyntaxErrors += 1
2848 2848
2849 if reportSyntaxErrors and filesWithSyntaxErrors > 0: 2849 if reportSyntaxErrors and filesWithSyntaxErrors > 0:
2850 E5MessageBox.critical( 2850 E5MessageBox.critical(
2851 self.ui, 2851 self.ui,
2852 self.trUtf8("Syntax errors detected"), 2852 self.tr("Syntax errors detected"),
2853 self.trUtf8( 2853 self.tr(
2854 """The project contains %n file(s) with syntax errors.""", 2854 """The project contains %n file(s) with syntax errors.""",
2855 "", filesWithSyntaxErrors) 2855 "", filesWithSyntaxErrors)
2856 ) 2856 )
2857 return False 2857 return False
2858 else: 2858 else:
2879 filesWithSyntaxErrors += 1 2879 filesWithSyntaxErrors += 1
2880 2880
2881 if reportSyntaxErrors and filesWithSyntaxErrors > 0: 2881 if reportSyntaxErrors and filesWithSyntaxErrors > 0:
2882 E5MessageBox.critical( 2882 E5MessageBox.critical(
2883 self.ui, 2883 self.ui,
2884 self.trUtf8("Syntax errors detected"), 2884 self.tr("Syntax errors detected"),
2885 self.trUtf8( 2885 self.tr(
2886 """The project contains %n file(s) with syntax errors.""", 2886 """The project contains %n file(s) with syntax errors.""",
2887 "", filesWithSyntaxErrors) 2887 "", filesWithSyntaxErrors)
2888 ) 2888 )
2889 return False 2889 return False
2890 else: 2890 else:
3255 self.actions = [] 3255 self.actions = []
3256 3256
3257 self.actGrp1 = createActionGroup(self) 3257 self.actGrp1 = createActionGroup(self)
3258 3258
3259 act = E5Action( 3259 act = E5Action(
3260 self.trUtf8('New project'), 3260 self.tr('New project'),
3261 UI.PixmapCache.getIcon("projectNew.png"), 3261 UI.PixmapCache.getIcon("projectNew.png"),
3262 self.trUtf8('&New...'), 0, 0, 3262 self.tr('&New...'), 0, 0,
3263 self.actGrp1, 'project_new') 3263 self.actGrp1, 'project_new')
3264 act.setStatusTip(self.trUtf8('Generate a new project')) 3264 act.setStatusTip(self.tr('Generate a new project'))
3265 act.setWhatsThis(self.trUtf8( 3265 act.setWhatsThis(self.tr(
3266 """<b>New...</b>""" 3266 """<b>New...</b>"""
3267 """<p>This opens a dialog for entering the info for a""" 3267 """<p>This opens a dialog for entering the info for a"""
3268 """ new project.</p>""" 3268 """ new project.</p>"""
3269 )) 3269 ))
3270 act.triggered[()].connect(self.createNewProject) 3270 act.triggered[()].connect(self.createNewProject)
3271 self.actions.append(act) 3271 self.actions.append(act)
3272 3272
3273 act = E5Action( 3273 act = E5Action(
3274 self.trUtf8('Open project'), 3274 self.tr('Open project'),
3275 UI.PixmapCache.getIcon("projectOpen.png"), 3275 UI.PixmapCache.getIcon("projectOpen.png"),
3276 self.trUtf8('&Open...'), 0, 0, 3276 self.tr('&Open...'), 0, 0,
3277 self.actGrp1, 'project_open') 3277 self.actGrp1, 'project_open')
3278 act.setStatusTip(self.trUtf8('Open an existing project')) 3278 act.setStatusTip(self.tr('Open an existing project'))
3279 act.setWhatsThis(self.trUtf8( 3279 act.setWhatsThis(self.tr(
3280 """<b>Open...</b>""" 3280 """<b>Open...</b>"""
3281 """<p>This opens an existing project.</p>""" 3281 """<p>This opens an existing project.</p>"""
3282 )) 3282 ))
3283 act.triggered[()].connect(self.openProject) 3283 act.triggered[()].connect(self.openProject)
3284 self.actions.append(act) 3284 self.actions.append(act)
3285 3285
3286 self.closeAct = E5Action( 3286 self.closeAct = E5Action(
3287 self.trUtf8('Close project'), 3287 self.tr('Close project'),
3288 UI.PixmapCache.getIcon("projectClose.png"), 3288 UI.PixmapCache.getIcon("projectClose.png"),
3289 self.trUtf8('&Close'), 0, 0, self, 'project_close') 3289 self.tr('&Close'), 0, 0, self, 'project_close')
3290 self.closeAct.setStatusTip(self.trUtf8('Close the current project')) 3290 self.closeAct.setStatusTip(self.tr('Close the current project'))
3291 self.closeAct.setWhatsThis(self.trUtf8( 3291 self.closeAct.setWhatsThis(self.tr(
3292 """<b>Close</b>""" 3292 """<b>Close</b>"""
3293 """<p>This closes the current project.</p>""" 3293 """<p>This closes the current project.</p>"""
3294 )) 3294 ))
3295 self.closeAct.triggered[()].connect(self.closeProject) 3295 self.closeAct.triggered[()].connect(self.closeProject)
3296 self.actions.append(self.closeAct) 3296 self.actions.append(self.closeAct)
3297 3297
3298 self.saveAct = E5Action( 3298 self.saveAct = E5Action(
3299 self.trUtf8('Save project'), 3299 self.tr('Save project'),
3300 UI.PixmapCache.getIcon("projectSave.png"), 3300 UI.PixmapCache.getIcon("projectSave.png"),
3301 self.trUtf8('&Save'), 0, 0, self, 'project_save') 3301 self.tr('&Save'), 0, 0, self, 'project_save')
3302 self.saveAct.setStatusTip(self.trUtf8('Save the current project')) 3302 self.saveAct.setStatusTip(self.tr('Save the current project'))
3303 self.saveAct.setWhatsThis(self.trUtf8( 3303 self.saveAct.setWhatsThis(self.tr(
3304 """<b>Save</b>""" 3304 """<b>Save</b>"""
3305 """<p>This saves the current project.</p>""" 3305 """<p>This saves the current project.</p>"""
3306 )) 3306 ))
3307 self.saveAct.triggered[()].connect(self.saveProject) 3307 self.saveAct.triggered[()].connect(self.saveProject)
3308 self.actions.append(self.saveAct) 3308 self.actions.append(self.saveAct)
3309 3309
3310 self.saveasAct = E5Action( 3310 self.saveasAct = E5Action(
3311 self.trUtf8('Save project as'), 3311 self.tr('Save project as'),
3312 UI.PixmapCache.getIcon("projectSaveAs.png"), 3312 UI.PixmapCache.getIcon("projectSaveAs.png"),
3313 self.trUtf8('Save &as...'), 0, 0, self, 'project_save_as') 3313 self.tr('Save &as...'), 0, 0, self, 'project_save_as')
3314 self.saveasAct.setStatusTip(self.trUtf8( 3314 self.saveasAct.setStatusTip(self.tr(
3315 'Save the current project to a new file')) 3315 'Save the current project to a new file'))
3316 self.saveasAct.setWhatsThis(self.trUtf8( 3316 self.saveasAct.setWhatsThis(self.tr(
3317 """<b>Save as</b>""" 3317 """<b>Save as</b>"""
3318 """<p>This saves the current project to a new file.</p>""" 3318 """<p>This saves the current project to a new file.</p>"""
3319 )) 3319 ))
3320 self.saveasAct.triggered[()].connect(self.saveProjectAs) 3320 self.saveasAct.triggered[()].connect(self.saveProjectAs)
3321 self.actions.append(self.saveasAct) 3321 self.actions.append(self.saveasAct)
3322 3322
3323 self.actGrp2 = createActionGroup(self) 3323 self.actGrp2 = createActionGroup(self)
3324 3324
3325 self.addFilesAct = E5Action( 3325 self.addFilesAct = E5Action(
3326 self.trUtf8('Add files to project'), 3326 self.tr('Add files to project'),
3327 UI.PixmapCache.getIcon("fileMisc.png"), 3327 UI.PixmapCache.getIcon("fileMisc.png"),
3328 self.trUtf8('Add &files...'), 0, 0, 3328 self.tr('Add &files...'), 0, 0,
3329 self.actGrp2, 'project_add_file') 3329 self.actGrp2, 'project_add_file')
3330 self.addFilesAct.setStatusTip(self.trUtf8( 3330 self.addFilesAct.setStatusTip(self.tr(
3331 'Add files to the current project')) 3331 'Add files to the current project'))
3332 self.addFilesAct.setWhatsThis(self.trUtf8( 3332 self.addFilesAct.setWhatsThis(self.tr(
3333 """<b>Add files...</b>""" 3333 """<b>Add files...</b>"""
3334 """<p>This opens a dialog for adding files""" 3334 """<p>This opens a dialog for adding files"""
3335 """ to the current project. The place to add is""" 3335 """ to the current project. The place to add is"""
3336 """ determined by the file extension.</p>""" 3336 """ determined by the file extension.</p>"""
3337 )) 3337 ))
3338 self.addFilesAct.triggered[()].connect(self.addFiles) 3338 self.addFilesAct.triggered[()].connect(self.addFiles)
3339 self.actions.append(self.addFilesAct) 3339 self.actions.append(self.addFilesAct)
3340 3340
3341 self.addDirectoryAct = E5Action( 3341 self.addDirectoryAct = E5Action(
3342 self.trUtf8('Add directory to project'), 3342 self.tr('Add directory to project'),
3343 UI.PixmapCache.getIcon("dirOpen.png"), 3343 UI.PixmapCache.getIcon("dirOpen.png"),
3344 self.trUtf8('Add directory...'), 0, 0, 3344 self.tr('Add directory...'), 0, 0,
3345 self.actGrp2, 'project_add_directory') 3345 self.actGrp2, 'project_add_directory')
3346 self.addDirectoryAct.setStatusTip( 3346 self.addDirectoryAct.setStatusTip(
3347 self.trUtf8('Add a directory to the current project')) 3347 self.tr('Add a directory to the current project'))
3348 self.addDirectoryAct.setWhatsThis(self.trUtf8( 3348 self.addDirectoryAct.setWhatsThis(self.tr(
3349 """<b>Add directory...</b>""" 3349 """<b>Add directory...</b>"""
3350 """<p>This opens a dialog for adding a directory""" 3350 """<p>This opens a dialog for adding a directory"""
3351 """ to the current project.</p>""" 3351 """ to the current project.</p>"""
3352 )) 3352 ))
3353 self.addDirectoryAct.triggered[()].connect(self.addDirectory) 3353 self.addDirectoryAct.triggered[()].connect(self.addDirectory)
3354 self.actions.append(self.addDirectoryAct) 3354 self.actions.append(self.addDirectoryAct)
3355 3355
3356 self.addLanguageAct = E5Action( 3356 self.addLanguageAct = E5Action(
3357 self.trUtf8('Add translation to project'), 3357 self.tr('Add translation to project'),
3358 UI.PixmapCache.getIcon("linguist4.png"), 3358 UI.PixmapCache.getIcon("linguist4.png"),
3359 self.trUtf8('Add &translation...'), 0, 0, 3359 self.tr('Add &translation...'), 0, 0,
3360 self.actGrp2, 'project_add_translation') 3360 self.actGrp2, 'project_add_translation')
3361 self.addLanguageAct.setStatusTip( 3361 self.addLanguageAct.setStatusTip(
3362 self.trUtf8('Add a translation to the current project')) 3362 self.tr('Add a translation to the current project'))
3363 self.addLanguageAct.setWhatsThis(self.trUtf8( 3363 self.addLanguageAct.setWhatsThis(self.tr(
3364 """<b>Add translation...</b>""" 3364 """<b>Add translation...</b>"""
3365 """<p>This opens a dialog for add a translation""" 3365 """<p>This opens a dialog for add a translation"""
3366 """ to the current project.</p>""" 3366 """ to the current project.</p>"""
3367 )) 3367 ))
3368 self.addLanguageAct.triggered[()].connect(self.addLanguage) 3368 self.addLanguageAct.triggered[()].connect(self.addLanguage)
3369 self.actions.append(self.addLanguageAct) 3369 self.actions.append(self.addLanguageAct)
3370 3370
3371 act = E5Action( 3371 act = E5Action(
3372 self.trUtf8('Search new files'), 3372 self.tr('Search new files'),
3373 self.trUtf8('Searc&h new files...'), 0, 0, 3373 self.tr('Searc&h new files...'), 0, 0,
3374 self.actGrp2, 'project_search_new_files') 3374 self.actGrp2, 'project_search_new_files')
3375 act.setStatusTip(self.trUtf8( 3375 act.setStatusTip(self.tr(
3376 'Search new files in the project directory.')) 3376 'Search new files in the project directory.'))
3377 act.setWhatsThis(self.trUtf8( 3377 act.setWhatsThis(self.tr(
3378 """<b>Search new files...</b>""" 3378 """<b>Search new files...</b>"""
3379 """<p>This searches for new files (sources, *.ui, *.idl) in""" 3379 """<p>This searches for new files (sources, *.ui, *.idl) in"""
3380 """ the project directory and registered subdirectories.</p>""" 3380 """ the project directory and registered subdirectories.</p>"""
3381 )) 3381 ))
3382 act.triggered[()].connect(self.__searchNewFiles) 3382 act.triggered[()].connect(self.__searchNewFiles)
3383 self.actions.append(act) 3383 self.actions.append(act)
3384 3384
3385 self.propsAct = E5Action( 3385 self.propsAct = E5Action(
3386 self.trUtf8('Project properties'), 3386 self.tr('Project properties'),
3387 UI.PixmapCache.getIcon("projectProps.png"), 3387 UI.PixmapCache.getIcon("projectProps.png"),
3388 self.trUtf8('&Properties...'), 0, 0, self, 3388 self.tr('&Properties...'), 0, 0, self,
3389 'project_properties') 3389 'project_properties')
3390 self.propsAct.setStatusTip(self.trUtf8('Show the project properties')) 3390 self.propsAct.setStatusTip(self.tr('Show the project properties'))
3391 self.propsAct.setWhatsThis(self.trUtf8( 3391 self.propsAct.setWhatsThis(self.tr(
3392 """<b>Properties...</b>""" 3392 """<b>Properties...</b>"""
3393 """<p>This shows a dialog to edit the project properties.</p>""" 3393 """<p>This shows a dialog to edit the project properties.</p>"""
3394 )) 3394 ))
3395 self.propsAct.triggered[()].connect(self.__showProperties) 3395 self.propsAct.triggered[()].connect(self.__showProperties)
3396 self.actions.append(self.propsAct) 3396 self.actions.append(self.propsAct)
3397 3397
3398 self.userPropsAct = E5Action( 3398 self.userPropsAct = E5Action(
3399 self.trUtf8('User project properties'), 3399 self.tr('User project properties'),
3400 UI.PixmapCache.getIcon("projectUserProps.png"), 3400 UI.PixmapCache.getIcon("projectUserProps.png"),
3401 self.trUtf8('&User Properties...'), 0, 0, self, 3401 self.tr('&User Properties...'), 0, 0, self,
3402 'project_user_properties') 3402 'project_user_properties')
3403 self.userPropsAct.setStatusTip(self.trUtf8( 3403 self.userPropsAct.setStatusTip(self.tr(
3404 'Show the user specific project properties')) 3404 'Show the user specific project properties'))
3405 self.userPropsAct.setWhatsThis(self.trUtf8( 3405 self.userPropsAct.setWhatsThis(self.tr(
3406 """<b>User Properties...</b>""" 3406 """<b>User Properties...</b>"""
3407 """<p>This shows a dialog to edit the user specific project""" 3407 """<p>This shows a dialog to edit the user specific project"""
3408 """ properties.</p>""" 3408 """ properties.</p>"""
3409 )) 3409 ))
3410 self.userPropsAct.triggered[()].connect(self.__showUserProperties) 3410 self.userPropsAct.triggered[()].connect(self.__showUserProperties)
3411 self.actions.append(self.userPropsAct) 3411 self.actions.append(self.userPropsAct)
3412 3412
3413 self.filetypesAct = E5Action( 3413 self.filetypesAct = E5Action(
3414 self.trUtf8('Filetype Associations'), 3414 self.tr('Filetype Associations'),
3415 self.trUtf8('Filetype Associations...'), 0, 0, 3415 self.tr('Filetype Associations...'), 0, 0,
3416 self, 'project_filetype_associatios') 3416 self, 'project_filetype_associatios')
3417 self.filetypesAct.setStatusTip( 3417 self.filetypesAct.setStatusTip(
3418 self.trUtf8('Show the project filetype associations')) 3418 self.tr('Show the project filetype associations'))
3419 self.filetypesAct.setWhatsThis(self.trUtf8( 3419 self.filetypesAct.setWhatsThis(self.tr(
3420 """<b>Filetype Associations...</b>""" 3420 """<b>Filetype Associations...</b>"""
3421 """<p>This shows a dialog to edit the filetype associations of""" 3421 """<p>This shows a dialog to edit the filetype associations of"""
3422 """ the project. These associations determine the type""" 3422 """ the project. These associations determine the type"""
3423 """ (source, form, interface or others) with a filename""" 3423 """ (source, form, interface or others) with a filename"""
3424 """ pattern. They are used when adding a file to the project""" 3424 """ pattern. They are used when adding a file to the project"""
3427 self.filetypesAct.triggered[()].connect( 3427 self.filetypesAct.triggered[()].connect(
3428 self.__showFiletypeAssociations) 3428 self.__showFiletypeAssociations)
3429 self.actions.append(self.filetypesAct) 3429 self.actions.append(self.filetypesAct)
3430 3430
3431 self.lexersAct = E5Action( 3431 self.lexersAct = E5Action(
3432 self.trUtf8('Lexer Associations'), 3432 self.tr('Lexer Associations'),
3433 self.trUtf8('Lexer Associations...'), 0, 0, 3433 self.tr('Lexer Associations...'), 0, 0,
3434 self, 'project_lexer_associatios') 3434 self, 'project_lexer_associatios')
3435 self.lexersAct.setStatusTip(self.trUtf8( 3435 self.lexersAct.setStatusTip(self.tr(
3436 'Show the project lexer associations (overriding defaults)')) 3436 'Show the project lexer associations (overriding defaults)'))
3437 self.lexersAct.setWhatsThis(self.trUtf8( 3437 self.lexersAct.setWhatsThis(self.tr(
3438 """<b>Lexer Associations...</b>""" 3438 """<b>Lexer Associations...</b>"""
3439 """<p>This shows a dialog to edit the lexer associations of""" 3439 """<p>This shows a dialog to edit the lexer associations of"""
3440 """ the project. These associations override the global lexer""" 3440 """ the project. These associations override the global lexer"""
3441 """ associations. Lexers are used to highlight the editor""" 3441 """ associations. Lexers are used to highlight the editor"""
3442 """ text.</p>""" 3442 """ text.</p>"""
3445 self.actions.append(self.lexersAct) 3445 self.actions.append(self.lexersAct)
3446 3446
3447 self.dbgActGrp = createActionGroup(self) 3447 self.dbgActGrp = createActionGroup(self)
3448 3448
3449 act = E5Action( 3449 act = E5Action(
3450 self.trUtf8('Debugger Properties'), 3450 self.tr('Debugger Properties'),
3451 self.trUtf8('Debugger &Properties...'), 0, 0, 3451 self.tr('Debugger &Properties...'), 0, 0,
3452 self.dbgActGrp, 'project_debugger_properties') 3452 self.dbgActGrp, 'project_debugger_properties')
3453 act.setStatusTip(self.trUtf8('Show the debugger properties')) 3453 act.setStatusTip(self.tr('Show the debugger properties'))
3454 act.setWhatsThis(self.trUtf8( 3454 act.setWhatsThis(self.tr(
3455 """<b>Debugger Properties...</b>""" 3455 """<b>Debugger Properties...</b>"""
3456 """<p>This shows a dialog to edit project specific debugger""" 3456 """<p>This shows a dialog to edit project specific debugger"""
3457 """ settings.</p>""" 3457 """ settings.</p>"""
3458 )) 3458 ))
3459 act.triggered[()].connect(self.__showDebugProperties) 3459 act.triggered[()].connect(self.__showDebugProperties)
3460 self.actions.append(act) 3460 self.actions.append(act)
3461 3461
3462 act = E5Action( 3462 act = E5Action(
3463 self.trUtf8('Load'), 3463 self.tr('Load'),
3464 self.trUtf8('&Load'), 0, 0, 3464 self.tr('&Load'), 0, 0,
3465 self.dbgActGrp, 'project_debugger_properties_load') 3465 self.dbgActGrp, 'project_debugger_properties_load')
3466 act.setStatusTip(self.trUtf8('Load the debugger properties')) 3466 act.setStatusTip(self.tr('Load the debugger properties'))
3467 act.setWhatsThis(self.trUtf8( 3467 act.setWhatsThis(self.tr(
3468 """<b>Load Debugger Properties</b>""" 3468 """<b>Load Debugger Properties</b>"""
3469 """<p>This loads the project specific debugger settings.</p>""" 3469 """<p>This loads the project specific debugger settings.</p>"""
3470 )) 3470 ))
3471 act.triggered[()].connect(self.__readDebugProperties) 3471 act.triggered[()].connect(self.__readDebugProperties)
3472 self.actions.append(act) 3472 self.actions.append(act)
3473 3473
3474 act = E5Action( 3474 act = E5Action(
3475 self.trUtf8('Save'), 3475 self.tr('Save'),
3476 self.trUtf8('&Save'), 0, 0, 3476 self.tr('&Save'), 0, 0,
3477 self.dbgActGrp, 'project_debugger_properties_save') 3477 self.dbgActGrp, 'project_debugger_properties_save')
3478 act.setStatusTip(self.trUtf8('Save the debugger properties')) 3478 act.setStatusTip(self.tr('Save the debugger properties'))
3479 act.setWhatsThis(self.trUtf8( 3479 act.setWhatsThis(self.tr(
3480 """<b>Save Debugger Properties</b>""" 3480 """<b>Save Debugger Properties</b>"""
3481 """<p>This saves the project specific debugger settings.</p>""" 3481 """<p>This saves the project specific debugger settings.</p>"""
3482 )) 3482 ))
3483 act.triggered[()].connect(self.__writeDebugProperties) 3483 act.triggered[()].connect(self.__writeDebugProperties)
3484 self.actions.append(act) 3484 self.actions.append(act)
3485 3485
3486 act = E5Action( 3486 act = E5Action(
3487 self.trUtf8('Delete'), 3487 self.tr('Delete'),
3488 self.trUtf8('&Delete'), 0, 0, 3488 self.tr('&Delete'), 0, 0,
3489 self.dbgActGrp, 'project_debugger_properties_delete') 3489 self.dbgActGrp, 'project_debugger_properties_delete')
3490 act.setStatusTip(self.trUtf8('Delete the debugger properties')) 3490 act.setStatusTip(self.tr('Delete the debugger properties'))
3491 act.setWhatsThis(self.trUtf8( 3491 act.setWhatsThis(self.tr(
3492 """<b>Delete Debugger Properties</b>""" 3492 """<b>Delete Debugger Properties</b>"""
3493 """<p>This deletes the file containing the project specific""" 3493 """<p>This deletes the file containing the project specific"""
3494 """ debugger settings.</p>""" 3494 """ debugger settings.</p>"""
3495 )) 3495 ))
3496 act.triggered[()].connect(self.__deleteDebugProperties) 3496 act.triggered[()].connect(self.__deleteDebugProperties)
3497 self.actions.append(act) 3497 self.actions.append(act)
3498 3498
3499 act = E5Action( 3499 act = E5Action(
3500 self.trUtf8('Reset'), 3500 self.tr('Reset'),
3501 self.trUtf8('&Reset'), 0, 0, 3501 self.tr('&Reset'), 0, 0,
3502 self.dbgActGrp, 'project_debugger_properties_resets') 3502 self.dbgActGrp, 'project_debugger_properties_resets')
3503 act.setStatusTip(self.trUtf8('Reset the debugger properties')) 3503 act.setStatusTip(self.tr('Reset the debugger properties'))
3504 act.setWhatsThis(self.trUtf8( 3504 act.setWhatsThis(self.tr(
3505 """<b>Reset Debugger Properties</b>""" 3505 """<b>Reset Debugger Properties</b>"""
3506 """<p>This resets the project specific debugger settings.</p>""" 3506 """<p>This resets the project specific debugger settings.</p>"""
3507 )) 3507 ))
3508 act.triggered[()].connect(self.__initDebugProperties) 3508 act.triggered[()].connect(self.__initDebugProperties)
3509 self.actions.append(act) 3509 self.actions.append(act)
3510 3510
3511 self.sessActGrp = createActionGroup(self) 3511 self.sessActGrp = createActionGroup(self)
3512 3512
3513 act = E5Action( 3513 act = E5Action(
3514 self.trUtf8('Load session'), 3514 self.tr('Load session'),
3515 self.trUtf8('Load session'), 0, 0, 3515 self.tr('Load session'), 0, 0,
3516 self.sessActGrp, 'project_load_session') 3516 self.sessActGrp, 'project_load_session')
3517 act.setStatusTip(self.trUtf8('Load the projects session file.')) 3517 act.setStatusTip(self.tr('Load the projects session file.'))
3518 act.setWhatsThis(self.trUtf8( 3518 act.setWhatsThis(self.tr(
3519 """<b>Load session</b>""" 3519 """<b>Load session</b>"""
3520 """<p>This loads the projects session file. The session consists""" 3520 """<p>This loads the projects session file. The session consists"""
3521 """ of the following data.<br>""" 3521 """ of the following data.<br>"""
3522 """- all open source files<br>""" 3522 """- all open source files<br>"""
3523 """- all breakpoint<br>""" 3523 """- all breakpoint<br>"""
3527 )) 3527 ))
3528 act.triggered[()].connect(self.__readSession) 3528 act.triggered[()].connect(self.__readSession)
3529 self.actions.append(act) 3529 self.actions.append(act)
3530 3530
3531 act = E5Action( 3531 act = E5Action(
3532 self.trUtf8('Save session'), 3532 self.tr('Save session'),
3533 self.trUtf8('Save session'), 0, 0, 3533 self.tr('Save session'), 0, 0,
3534 self.sessActGrp, 'project_save_session') 3534 self.sessActGrp, 'project_save_session')
3535 act.setStatusTip(self.trUtf8('Save the projects session file.')) 3535 act.setStatusTip(self.tr('Save the projects session file.'))
3536 act.setWhatsThis(self.trUtf8( 3536 act.setWhatsThis(self.tr(
3537 """<b>Save session</b>""" 3537 """<b>Save session</b>"""
3538 """<p>This saves the projects session file. The session consists""" 3538 """<p>This saves the projects session file. The session consists"""
3539 """ of the following data.<br>""" 3539 """ of the following data.<br>"""
3540 """- all open source files<br>""" 3540 """- all open source files<br>"""
3541 """- all breakpoint<br>""" 3541 """- all breakpoint<br>"""
3545 )) 3545 ))
3546 act.triggered[()].connect(self.__writeSession) 3546 act.triggered[()].connect(self.__writeSession)
3547 self.actions.append(act) 3547 self.actions.append(act)
3548 3548
3549 act = E5Action( 3549 act = E5Action(
3550 self.trUtf8('Delete session'), 3550 self.tr('Delete session'),
3551 self.trUtf8('Delete session'), 0, 0, 3551 self.tr('Delete session'), 0, 0,
3552 self.sessActGrp, 'project_delete_session') 3552 self.sessActGrp, 'project_delete_session')
3553 act.setStatusTip(self.trUtf8('Delete the projects session file.')) 3553 act.setStatusTip(self.tr('Delete the projects session file.'))
3554 act.setWhatsThis(self.trUtf8( 3554 act.setWhatsThis(self.tr(
3555 """<b>Delete session</b>""" 3555 """<b>Delete session</b>"""
3556 """<p>This deletes the projects session file</p>""" 3556 """<p>This deletes the projects session file</p>"""
3557 )) 3557 ))
3558 act.triggered[()].connect(self.__deleteSession) 3558 act.triggered[()].connect(self.__deleteSession)
3559 self.actions.append(act) 3559 self.actions.append(act)
3560 3560
3561 self.chkGrp = createActionGroup(self) 3561 self.chkGrp = createActionGroup(self)
3562 3562
3563 self.codeMetricsAct = E5Action( 3563 self.codeMetricsAct = E5Action(
3564 self.trUtf8('Code Metrics'), 3564 self.tr('Code Metrics'),
3565 self.trUtf8('&Code Metrics...'), 0, 0, 3565 self.tr('&Code Metrics...'), 0, 0,
3566 self.chkGrp, 'project_code_metrics') 3566 self.chkGrp, 'project_code_metrics')
3567 self.codeMetricsAct.setStatusTip( 3567 self.codeMetricsAct.setStatusTip(
3568 self.trUtf8('Show some code metrics for the project.')) 3568 self.tr('Show some code metrics for the project.'))
3569 self.codeMetricsAct.setWhatsThis(self.trUtf8( 3569 self.codeMetricsAct.setWhatsThis(self.tr(
3570 """<b>Code Metrics...</b>""" 3570 """<b>Code Metrics...</b>"""
3571 """<p>This shows some code metrics for all Python files in""" 3571 """<p>This shows some code metrics for all Python files in"""
3572 """ the project.</p>""" 3572 """ the project.</p>"""
3573 )) 3573 ))
3574 self.codeMetricsAct.triggered[()].connect(self.__showCodeMetrics) 3574 self.codeMetricsAct.triggered[()].connect(self.__showCodeMetrics)
3575 self.actions.append(self.codeMetricsAct) 3575 self.actions.append(self.codeMetricsAct)
3576 3576
3577 self.codeCoverageAct = E5Action( 3577 self.codeCoverageAct = E5Action(
3578 self.trUtf8('Python Code Coverage'), 3578 self.tr('Python Code Coverage'),
3579 self.trUtf8('Code Co&verage...'), 0, 0, 3579 self.tr('Code Co&verage...'), 0, 0,
3580 self.chkGrp, 'project_code_coverage') 3580 self.chkGrp, 'project_code_coverage')
3581 self.codeCoverageAct.setStatusTip( 3581 self.codeCoverageAct.setStatusTip(
3582 self.trUtf8('Show code coverage information for the project.')) 3582 self.tr('Show code coverage information for the project.'))
3583 self.codeCoverageAct.setWhatsThis(self.trUtf8( 3583 self.codeCoverageAct.setWhatsThis(self.tr(
3584 """<b>Code Coverage...</b>""" 3584 """<b>Code Coverage...</b>"""
3585 """<p>This shows the code coverage information for all Python""" 3585 """<p>This shows the code coverage information for all Python"""
3586 """ files in the project.</p>""" 3586 """ files in the project.</p>"""
3587 )) 3587 ))
3588 self.codeCoverageAct.triggered[()].connect(self.__showCodeCoverage) 3588 self.codeCoverageAct.triggered[()].connect(self.__showCodeCoverage)
3589 self.actions.append(self.codeCoverageAct) 3589 self.actions.append(self.codeCoverageAct)
3590 3590
3591 self.codeProfileAct = E5Action( 3591 self.codeProfileAct = E5Action(
3592 self.trUtf8('Profile Data'), 3592 self.tr('Profile Data'),
3593 self.trUtf8('&Profile Data...'), 0, 0, 3593 self.tr('&Profile Data...'), 0, 0,
3594 self.chkGrp, 'project_profile_data') 3594 self.chkGrp, 'project_profile_data')
3595 self.codeProfileAct.setStatusTip( 3595 self.codeProfileAct.setStatusTip(
3596 self.trUtf8('Show profiling data for the project.')) 3596 self.tr('Show profiling data for the project.'))
3597 self.codeProfileAct.setWhatsThis(self.trUtf8( 3597 self.codeProfileAct.setWhatsThis(self.tr(
3598 """<b>Profile Data...</b>""" 3598 """<b>Profile Data...</b>"""
3599 """<p>This shows the profiling data for the project.</p>""" 3599 """<p>This shows the profiling data for the project.</p>"""
3600 )) 3600 ))
3601 self.codeProfileAct.triggered[()].connect(self.__showProfileData) 3601 self.codeProfileAct.triggered[()].connect(self.__showProfileData)
3602 self.actions.append(self.codeProfileAct) 3602 self.actions.append(self.codeProfileAct)
3603 3603
3604 self.graphicsGrp = createActionGroup(self) 3604 self.graphicsGrp = createActionGroup(self)
3605 3605
3606 self.applicationDiagramAct = E5Action( 3606 self.applicationDiagramAct = E5Action(
3607 self.trUtf8('Application Diagram'), 3607 self.tr('Application Diagram'),
3608 self.trUtf8('&Application Diagram...'), 0, 0, 3608 self.tr('&Application Diagram...'), 0, 0,
3609 self.graphicsGrp, 'project_application_diagram') 3609 self.graphicsGrp, 'project_application_diagram')
3610 self.applicationDiagramAct.setStatusTip( 3610 self.applicationDiagramAct.setStatusTip(
3611 self.trUtf8('Show a diagram of the project.')) 3611 self.tr('Show a diagram of the project.'))
3612 self.applicationDiagramAct.setWhatsThis(self.trUtf8( 3612 self.applicationDiagramAct.setWhatsThis(self.tr(
3613 """<b>Application Diagram...</b>""" 3613 """<b>Application Diagram...</b>"""
3614 """<p>This shows a diagram of the project.</p>""" 3614 """<p>This shows a diagram of the project.</p>"""
3615 )) 3615 ))
3616 self.applicationDiagramAct.triggered[()].connect( 3616 self.applicationDiagramAct.triggered[()].connect(
3617 self.handleApplicationDiagram) 3617 self.handleApplicationDiagram)
3618 self.actions.append(self.applicationDiagramAct) 3618 self.actions.append(self.applicationDiagramAct)
3619 3619
3620 self.loadDiagramAct = E5Action( 3620 self.loadDiagramAct = E5Action(
3621 self.trUtf8('Load Diagram'), 3621 self.tr('Load Diagram'),
3622 self.trUtf8('&Load Diagram...'), 0, 0, 3622 self.tr('&Load Diagram...'), 0, 0,
3623 self.graphicsGrp, 'project_load_diagram') 3623 self.graphicsGrp, 'project_load_diagram')
3624 self.loadDiagramAct.setStatusTip( 3624 self.loadDiagramAct.setStatusTip(
3625 self.trUtf8('Load a diagram from file.')) 3625 self.tr('Load a diagram from file.'))
3626 self.loadDiagramAct.setWhatsThis(self.trUtf8( 3626 self.loadDiagramAct.setWhatsThis(self.tr(
3627 """<b>Load Diagram...</b>""" 3627 """<b>Load Diagram...</b>"""
3628 """<p>This loads a diagram from file.</p>""" 3628 """<p>This loads a diagram from file.</p>"""
3629 )) 3629 ))
3630 self.loadDiagramAct.triggered[()].connect(self.__loadDiagram) 3630 self.loadDiagramAct.triggered[()].connect(self.__loadDiagram)
3631 self.actions.append(self.loadDiagramAct) 3631 self.actions.append(self.loadDiagramAct)
3632 3632
3633 self.pluginGrp = createActionGroup(self) 3633 self.pluginGrp = createActionGroup(self)
3634 3634
3635 self.pluginPkgListAct = E5Action( 3635 self.pluginPkgListAct = E5Action(
3636 self.trUtf8('Create Package List'), 3636 self.tr('Create Package List'),
3637 UI.PixmapCache.getIcon("pluginArchiveList.png"), 3637 UI.PixmapCache.getIcon("pluginArchiveList.png"),
3638 self.trUtf8('Create &Package List'), 0, 0, 3638 self.tr('Create &Package List'), 0, 0,
3639 self.pluginGrp, 'project_plugin_pkglist') 3639 self.pluginGrp, 'project_plugin_pkglist')
3640 self.pluginPkgListAct.setStatusTip( 3640 self.pluginPkgListAct.setStatusTip(
3641 self.trUtf8('Create an initial PKGLIST file for an eric5 plugin.')) 3641 self.tr('Create an initial PKGLIST file for an eric5 plugin.'))
3642 self.pluginPkgListAct.setWhatsThis(self.trUtf8( 3642 self.pluginPkgListAct.setWhatsThis(self.tr(
3643 """<b>Create Package List</b>""" 3643 """<b>Create Package List</b>"""
3644 """<p>This creates an initial list of files to include in an""" 3644 """<p>This creates an initial list of files to include in an"""
3645 """ eric5 plugin archive. The list is created from the project""" 3645 """ eric5 plugin archive. The list is created from the project"""
3646 """ file.</p>""" 3646 """ file.</p>"""
3647 )) 3647 ))
3648 self.pluginPkgListAct.triggered[()].connect(self.__pluginCreatePkgList) 3648 self.pluginPkgListAct.triggered[()].connect(self.__pluginCreatePkgList)
3649 self.actions.append(self.pluginPkgListAct) 3649 self.actions.append(self.pluginPkgListAct)
3650 3650
3651 self.pluginArchiveAct = E5Action( 3651 self.pluginArchiveAct = E5Action(
3652 self.trUtf8('Create Plugin Archive'), 3652 self.tr('Create Plugin Archive'),
3653 UI.PixmapCache.getIcon("pluginArchive.png"), 3653 UI.PixmapCache.getIcon("pluginArchive.png"),
3654 self.trUtf8('Create Plugin &Archive'), 0, 0, 3654 self.tr('Create Plugin &Archive'), 0, 0,
3655 self.pluginGrp, 'project_plugin_archive') 3655 self.pluginGrp, 'project_plugin_archive')
3656 self.pluginArchiveAct.setStatusTip( 3656 self.pluginArchiveAct.setStatusTip(
3657 self.trUtf8('Create an eric5 plugin archive file.')) 3657 self.tr('Create an eric5 plugin archive file.'))
3658 self.pluginArchiveAct.setWhatsThis(self.trUtf8( 3658 self.pluginArchiveAct.setWhatsThis(self.tr(
3659 """<b>Create Plugin Archive</b>""" 3659 """<b>Create Plugin Archive</b>"""
3660 """<p>This creates an eric5 plugin archive file using the list""" 3660 """<p>This creates an eric5 plugin archive file using the list"""
3661 """ of files given in the PKGLIST file. The archive name is""" 3661 """ of files given in the PKGLIST file. The archive name is"""
3662 """ built from the main script name.</p>""" 3662 """ built from the main script name.</p>"""
3663 )) 3663 ))
3664 self.pluginArchiveAct.triggered[()].connect(self.__pluginCreateArchive) 3664 self.pluginArchiveAct.triggered[()].connect(self.__pluginCreateArchive)
3665 self.actions.append(self.pluginArchiveAct) 3665 self.actions.append(self.pluginArchiveAct)
3666 3666
3667 self.pluginSArchiveAct = E5Action( 3667 self.pluginSArchiveAct = E5Action(
3668 self.trUtf8('Create Plugin Archive (Snapshot)'), 3668 self.tr('Create Plugin Archive (Snapshot)'),
3669 UI.PixmapCache.getIcon("pluginArchiveSnapshot.png"), 3669 UI.PixmapCache.getIcon("pluginArchiveSnapshot.png"),
3670 self.trUtf8('Create Plugin Archive (&Snapshot)'), 0, 0, 3670 self.tr('Create Plugin Archive (&Snapshot)'), 0, 0,
3671 self.pluginGrp, 'project_plugin_sarchive') 3671 self.pluginGrp, 'project_plugin_sarchive')
3672 self.pluginSArchiveAct.setStatusTip(self.trUtf8( 3672 self.pluginSArchiveAct.setStatusTip(self.tr(
3673 'Create an eric5 plugin archive file (snapshot release).')) 3673 'Create an eric5 plugin archive file (snapshot release).'))
3674 self.pluginSArchiveAct.setWhatsThis(self.trUtf8( 3674 self.pluginSArchiveAct.setWhatsThis(self.tr(
3675 """<b>Create Plugin Archive (Snapshot)</b>""" 3675 """<b>Create Plugin Archive (Snapshot)</b>"""
3676 """<p>This creates an eric5 plugin archive file using the list""" 3676 """<p>This creates an eric5 plugin archive file using the list"""
3677 """ of files given in the PKGLIST file. The archive name is""" 3677 """ of files given in the PKGLIST file. The archive name is"""
3678 """ built from the main script name. The version entry of the""" 3678 """ built from the main script name. The version entry of the"""
3679 """ main script is modified to reflect a snapshot release.</p>""" 3679 """ main script is modified to reflect a snapshot release.</p>"""
3698 """ 3698 """
3699 Public slot to initialize the project menu. 3699 Public slot to initialize the project menu.
3700 3700
3701 @return the menu generated (QMenu) 3701 @return the menu generated (QMenu)
3702 """ 3702 """
3703 menu = QMenu(self.trUtf8('&Project'), self.parent()) 3703 menu = QMenu(self.tr('&Project'), self.parent())
3704 self.recentMenu = QMenu(self.trUtf8('Open &Recent Projects'), menu) 3704 self.recentMenu = QMenu(self.tr('Open &Recent Projects'), menu)
3705 self.vcsMenu = QMenu(self.trUtf8('&Version Control'), menu) 3705 self.vcsMenu = QMenu(self.tr('&Version Control'), menu)
3706 self.vcsMenu.setTearOffEnabled(True) 3706 self.vcsMenu.setTearOffEnabled(True)
3707 self.vcsProjectHelper.initMenu(self.vcsMenu) 3707 self.vcsProjectHelper.initMenu(self.vcsMenu)
3708 self.vcsMenu.setEnabled(self.vcsSoftwareAvailable()) 3708 self.vcsMenu.setEnabled(self.vcsSoftwareAvailable())
3709 self.checksMenu = QMenu(self.trUtf8('Chec&k'), menu) 3709 self.checksMenu = QMenu(self.tr('Chec&k'), menu)
3710 self.checksMenu.setTearOffEnabled(True) 3710 self.checksMenu.setTearOffEnabled(True)
3711 self.menuShow = QMenu(self.trUtf8('Sho&w'), menu) 3711 self.menuShow = QMenu(self.tr('Sho&w'), menu)
3712 self.graphicsMenu = QMenu(self.trUtf8('&Diagrams'), menu) 3712 self.graphicsMenu = QMenu(self.tr('&Diagrams'), menu)
3713 self.sessionMenu = QMenu(self.trUtf8('Session'), menu) 3713 self.sessionMenu = QMenu(self.tr('Session'), menu)
3714 self.apidocMenu = QMenu(self.trUtf8('Source &Documentation'), menu) 3714 self.apidocMenu = QMenu(self.tr('Source &Documentation'), menu)
3715 self.apidocMenu.setTearOffEnabled(True) 3715 self.apidocMenu.setTearOffEnabled(True)
3716 self.debuggerMenu = QMenu(self.trUtf8('Debugger'), menu) 3716 self.debuggerMenu = QMenu(self.tr('Debugger'), menu)
3717 self.packagersMenu = QMenu(self.trUtf8('Pac&kagers'), menu) 3717 self.packagersMenu = QMenu(self.tr('Pac&kagers'), menu)
3718 self.packagersMenu.setTearOffEnabled(True) 3718 self.packagersMenu.setTearOffEnabled(True)
3719 3719
3720 self.__menus = { 3720 self.__menus = {
3721 "Main": menu, 3721 "Main": menu,
3722 "Recent": self.recentMenu, 3722 "Recent": self.recentMenu,
3816 3816
3817 @param toolbarManager reference to a toolbar manager object 3817 @param toolbarManager reference to a toolbar manager object
3818 (E5ToolBarManager) 3818 (E5ToolBarManager)
3819 @return the toolbar generated (QToolBar) 3819 @return the toolbar generated (QToolBar)
3820 """ 3820 """
3821 tb = QToolBar(self.trUtf8("Project"), self.ui) 3821 tb = QToolBar(self.tr("Project"), self.ui)
3822 tb.setIconSize(UI.Config.ToolBarIconSize) 3822 tb.setIconSize(UI.Config.ToolBarIconSize)
3823 tb.setObjectName("ProjectToolbar") 3823 tb.setObjectName("ProjectToolbar")
3824 tb.setToolTip(self.trUtf8('Project')) 3824 tb.setToolTip(self.tr('Project'))
3825 3825
3826 tb.addActions(self.actGrp1.actions()) 3826 tb.addActions(self.actGrp1.actions())
3827 tb.addAction(self.closeAct) 3827 tb.addAction(self.closeAct)
3828 tb.addSeparator() 3828 tb.addSeparator()
3829 tb.addAction(self.saveAct) 3829 tb.addAction(self.saveAct)
3881 act.setData(rp) 3881 act.setData(rp)
3882 act.setEnabled(QFileInfo(rp).exists()) 3882 act.setEnabled(QFileInfo(rp).exists())
3883 idx += 1 3883 idx += 1
3884 3884
3885 self.recentMenu.addSeparator() 3885 self.recentMenu.addSeparator()
3886 self.recentMenu.addAction(self.trUtf8('&Clear'), self.__clearRecent) 3886 self.recentMenu.addAction(self.tr('&Clear'), self.__clearRecent)
3887 3887
3888 def __openRecent(self, act): 3888 def __openRecent(self, act):
3889 """ 3889 """
3890 Private method to open a project from the list of rencently opened 3890 Private method to open a project from the list of rencently opened
3891 projects. 3891 projects.
4003 # if newfiles is empty, put up message box informing user nothing found 4003 # if newfiles is empty, put up message box informing user nothing found
4004 if not newFiles: 4004 if not newFiles:
4005 if onUserDemand: 4005 if onUserDemand:
4006 E5MessageBox.information( 4006 E5MessageBox.information(
4007 self.ui, 4007 self.ui,
4008 self.trUtf8("Search New Files"), 4008 self.tr("Search New Files"),
4009 self.trUtf8("There were no new files found to be added.")) 4009 self.tr("There were no new files found to be added."))
4010 return 4010 return
4011 4011
4012 # autoInclude is not set, show a dialog 4012 # autoInclude is not set, show a dialog
4013 from .AddFoundFilesDialog import AddFoundFilesDialog 4013 from .AddFoundFilesDialog import AddFoundFilesDialog
4014 dlg = AddFoundFilesDialog(newFiles, self.parent(), None) 4014 dlg = AddFoundFilesDialog(newFiles, self.parent(), None)
4138 if override: 4138 if override:
4139 # override failed, revert to original 4139 # override failed, revert to original
4140 QApplication.restoreOverrideCursor() 4140 QApplication.restoreOverrideCursor()
4141 E5MessageBox.critical( 4141 E5MessageBox.critical(
4142 self.ui, 4142 self.ui,
4143 self.trUtf8("Version Control System"), 4143 self.tr("Version Control System"),
4144 self.trUtf8( 4144 self.tr(
4145 "<p>The selected VCS <b>{0}</b> could not be" 4145 "<p>The selected VCS <b>{0}</b> could not be"
4146 " found. <br/>Reverting override.</p><p>{1}</p>") 4146 " found. <br/>Reverting override.</p><p>{1}</p>")
4147 .format(vcsSystem, msg)) 4147 .format(vcsSystem, msg))
4148 self.pudata["VCSOVERRIDE"] = [] 4148 self.pudata["VCSOVERRIDE"] = []
4149 return self.initVCS(nooverride=True) 4149 return self.initVCS(nooverride=True)
4150 4150
4151 QApplication.restoreOverrideCursor() 4151 QApplication.restoreOverrideCursor()
4152 E5MessageBox.critical( 4152 E5MessageBox.critical(
4153 self.ui, 4153 self.ui,
4154 self.trUtf8("Version Control System"), 4154 self.tr("Version Control System"),
4155 self.trUtf8( 4155 self.tr(
4156 "<p>The selected VCS <b>{0}</b> could not be" 4156 "<p>The selected VCS <b>{0}</b> could not be"
4157 " found.<br/>Disabling version control.</p>" 4157 " found.<br/>Disabling version control.</p>"
4158 "<p>{1}</p>").format(vcsSystem, msg)) 4158 "<p>{1}</p>").format(vcsSystem, msg))
4159 vcs = None 4159 vcs = None
4160 if forProject: 4160 if forProject:
4266 """ 4266 """
4267 fn = self.getMainScript(True) 4267 fn = self.getMainScript(True)
4268 if fn is None: 4268 if fn is None:
4269 E5MessageBox.critical( 4269 E5MessageBox.critical(
4270 self.ui, 4270 self.ui,
4271 self.trUtf8("Coverage Data"), 4271 self.tr("Coverage Data"),
4272 self.trUtf8( 4272 self.tr(
4273 "There is no main script defined for the" 4273 "There is no main script defined for the"
4274 " current project. Aborting")) 4274 " current project. Aborting"))
4275 return 4275 return
4276 4276
4277 tfn = Utilities.getTestFileName(fn) 4277 tfn = Utilities.getTestFileName(fn)
4289 4289
4290 if files: 4290 if files:
4291 if len(files) > 1: 4291 if len(files) > 1:
4292 fn, ok = QInputDialog.getItem( 4292 fn, ok = QInputDialog.getItem(
4293 None, 4293 None,
4294 self.trUtf8("Code Coverage"), 4294 self.tr("Code Coverage"),
4295 self.trUtf8("Please select a coverage file"), 4295 self.tr("Please select a coverage file"),
4296 files, 4296 files,
4297 0, False) 4297 0, False)
4298 if not ok: 4298 if not ok:
4299 return 4299 return
4300 else: 4300 else:
4315 """ 4315 """
4316 fn = self.getMainScript(True) 4316 fn = self.getMainScript(True)
4317 if fn is None: 4317 if fn is None:
4318 E5MessageBox.critical( 4318 E5MessageBox.critical(
4319 self.ui, 4319 self.ui,
4320 self.trUtf8("Profile Data"), 4320 self.tr("Profile Data"),
4321 self.trUtf8( 4321 self.tr(
4322 "There is no main script defined for the" 4322 "There is no main script defined for the"
4323 " current project. Aborting")) 4323 " current project. Aborting"))
4324 return 4324 return
4325 4325
4326 tfn = Utilities.getTestFileName(fn) 4326 tfn = Utilities.getTestFileName(fn)
4338 4338
4339 if files: 4339 if files:
4340 if len(files) > 1: 4340 if len(files) > 1:
4341 fn, ok = QInputDialog.getItem( 4341 fn, ok = QInputDialog.getItem(
4342 None, 4342 None,
4343 self.trUtf8("Profile Data"), 4343 self.tr("Profile Data"),
4344 self.trUtf8("Please select a profile file"), 4344 self.tr("Please select a profile file"),
4345 files, 4345 files,
4346 0, False) 4346 0, False)
4347 if not ok: 4347 if not ok:
4348 return 4348 return
4349 else: 4349 else:
4392 """ 4392 """
4393 Private method to handle the application diagram context menu action. 4393 Private method to handle the application diagram context menu action.
4394 """ 4394 """
4395 res = E5MessageBox.yesNo( 4395 res = E5MessageBox.yesNo(
4396 self.ui, 4396 self.ui,
4397 self.trUtf8("Application Diagram"), 4397 self.tr("Application Diagram"),
4398 self.trUtf8("""Include module names?"""), 4398 self.tr("""Include module names?"""),
4399 yesDefault=True) 4399 yesDefault=True)
4400 4400
4401 from Graphics.UMLDialog import UMLDialog 4401 from Graphics.UMLDialog import UMLDialog
4402 self.applicationDiagram = UMLDialog(UMLDialog.ApplicationDiagram, self, 4402 self.applicationDiagram = UMLDialog(UMLDialog.ApplicationDiagram, self,
4403 self.parent(), noModules=not res) 4403 self.parent(), noModules=not res)
4510 """ 4510 """
4511 pkglist = os.path.join(self.ppath, "PKGLIST") 4511 pkglist = os.path.join(self.ppath, "PKGLIST")
4512 if os.path.exists(pkglist): 4512 if os.path.exists(pkglist):
4513 res = E5MessageBox.yesNo( 4513 res = E5MessageBox.yesNo(
4514 self.ui, 4514 self.ui,
4515 self.trUtf8("Create Package List"), 4515 self.tr("Create Package List"),
4516 self.trUtf8( 4516 self.tr(
4517 "<p>The file <b>PKGLIST</b> already" 4517 "<p>The file <b>PKGLIST</b> already"
4518 " exists.</p><p>Overwrite it?</p>"), 4518 " exists.</p><p>Overwrite it?</p>"),
4519 icon=E5MessageBox.Warning) 4519 icon=E5MessageBox.Warning)
4520 if not res: 4520 if not res:
4521 return # don't overwrite 4521 return # don't overwrite
4550 pkglistFile.write("\n") # ensure the file ends with an empty line 4550 pkglistFile.write("\n") # ensure the file ends with an empty line
4551 pkglistFile.close() 4551 pkglistFile.close()
4552 except IOError as why: 4552 except IOError as why:
4553 E5MessageBox.critical( 4553 E5MessageBox.critical(
4554 self.ui, 4554 self.ui,
4555 self.trUtf8("Create Package List"), 4555 self.tr("Create Package List"),
4556 self.trUtf8( 4556 self.tr(
4557 """<p>The file <b>PKGLIST</b> could not be created.</p>""" 4557 """<p>The file <b>PKGLIST</b> could not be created.</p>"""
4558 """<p>Reason: {0}</p>""").format(str(why))) 4558 """<p>Reason: {0}</p>""").format(str(why)))
4559 return 4559 return
4560 4560
4561 if not "PKGLIST" in self.pdata["OTHERS"]: 4561 if not "PKGLIST" in self.pdata["OTHERS"]:
4569 """ 4569 """
4570 pkglist = os.path.join(self.ppath, "PKGLIST") 4570 pkglist = os.path.join(self.ppath, "PKGLIST")
4571 if not os.path.exists(pkglist): 4571 if not os.path.exists(pkglist):
4572 E5MessageBox.critical( 4572 E5MessageBox.critical(
4573 self.ui, 4573 self.ui,
4574 self.trUtf8("Create Plugin Archive"), 4574 self.tr("Create Plugin Archive"),
4575 self.trUtf8("""<p>The file <b>PKGLIST</b> does not exist. """ 4575 self.tr("""<p>The file <b>PKGLIST</b> does not exist. """
4576 """Aborting...</p>""")) 4576 """Aborting...</p>"""))
4577 return 4577 return
4578 4578
4579 if len(self.pdata["MAINSCRIPT"]) == 0 or \ 4579 if len(self.pdata["MAINSCRIPT"]) == 0 or \
4580 len(self.pdata["MAINSCRIPT"][0]) == 0: 4580 len(self.pdata["MAINSCRIPT"][0]) == 0:
4581 E5MessageBox.critical( 4581 E5MessageBox.critical(
4582 self.ui, 4582 self.ui,
4583 self.trUtf8("Create Plugin Archive"), 4583 self.tr("Create Plugin Archive"),
4584 self.trUtf8( 4584 self.tr(
4585 """The project does not have a main script defined. """ 4585 """The project does not have a main script defined. """
4586 """Aborting...""")) 4586 """Aborting..."""))
4587 return 4587 return
4588 4588
4589 try: 4589 try:
4592 pkglistFile.close() 4592 pkglistFile.close()
4593 names = sorted(names.splitlines()) 4593 names = sorted(names.splitlines())
4594 except IOError as why: 4594 except IOError as why:
4595 E5MessageBox.critical( 4595 E5MessageBox.critical(
4596 self.ui, 4596 self.ui,
4597 self.trUtf8("Create Plugin Archive"), 4597 self.tr("Create Plugin Archive"),
4598 self.trUtf8( 4598 self.tr(
4599 """<p>The file <b>PKGLIST</b> could not be read.</p>""" 4599 """<p>The file <b>PKGLIST</b> could not be read.</p>"""
4600 """<p>Reason: {0}</p>""").format(str(why))) 4600 """<p>Reason: {0}</p>""").format(str(why)))
4601 return 4601 return
4602 4602
4603 archive = os.path.join( 4603 archive = os.path.join(
4605 try: 4605 try:
4606 archiveFile = zipfile.ZipFile(archive, "w") 4606 archiveFile = zipfile.ZipFile(archive, "w")
4607 except IOError as why: 4607 except IOError as why:
4608 E5MessageBox.critical( 4608 E5MessageBox.critical(
4609 self.ui, 4609 self.ui,
4610 self.trUtf8("Create Plugin Archive"), 4610 self.tr("Create Plugin Archive"),
4611 self.trUtf8( 4611 self.tr(
4612 """<p>The eric5 plugin archive file <b>{0}</b> could """ 4612 """<p>The eric5 plugin archive file <b>{0}</b> could """
4613 """not be created.</p>""" 4613 """not be created.</p>"""
4614 """<p>Reason: {1}</p>""").format(archive, str(why))) 4614 """<p>Reason: {1}</p>""").format(archive, str(why)))
4615 return 4615 return
4616 4616
4631 os.path.join(self.ppath, 4631 os.path.join(self.ppath,
4632 self.pdata["MAINSCRIPT"][0])) 4632 self.pdata["MAINSCRIPT"][0]))
4633 except OSError as why: 4633 except OSError as why:
4634 E5MessageBox.critical( 4634 E5MessageBox.critical(
4635 self.ui, 4635 self.ui,
4636 self.trUtf8("Create Plugin Archive"), 4636 self.tr("Create Plugin Archive"),
4637 self.trUtf8( 4637 self.tr(
4638 """<p>The file <b>{0}</b> could not be stored """ 4638 """<p>The file <b>{0}</b> could not be stored """
4639 """in the archive. Ignoring it.</p>""" 4639 """in the archive. Ignoring it.</p>"""
4640 """<p>Reason: {1}</p>""") 4640 """<p>Reason: {1}</p>""")
4641 .format(os.path.join(self.ppath, name), str(why))) 4641 .format(os.path.join(self.ppath, name), str(why)))
4642 archiveFile.writestr("VERSION", version.encode("utf-8")) 4642 archiveFile.writestr("VERSION", version.encode("utf-8"))
4646 self.appendFile(archive) 4646 self.appendFile(archive)
4647 4647
4648 if self.ui.notificationsEnabled(): 4648 if self.ui.notificationsEnabled():
4649 self.ui.showNotification( 4649 self.ui.showNotification(
4650 UI.PixmapCache.getPixmap("pluginArchive48.png"), 4650 UI.PixmapCache.getPixmap("pluginArchive48.png"),
4651 self.trUtf8("Create Plugin Archive"), 4651 self.tr("Create Plugin Archive"),
4652 self.trUtf8( 4652 self.tr(
4653 """<p>The eric5 plugin archive file <b>{0}</b> was """ 4653 """<p>The eric5 plugin archive file <b>{0}</b> was """
4654 """created successfully.</p>""") 4654 """created successfully.</p>""")
4655 .format(os.path.basename(archive))) 4655 .format(os.path.basename(archive)))
4656 else: 4656 else:
4657 E5MessageBox.information( 4657 E5MessageBox.information(
4658 self.ui, 4658 self.ui,
4659 self.trUtf8("Create Plugin Archive"), 4659 self.tr("Create Plugin Archive"),
4660 self.trUtf8( 4660 self.tr(
4661 """<p>The eric5 plugin archive file <b>{0}</b> was """ 4661 """<p>The eric5 plugin archive file <b>{0}</b> was """
4662 """created successfully.</p>""").format(archive)) 4662 """created successfully.</p>""").format(archive))
4663 4663
4664 def __pluginCreateSnapshotArchive(self): 4664 def __pluginCreateSnapshotArchive(self):
4665 """ 4665 """
4699 sourcelines, encoding = Utilities.readEncodedFile(filename) 4699 sourcelines, encoding = Utilities.readEncodedFile(filename)
4700 sourcelines = sourcelines.splitlines(True) 4700 sourcelines = sourcelines.splitlines(True)
4701 except (IOError, UnicodeError) as why: 4701 except (IOError, UnicodeError) as why:
4702 E5MessageBox.critical( 4702 E5MessageBox.critical(
4703 self.ui, 4703 self.ui,
4704 self.trUtf8("Create Plugin Archive"), 4704 self.tr("Create Plugin Archive"),
4705 self.trUtf8("""<p>The plugin file <b>{0}</b> could """ 4705 self.tr("""<p>The plugin file <b>{0}</b> could """
4706 """not be read.</p>""" 4706 """not be read.</p>"""
4707 """<p>Reason: {1}</p>""") 4707 """<p>Reason: {1}</p>""")
4708 .format(filename, str(why))) 4708 .format(filename, str(why)))
4709 return b"", "" 4709 return b"", ""
4710 4710
4711 lineno = 0 4711 lineno = 0
4712 while lineno < len(sourcelines): 4712 while lineno < len(sourcelines):
4740 sourcelines = Utilities.readEncodedFile(filename)[0] 4740 sourcelines = Utilities.readEncodedFile(filename)[0]
4741 sourcelines = sourcelines.splitlines(True) 4741 sourcelines = sourcelines.splitlines(True)
4742 except (IOError, UnicodeError) as why: 4742 except (IOError, UnicodeError) as why:
4743 E5MessageBox.critical( 4743 E5MessageBox.critical(
4744 self.ui, 4744 self.ui,
4745 self.trUtf8("Create Plugin Archive"), 4745 self.tr("Create Plugin Archive"),
4746 self.trUtf8( 4746 self.tr(
4747 """<p>The plugin file <b>{0}</b> could """ 4747 """<p>The plugin file <b>{0}</b> could """
4748 """not be read.</p> <p>Reason: {1}</p>""") 4748 """not be read.</p> <p>Reason: {1}</p>""")
4749 .format(filename, str(why))) 4749 .format(filename, str(why)))
4750 return "" 4750 return ""
4751 4751

eric ide

mercurial