24 from PyQt6.QtWidgets import ( |
24 from PyQt6.QtWidgets import ( |
25 QLineEdit, QToolBar, QDialog, QInputDialog, QApplication, QMenu |
25 QLineEdit, QToolBar, QDialog, QInputDialog, QApplication, QMenu |
26 ) |
26 ) |
27 from PyQt6.Qsci import QsciScintilla |
27 from PyQt6.Qsci import QsciScintilla |
28 |
28 |
29 from E5Gui.E5Application import e5App |
29 from E5Gui.EricApplication import ericApp |
30 from E5Gui import E5FileDialog, E5MessageBox |
30 from E5Gui import EricFileDialog, EricMessageBox |
31 from E5Gui.E5ListSelectionDialog import E5ListSelectionDialog |
31 from E5Gui.EricListSelectionDialog import EricListSelectionDialog |
32 from E5Gui.E5ProgressDialog import E5ProgressDialog |
32 from E5Gui.EricProgressDialog import EricProgressDialog |
33 from E5Gui.E5OverrideCursor import E5OverrideCursor, E5OverridenCursor |
33 from E5Gui.EricOverrideCursor import EricOverrideCursor, EricOverridenCursor |
34 |
34 |
35 from Globals import recentNameProject |
35 from Globals import recentNameProject |
36 |
36 |
37 import UI.PixmapCache |
37 import UI.PixmapCache |
38 from UI.NotificationWidget import NotificationTypes |
38 from UI.NotificationWidget import NotificationTypes |
39 |
39 |
40 from E5Gui.E5Action import E5Action, createActionGroup |
40 from E5Gui.EricAction import EricAction, createActionGroup |
41 |
41 |
42 import Preferences |
42 import Preferences |
43 import Utilities |
43 import Utilities |
44 |
44 |
45 from .ProjectFile import ProjectFile |
45 from .ProjectFile import ProjectFile |
359 project type (list of string) |
359 project type (list of string) |
360 """ |
360 """ |
361 if progLanguages: |
361 if progLanguages: |
362 for progLanguage in progLanguages: |
362 for progLanguage in progLanguages: |
363 if progLanguage not in self.__projectProgLanguages: |
363 if progLanguage not in self.__projectProgLanguages: |
364 E5MessageBox.critical( |
364 EricMessageBox.critical( |
365 self.ui, |
365 self.ui, |
366 self.tr("Registering Project Type"), |
366 self.tr("Registering Project Type"), |
367 self.tr( |
367 self.tr( |
368 """<p>The Programming Language <b>{0}</b> is not""" |
368 """<p>The Programming Language <b>{0}</b> is not""" |
369 """ supported (project type: {1}).</p>""") |
369 """ supported (project type: {1}).</p>""") |
370 .format(progLanguage, type_) |
370 .format(progLanguage, type_) |
371 ) |
371 ) |
372 return |
372 return |
373 |
373 |
374 if type_ in self.__projectProgLanguages[progLanguage]: |
374 if type_ in self.__projectProgLanguages[progLanguage]: |
375 E5MessageBox.critical( |
375 EricMessageBox.critical( |
376 self.ui, |
376 self.ui, |
377 self.tr("Registering Project Type"), |
377 self.tr("Registering Project Type"), |
378 self.tr( |
378 self.tr( |
379 """<p>The Project type <b>{0}</b> is already""" |
379 """<p>The Project type <b>{0}</b> is already""" |
380 """ registered with Programming Language""" |
380 """ registered with Programming Language""" |
382 .format(type_, progLanguage) |
382 .format(type_, progLanguage) |
383 ) |
383 ) |
384 return |
384 return |
385 |
385 |
386 if type_ in self.__projectTypes: |
386 if type_ in self.__projectTypes: |
387 E5MessageBox.critical( |
387 EricMessageBox.critical( |
388 self.ui, |
388 self.ui, |
389 self.tr("Registering Project Type"), |
389 self.tr("Registering Project Type"), |
390 self.tr("""<p>The Project type <b>{0}</b> is already""" |
390 self.tr("""<p>The Project type <b>{0}</b> is already""" |
391 """ registered.</p>""").format(type_) |
391 """ registered.</p>""").format(type_) |
392 ) |
392 ) |
803 @param fn filename of the project file to be read (string) |
803 @param fn filename of the project file to be read (string) |
804 @return flag indicating success |
804 @return flag indicating success |
805 """ |
805 """ |
806 if os.path.splitext(fn)[1] == ".epj": |
806 if os.path.splitext(fn)[1] == ".epj": |
807 # new JSON based format |
807 # new JSON based format |
808 with E5OverrideCursor(): |
808 with EricOverrideCursor(): |
809 res = self.__projectFile.readFile(fn) |
809 res = self.__projectFile.readFile(fn) |
810 else: |
810 else: |
811 # old XML based format |
811 # old XML based format |
812 f = QFile(fn) |
812 f = QFile(fn) |
813 if f.open(QIODevice.OpenModeFlag.ReadOnly): |
813 if f.open(QIODevice.OpenModeFlag.ReadOnly): |
824 QCryptographicHash.Algorithm.Sha1).toHex(), |
824 QCryptographicHash.Algorithm.Sha1).toHex(), |
825 encoding="utf-8") |
825 encoding="utf-8") |
826 self.pdata["HASH"] = hashStr |
826 self.pdata["HASH"] = hashStr |
827 self.setDirty(True) |
827 self.setDirty(True) |
828 else: |
828 else: |
829 E5MessageBox.critical( |
829 EricMessageBox.critical( |
830 self.ui, |
830 self.ui, |
831 self.tr("Read Project File"), |
831 self.tr("Read Project File"), |
832 self.tr( |
832 self.tr( |
833 "<p>The project file <b>{0}</b> could not be read." |
833 "<p>The project file <b>{0}</b> could not be read." |
834 "</p>") |
834 "</p>") |
952 from EricXML.UserProjectReader import UserProjectReader |
952 from EricXML.UserProjectReader import UserProjectReader |
953 reader = UserProjectReader(f, self) |
953 reader = UserProjectReader(f, self) |
954 reader.readXML() |
954 reader.readXML() |
955 f.close() |
955 f.close() |
956 else: |
956 else: |
957 E5MessageBox.critical( |
957 EricMessageBox.critical( |
958 self.ui, |
958 self.ui, |
959 self.tr("Read User Project Properties"), |
959 self.tr("Read User Project Properties"), |
960 self.tr( |
960 self.tr( |
961 "<p>The user specific project properties file" |
961 "<p>The user specific project properties file" |
962 " <b>{0}</b> could not be read.</p>").format(fn)) |
962 " <b>{0}</b> could not be read.</p>").format(fn)) |
969 return |
969 return |
970 |
970 |
971 fn, ext = os.path.splitext(os.path.basename(self.pfile)) |
971 fn, ext = os.path.splitext(os.path.basename(self.pfile)) |
972 fn = os.path.join(self.getProjectManagementDir(), '{0}.eqj'.format(fn)) |
972 fn = os.path.join(self.getProjectManagementDir(), '{0}.eqj'.format(fn)) |
973 |
973 |
974 with E5OverrideCursor(): |
974 with EricOverrideCursor(): |
975 self.__userProjectFile.writeFile(fn) |
975 self.__userProjectFile.writeFile(fn) |
976 |
976 |
977 def __showContextMenuSession(self): |
977 def __showContextMenuSession(self): |
978 """ |
978 """ |
979 Private slot called before the Session menu is shown. |
979 Private slot called before the Session menu is shown. |
1002 If this flag is true, no errors are reported. |
1002 If this flag is true, no errors are reported. |
1003 @param indicator indicator string (string) |
1003 @param indicator indicator string (string) |
1004 """ |
1004 """ |
1005 if self.pfile is None: |
1005 if self.pfile is None: |
1006 if not quiet: |
1006 if not quiet: |
1007 E5MessageBox.critical( |
1007 EricMessageBox.critical( |
1008 self.ui, |
1008 self.ui, |
1009 self.tr("Read Project Session"), |
1009 self.tr("Read Project Session"), |
1010 self.tr("Please save the project first.")) |
1010 self.tr("Please save the project first.")) |
1011 return |
1011 return |
1012 |
1012 |
1027 reader = SessionReader(f, False) |
1027 reader = SessionReader(f, False) |
1028 reader.readXML(quiet=quiet) |
1028 reader.readXML(quiet=quiet) |
1029 f.close() |
1029 f.close() |
1030 else: |
1030 else: |
1031 if not quiet: |
1031 if not quiet: |
1032 E5MessageBox.critical( |
1032 EricMessageBox.critical( |
1033 self.ui, |
1033 self.ui, |
1034 self.tr("Read project session"), |
1034 self.tr("Read project session"), |
1035 self.tr( |
1035 self.tr( |
1036 "<p>The project session file <b>{0}</b> could" |
1036 "<p>The project session file <b>{0}</b> could" |
1037 " not be read.</p>").format(fn)) |
1037 " not be read.</p>").format(fn)) |
1045 If this flag is true, no errors are reported. |
1045 If this flag is true, no errors are reported. |
1046 @param indicator indicator string (string) |
1046 @param indicator indicator string (string) |
1047 """ |
1047 """ |
1048 if self.pfile is None: |
1048 if self.pfile is None: |
1049 if not quiet: |
1049 if not quiet: |
1050 E5MessageBox.critical( |
1050 EricMessageBox.critical( |
1051 self.ui, |
1051 self.ui, |
1052 self.tr("Save Project Session"), |
1052 self.tr("Save Project Session"), |
1053 self.tr("Please save the project first.")) |
1053 self.tr("Please save the project first.")) |
1054 return |
1054 return |
1055 |
1055 |
1062 def __deleteSession(self): |
1062 def __deleteSession(self): |
1063 """ |
1063 """ |
1064 Private method to delete the session file. |
1064 Private method to delete the session file. |
1065 """ |
1065 """ |
1066 if self.pfile is None: |
1066 if self.pfile is None: |
1067 E5MessageBox.critical( |
1067 EricMessageBox.critical( |
1068 self.ui, |
1068 self.ui, |
1069 self.tr("Delete Project Session"), |
1069 self.tr("Delete Project Session"), |
1070 self.tr("Please save the project first.")) |
1070 self.tr("Please save the project first.")) |
1071 return |
1071 return |
1072 |
1072 |
1077 self.getProjectManagementDir(), "{0}{1}".format(fname, ext)), |
1077 self.getProjectManagementDir(), "{0}{1}".format(fname, ext)), |
1078 if os.path.exists(fn): |
1078 if os.path.exists(fn): |
1079 try: |
1079 try: |
1080 os.remove(fn) |
1080 os.remove(fn) |
1081 except OSError: |
1081 except OSError: |
1082 E5MessageBox.critical( |
1082 EricMessageBox.critical( |
1083 self.ui, |
1083 self.ui, |
1084 self.tr("Delete Project Session"), |
1084 self.tr("Delete Project Session"), |
1085 self.tr( |
1085 self.tr( |
1086 "<p>The project session file <b>{0}</b> could" |
1086 "<p>The project session file <b>{0}</b> could" |
1087 " not be deleted.</p>").format(fn)) |
1087 " not be deleted.</p>").format(fn)) |
1089 def __readTasks(self): |
1089 def __readTasks(self): |
1090 """ |
1090 """ |
1091 Private method to read in the project tasks file (.etj or .e6t). |
1091 Private method to read in the project tasks file (.etj or .e6t). |
1092 """ |
1092 """ |
1093 if self.pfile is None: |
1093 if self.pfile is None: |
1094 E5MessageBox.critical( |
1094 EricMessageBox.critical( |
1095 self.ui, |
1095 self.ui, |
1096 self.tr("Read Tasks"), |
1096 self.tr("Read Tasks"), |
1097 self.tr("Please save the project first.")) |
1097 self.tr("Please save the project first.")) |
1098 return |
1098 return |
1099 |
1099 |
1113 from EricXML.TasksReader import TasksReader |
1113 from EricXML.TasksReader import TasksReader |
1114 reader = TasksReader(f, True) |
1114 reader = TasksReader(f, True) |
1115 reader.readXML() |
1115 reader.readXML() |
1116 f.close() |
1116 f.close() |
1117 else: |
1117 else: |
1118 E5MessageBox.critical( |
1118 EricMessageBox.critical( |
1119 self.ui, |
1119 self.ui, |
1120 self.tr("Read Tasks"), |
1120 self.tr("Read Tasks"), |
1121 self.tr( |
1121 self.tr( |
1122 "<p>The tasks file <b>{0}</b> could not be read." |
1122 "<p>The tasks file <b>{0}</b> could not be read." |
1123 "</p>") |
1123 "</p>") |
1167 @param quiet flag indicating quiet operations. |
1167 @param quiet flag indicating quiet operations. |
1168 If this flag is true, no errors are reported. |
1168 If this flag is true, no errors are reported. |
1169 """ |
1169 """ |
1170 if self.pfile is None: |
1170 if self.pfile is None: |
1171 if not quiet: |
1171 if not quiet: |
1172 E5MessageBox.critical( |
1172 EricMessageBox.critical( |
1173 self.ui, |
1173 self.ui, |
1174 self.tr("Read Debugger Properties"), |
1174 self.tr("Read Debugger Properties"), |
1175 self.tr("Please save the project first.")) |
1175 self.tr("Please save the project first.")) |
1176 return |
1176 return |
1177 |
1177 |
1196 f.close() |
1196 f.close() |
1197 self.debugPropertiesLoaded = True |
1197 self.debugPropertiesLoaded = True |
1198 self.debugPropertiesChanged = False |
1198 self.debugPropertiesChanged = False |
1199 else: |
1199 else: |
1200 if not quiet: |
1200 if not quiet: |
1201 E5MessageBox.critical( |
1201 EricMessageBox.critical( |
1202 self.ui, |
1202 self.ui, |
1203 self.tr("Read Debugger Properties"), |
1203 self.tr("Read Debugger Properties"), |
1204 self.tr( |
1204 self.tr( |
1205 "<p>The project debugger properties file" |
1205 "<p>The project debugger properties file" |
1206 " <b>{0}</b> could not be read.</p>").format(fn)) |
1206 " <b>{0}</b> could not be read.</p>").format(fn)) |
1213 @param quiet flag indicating quiet operations. |
1213 @param quiet flag indicating quiet operations. |
1214 If this flag is true, no errors are reported. |
1214 If this flag is true, no errors are reported. |
1215 """ |
1215 """ |
1216 if self.pfile is None: |
1216 if self.pfile is None: |
1217 if not quiet: |
1217 if not quiet: |
1218 E5MessageBox.critical( |
1218 EricMessageBox.critical( |
1219 self.ui, |
1219 self.ui, |
1220 self.tr("Save Debugger Properties"), |
1220 self.tr("Save Debugger Properties"), |
1221 self.tr("Please save the project first.")) |
1221 self.tr("Please save the project first.")) |
1222 return |
1222 return |
1223 |
1223 |
1224 fn, ext = os.path.splitext(os.path.basename(self.pfile)) |
1224 fn, ext = os.path.splitext(os.path.basename(self.pfile)) |
1225 fn = os.path.join(self.getProjectManagementDir(), '{0}.edj'.format(fn)) |
1225 fn = os.path.join(self.getProjectManagementDir(), '{0}.edj'.format(fn)) |
1226 |
1226 |
1227 with E5OverrideCursor(): |
1227 with EricOverrideCursor(): |
1228 self.__debuggerPropertiesFile.writeFile(fn) |
1228 self.__debuggerPropertiesFile.writeFile(fn) |
1229 |
1229 |
1230 def __deleteDebugProperties(self): |
1230 def __deleteDebugProperties(self): |
1231 """ |
1231 """ |
1232 Private method to delete the project debugger properties file |
1232 Private method to delete the project debugger properties file |
1233 (.edj or .e4d). |
1233 (.edj or .e4d). |
1234 """ |
1234 """ |
1235 if self.pfile is None: |
1235 if self.pfile is None: |
1236 E5MessageBox.critical( |
1236 EricMessageBox.critical( |
1237 self.ui, |
1237 self.ui, |
1238 self.tr("Delete Debugger Properties"), |
1238 self.tr("Delete Debugger Properties"), |
1239 self.tr("Please save the project first.")) |
1239 self.tr("Please save the project first.")) |
1240 return |
1240 return |
1241 |
1241 |
1246 "{0}{1}".format(fname, ext)) |
1246 "{0}{1}".format(fname, ext)) |
1247 if os.path.exists(fn): |
1247 if os.path.exists(fn): |
1248 try: |
1248 try: |
1249 os.remove(fn) |
1249 os.remove(fn) |
1250 except OSError: |
1250 except OSError: |
1251 E5MessageBox.critical( |
1251 EricMessageBox.critical( |
1252 self.ui, |
1252 self.ui, |
1253 self.tr("Delete Debugger Properties"), |
1253 self.tr("Delete Debugger Properties"), |
1254 self.tr( |
1254 self.tr( |
1255 "<p>The project debugger properties file" |
1255 "<p>The project debugger properties file" |
1256 " <b>{0}</b> could not be deleted.</p>") |
1256 " <b>{0}</b> could not be deleted.</p>") |
1303 @param key key of the property (string) |
1303 @param key key of the property (string) |
1304 @return value of the property |
1304 @return value of the property |
1305 """ |
1305 """ |
1306 if key == "INTERPRETER": |
1306 if key == "INTERPRETER": |
1307 return ( |
1307 return ( |
1308 e5App().getObject("VirtualEnvManager") |
1308 ericApp().getObject("VirtualEnvManager") |
1309 .getVirtualenvInterpreter(self.debugProperties["VIRTUALENV"]) |
1309 .getVirtualenvInterpreter(self.debugProperties["VIRTUALENV"]) |
1310 ) |
1310 ) |
1311 else: |
1311 else: |
1312 return self.debugProperties[key] |
1312 return self.debugProperties[key] |
1313 |
1313 |
1390 def addLanguage(self): |
1390 def addLanguage(self): |
1391 """ |
1391 """ |
1392 Public slot used to add a language to the project. |
1392 Public slot used to add a language to the project. |
1393 """ |
1393 """ |
1394 if not self.pdata["TRANSLATIONPATTERN"]: |
1394 if not self.pdata["TRANSLATIONPATTERN"]: |
1395 E5MessageBox.critical( |
1395 EricMessageBox.critical( |
1396 self.ui, |
1396 self.ui, |
1397 self.tr("Add Language"), |
1397 self.tr("Add Language"), |
1398 self.tr( |
1398 self.tr( |
1399 "You have to specify a translation pattern first.")) |
1399 "You have to specify a translation pattern first.")) |
1400 return |
1400 return |
1492 try: |
1492 try: |
1493 fn = os.path.join(self.ppath, langFile) |
1493 fn = os.path.join(self.ppath, langFile) |
1494 if os.path.exists(fn): |
1494 if os.path.exists(fn): |
1495 s2t(fn) |
1495 s2t(fn) |
1496 except OSError as err: |
1496 except OSError as err: |
1497 E5MessageBox.critical( |
1497 EricMessageBox.critical( |
1498 self.ui, |
1498 self.ui, |
1499 self.tr("Delete translation"), |
1499 self.tr("Delete translation"), |
1500 self.tr( |
1500 self.tr( |
1501 "<p>The selected translation file <b>{0}</b> could not be" |
1501 "<p>The selected translation file <b>{0}</b> could not be" |
1502 " deleted.</p><p>Reason: {1}</p>").format( |
1502 " deleted.</p><p>Reason: {1}</p>").format( |
1514 os.path.basename(qmFile))) |
1514 os.path.basename(qmFile))) |
1515 fn = os.path.join(self.ppath, qmFile) |
1515 fn = os.path.join(self.ppath, qmFile) |
1516 if os.path.exists(fn): |
1516 if os.path.exists(fn): |
1517 s2t(fn) |
1517 s2t(fn) |
1518 except OSError as err: |
1518 except OSError as err: |
1519 E5MessageBox.critical( |
1519 EricMessageBox.critical( |
1520 self.ui, |
1520 self.ui, |
1521 self.tr("Delete translation"), |
1521 self.tr("Delete translation"), |
1522 self.tr( |
1522 self.tr( |
1523 "<p>The selected translation file <b>{0}</b> could" |
1523 "<p>The selected translation file <b>{0}</b> could" |
1524 " not be deleted.</p><p>Reason: {1}</p>").format( |
1524 " not be deleted.</p><p>Reason: {1}</p>").format( |
1650 try: |
1650 try: |
1651 if not os.path.isdir(target): |
1651 if not os.path.isdir(target): |
1652 os.makedirs(target) |
1652 os.makedirs(target) |
1653 |
1653 |
1654 if os.path.exists(targetfile): |
1654 if os.path.exists(targetfile): |
1655 res = E5MessageBox.yesNo( |
1655 res = EricMessageBox.yesNo( |
1656 self.ui, |
1656 self.ui, |
1657 self.tr("Add file"), |
1657 self.tr("Add file"), |
1658 self.tr( |
1658 self.tr( |
1659 "<p>The file <b>{0}</b> already" |
1659 "<p>The file <b>{0}</b> already" |
1660 " exists.</p><p>Overwrite it?</p>") |
1660 " exists.</p><p>Overwrite it?</p>") |
1661 .format(targetfile), |
1661 .format(targetfile), |
1662 icon=E5MessageBox.Warning) |
1662 icon=EricMessageBox.Warning) |
1663 if not res: |
1663 if not res: |
1664 return # don't overwrite |
1664 return # don't overwrite |
1665 |
1665 |
1666 shutil.copy(fn, target) |
1666 shutil.copy(fn, target) |
1667 except OSError as why: |
1667 except OSError as why: |
1668 E5MessageBox.critical( |
1668 EricMessageBox.critical( |
1669 self.ui, |
1669 self.ui, |
1670 self.tr("Add file"), |
1670 self.tr("Add file"), |
1671 self.tr( |
1671 self.tr( |
1672 "<p>The selected file <b>{0}</b> could" |
1672 "<p>The selected file <b>{0}</b> could" |
1673 " not be added to <b>{1}</b>.</p>" |
1673 " not be added to <b>{1}</b>.</p>" |
1676 continue |
1676 continue |
1677 |
1677 |
1678 self.appendFile(targetfile, |
1678 self.appendFile(targetfile, |
1679 isSource or fileTypeFilter == 'source') |
1679 isSource or fileTypeFilter == 'source') |
1680 else: |
1680 else: |
1681 E5MessageBox.critical( |
1681 EricMessageBox.critical( |
1682 self.ui, |
1682 self.ui, |
1683 self.tr("Add file"), |
1683 self.tr("Add file"), |
1684 self.tr("The target directory must not be empty.")) |
1684 self.tr("The target directory must not be empty.")) |
1685 |
1685 |
1686 def __addSingleDirectory(self, filetype, source, target, quiet=False): |
1686 def __addSingleDirectory(self, filetype, source, target, quiet=False): |
1707 sstring = "{0}{1}{2}".format(source, os.sep, pattern) |
1707 sstring = "{0}{1}{2}".format(source, os.sep, pattern) |
1708 files.extend(glob.glob(sstring)) |
1708 files.extend(glob.glob(sstring)) |
1709 |
1709 |
1710 if len(files) == 0: |
1710 if len(files) == 0: |
1711 if not quiet: |
1711 if not quiet: |
1712 E5MessageBox.information( |
1712 EricMessageBox.information( |
1713 self.ui, |
1713 self.ui, |
1714 self.tr("Add directory"), |
1714 self.tr("Add directory"), |
1715 self.tr( |
1715 self.tr( |
1716 "<p>The source directory doesn't contain" |
1716 "<p>The source directory doesn't contain" |
1717 " any files belonging to the selected category.</p>")) |
1717 " any files belonging to the selected category.</p>")) |
1722 not os.path.isdir(target) |
1722 not os.path.isdir(target) |
1723 ): |
1723 ): |
1724 try: |
1724 try: |
1725 os.makedirs(target) |
1725 os.makedirs(target) |
1726 except OSError as why: |
1726 except OSError as why: |
1727 E5MessageBox.critical( |
1727 EricMessageBox.critical( |
1728 self.ui, |
1728 self.ui, |
1729 self.tr("Add directory"), |
1729 self.tr("Add directory"), |
1730 self.tr( |
1730 self.tr( |
1731 "<p>The target directory <b>{0}</b> could not be" |
1731 "<p>The target directory <b>{0}</b> could not be" |
1732 " created.</p><p>Reason: {1}</p>") |
1732 " created.</p><p>Reason: {1}</p>") |
1740 |
1740 |
1741 targetfile = os.path.join(target, os.path.basename(file)) |
1741 targetfile = os.path.join(target, os.path.basename(file)) |
1742 if not Utilities.samepath(target, source): |
1742 if not Utilities.samepath(target, source): |
1743 try: |
1743 try: |
1744 if os.path.exists(targetfile): |
1744 if os.path.exists(targetfile): |
1745 res = E5MessageBox.yesNo( |
1745 res = EricMessageBox.yesNo( |
1746 self.ui, |
1746 self.ui, |
1747 self.tr("Add directory"), |
1747 self.tr("Add directory"), |
1748 self.tr( |
1748 self.tr( |
1749 "<p>The file <b>{0}</b> already exists.</p>" |
1749 "<p>The file <b>{0}</b> already exists.</p>" |
1750 "<p>Overwrite it?</p>") |
1750 "<p>Overwrite it?</p>") |
1751 .format(targetfile), |
1751 .format(targetfile), |
1752 icon=E5MessageBox.Warning) |
1752 icon=EricMessageBox.Warning) |
1753 if not res: |
1753 if not res: |
1754 continue |
1754 continue |
1755 # don't overwrite, carry on with next file |
1755 # don't overwrite, carry on with next file |
1756 |
1756 |
1757 shutil.copy(file, target) |
1757 shutil.copy(file, target) |
1808 dlg = AddDirectoryDialog( |
1808 dlg = AddDirectoryDialog( |
1809 self, fileTypeFilter, self.parent(), startdir=startdir) |
1809 self, fileTypeFilter, self.parent(), startdir=startdir) |
1810 if dlg.exec() == QDialog.DialogCode.Accepted: |
1810 if dlg.exec() == QDialog.DialogCode.Accepted: |
1811 filetype, source, target, recursive = dlg.getData() |
1811 filetype, source, target, recursive = dlg.getData() |
1812 if target == '': |
1812 if target == '': |
1813 E5MessageBox.critical( |
1813 EricMessageBox.critical( |
1814 self.ui, |
1814 self.ui, |
1815 self.tr("Add directory"), |
1815 self.tr("Add directory"), |
1816 self.tr("The target directory must not be empty.")) |
1816 self.tr("The target directory must not be empty.")) |
1817 return |
1817 return |
1818 |
1818 |
1819 if filetype == 'OTHERS': |
1819 if filetype == 'OTHERS': |
1820 self.addToOthers(source) |
1820 self.addToOthers(source) |
1821 return |
1821 return |
1822 |
1822 |
1823 if source == '': |
1823 if source == '': |
1824 E5MessageBox.critical( |
1824 EricMessageBox.critical( |
1825 self.ui, |
1825 self.ui, |
1826 self.tr("Add directory"), |
1826 self.tr("Add directory"), |
1827 self.tr("The source directory must not be empty.")) |
1827 self.tr("The source directory must not be empty.")) |
1828 return |
1828 return |
1829 |
1829 |
1956 """ |
1956 """ |
1957 fn = self.getRelativePath(oldfn) |
1957 fn = self.getRelativePath(oldfn) |
1958 isSourceFile = fn in self.pdata["SOURCES"] |
1958 isSourceFile = fn in self.pdata["SOURCES"] |
1959 |
1959 |
1960 if newfn is None: |
1960 if newfn is None: |
1961 newfn = E5FileDialog.getSaveFileName( |
1961 newfn = EricFileDialog.getSaveFileName( |
1962 None, |
1962 None, |
1963 self.tr("Rename file"), |
1963 self.tr("Rename file"), |
1964 oldfn, |
1964 oldfn, |
1965 "", |
1965 "", |
1966 E5FileDialog.DontConfirmOverwrite) |
1966 EricFileDialog.DontConfirmOverwrite) |
1967 if not newfn: |
1967 if not newfn: |
1968 return False |
1968 return False |
1969 newfn = Utilities.toNativeSeparators(newfn) |
1969 newfn = Utilities.toNativeSeparators(newfn) |
1970 |
1970 |
1971 if os.path.exists(newfn): |
1971 if os.path.exists(newfn): |
1972 res = E5MessageBox.yesNo( |
1972 res = EricMessageBox.yesNo( |
1973 self.ui, |
1973 self.ui, |
1974 self.tr("Rename File"), |
1974 self.tr("Rename File"), |
1975 self.tr("""<p>The file <b>{0}</b> already exists.""" |
1975 self.tr("""<p>The file <b>{0}</b> already exists.""" |
1976 """ Overwrite it?</p>""") |
1976 """ Overwrite it?</p>""") |
1977 .format(newfn), |
1977 .format(newfn), |
1978 icon=E5MessageBox.Warning) |
1978 icon=EricMessageBox.Warning) |
1979 if not res: |
1979 if not res: |
1980 return False |
1980 return False |
1981 |
1981 |
1982 try: |
1982 try: |
1983 os.rename(oldfn, newfn) |
1983 os.rename(oldfn, newfn) |
1984 except OSError as msg: |
1984 except OSError as msg: |
1985 E5MessageBox.critical( |
1985 EricMessageBox.critical( |
1986 self.ui, |
1986 self.ui, |
1987 self.tr("Rename File"), |
1987 self.tr("Rename File"), |
1988 self.tr( |
1988 self.tr( |
1989 """<p>The file <b>{0}</b> could not be renamed.<br />""" |
1989 """<p>The file <b>{0}</b> could not be renamed.<br />""" |
1990 """Reason: {1}</p>""").format(oldfn, str(msg))) |
1990 """Reason: {1}</p>""").format(oldfn, str(msg))) |
2227 self.ppath, head, |
2227 self.ppath, head, |
2228 "__pycache__", "{0}.*{1}".format(tail, ext)) |
2228 "__pycache__", "{0}.*{1}".format(tail, ext)) |
2229 for f in glob.glob(pat): |
2229 for f in glob.glob(pat): |
2230 s2t(f) |
2230 s2t(f) |
2231 except OSError as err: |
2231 except OSError as err: |
2232 E5MessageBox.critical( |
2232 EricMessageBox.critical( |
2233 self.ui, |
2233 self.ui, |
2234 self.tr("Delete file"), |
2234 self.tr("Delete file"), |
2235 self.tr( |
2235 self.tr( |
2236 "<p>The selected file <b>{0}</b> could not be" |
2236 "<p>The selected file <b>{0}</b> could not be" |
2237 " deleted.</p><p>Reason: {1}</p>").format( |
2237 " deleted.</p><p>Reason: {1}</p>").format( |
2257 from send2trash import send2trash |
2257 from send2trash import send2trash |
2258 send2trash(dn) |
2258 send2trash(dn) |
2259 except ImportError: |
2259 except ImportError: |
2260 shutil.rmtree(dn, True) |
2260 shutil.rmtree(dn, True) |
2261 except OSError as err: |
2261 except OSError as err: |
2262 E5MessageBox.critical( |
2262 EricMessageBox.critical( |
2263 self.ui, |
2263 self.ui, |
2264 self.tr("Delete directory"), |
2264 self.tr("Delete directory"), |
2265 self.tr( |
2265 self.tr( |
2266 "<p>The selected directory <b>{0}</b> could not be" |
2266 "<p>The selected directory <b>{0}</b> could not be" |
2267 " deleted.</p><p>Reason: {1}</p>").format(dn, str(err))) |
2267 " deleted.</p><p>Reason: {1}</p>").format(dn, str(err))) |
2349 # create the project directory if it doesn't exist already |
2349 # create the project directory if it doesn't exist already |
2350 if not os.path.isdir(self.ppath): |
2350 if not os.path.isdir(self.ppath): |
2351 try: |
2351 try: |
2352 os.makedirs(self.ppath) |
2352 os.makedirs(self.ppath) |
2353 except OSError: |
2353 except OSError: |
2354 E5MessageBox.critical( |
2354 EricMessageBox.critical( |
2355 self.ui, |
2355 self.ui, |
2356 self.tr("Create project directory"), |
2356 self.tr("Create project directory"), |
2357 self.tr( |
2357 self.tr( |
2358 "<p>The project directory <b>{0}</b> could not" |
2358 "<p>The project directory <b>{0}</b> could not" |
2359 " be created.</p>") |
2359 " be created.</p>") |
2435 try: |
2435 try: |
2436 os.makedirs(os.path.dirname(ms)) |
2436 os.makedirs(os.path.dirname(ms)) |
2437 with open(ms, "w"): |
2437 with open(ms, "w"): |
2438 pass |
2438 pass |
2439 except OSError as err: |
2439 except OSError as err: |
2440 E5MessageBox.critical( |
2440 EricMessageBox.critical( |
2441 self.ui, |
2441 self.ui, |
2442 self.tr("Create main script"), |
2442 self.tr("Create main script"), |
2443 self.tr( |
2443 self.tr( |
2444 "<p>The mainscript <b>{0}</b> could not" |
2444 "<p>The mainscript <b>{0}</b> could not" |
2445 " be created.<br/>Reason: {1}</p>") |
2445 " be created.<br/>Reason: {1}</p>") |
2459 try: |
2459 try: |
2460 os.makedirs(os.path.dirname(mf)) |
2460 os.makedirs(os.path.dirname(mf)) |
2461 with open(mf, "w"): |
2461 with open(mf, "w"): |
2462 pass |
2462 pass |
2463 except OSError as err: |
2463 except OSError as err: |
2464 E5MessageBox.critical( |
2464 EricMessageBox.critical( |
2465 self.ui, |
2465 self.ui, |
2466 self.tr("Create Makefile"), |
2466 self.tr("Create Makefile"), |
2467 self.tr( |
2467 self.tr( |
2468 "<p>The makefile <b>{0}</b> could not" |
2468 "<p>The makefile <b>{0}</b> could not" |
2469 " be created.<br/>Reason: {1}</p>") |
2469 " be created.<br/>Reason: {1}</p>") |
2470 .format(mf, str(err))) |
2470 .format(mf, str(err))) |
2471 self.appendFile(mf) |
2471 self.appendFile(mf) |
2472 |
2472 |
2473 # add existing files to the project |
2473 # add existing files to the project |
2474 res = E5MessageBox.yesNo( |
2474 res = EricMessageBox.yesNo( |
2475 self.ui, |
2475 self.ui, |
2476 self.tr("New Project"), |
2476 self.tr("New Project"), |
2477 self.tr("""Add existing files to the project?"""), |
2477 self.tr("""Add existing files to the project?"""), |
2478 yesDefault=True) |
2478 yesDefault=True) |
2479 if res: |
2479 if res: |
2491 self.appendFile(fn, True) |
2491 self.appendFile(fn, True) |
2492 self.saveProject() |
2492 self.saveProject() |
2493 |
2493 |
2494 # check, if the existing project directory is already under |
2494 # check, if the existing project directory is already under |
2495 # VCS control |
2495 # VCS control |
2496 pluginManager = e5App().getObject("PluginManager") |
2496 pluginManager = ericApp().getObject("PluginManager") |
2497 for indicator, vcsData in list( |
2497 for indicator, vcsData in list( |
2498 pluginManager.getVcsSystemIndicators().items()): |
2498 pluginManager.getVcsSystemIndicators().items()): |
2499 if os.path.exists(os.path.join(self.ppath, indicator)): |
2499 if os.path.exists(os.path.join(self.ppath, indicator)): |
2500 if len(vcsData) > 1: |
2500 if len(vcsData) > 1: |
2501 vcsList = [] |
2501 vcsList = [] |
2522 self.vcs = self.initVCS() |
2522 self.vcs = self.initVCS() |
2523 self.setDirty(True) |
2523 self.setDirty(True) |
2524 if self.vcs is not None: |
2524 if self.vcs is not None: |
2525 # edit VCS command options |
2525 # edit VCS command options |
2526 if self.vcs.vcsSupportCommandOptions(): |
2526 if self.vcs.vcsSupportCommandOptions(): |
2527 vcores = E5MessageBox.yesNo( |
2527 vcores = EricMessageBox.yesNo( |
2528 self.ui, |
2528 self.ui, |
2529 self.tr("New Project"), |
2529 self.tr("New Project"), |
2530 self.tr( |
2530 self.tr( |
2531 """Would you like to edit the VCS""" |
2531 """Would you like to edit the VCS""" |
2532 """ command options?""")) |
2532 """ command options?""")) |
2539 codlg = VcsCommandOptionsDialog(self.vcs) |
2539 codlg = VcsCommandOptionsDialog(self.vcs) |
2540 if codlg.exec() == QDialog.DialogCode.Accepted: |
2540 if codlg.exec() == QDialog.DialogCode.Accepted: |
2541 self.vcs.vcsSetOptions(codlg.getOptions()) |
2541 self.vcs.vcsSetOptions(codlg.getOptions()) |
2542 # add project file to repository |
2542 # add project file to repository |
2543 if res == 0: |
2543 if res == 0: |
2544 apres = E5MessageBox.yesNo( |
2544 apres = EricMessageBox.yesNo( |
2545 self.ui, |
2545 self.ui, |
2546 self.tr("New project"), |
2546 self.tr("New project"), |
2547 self.tr( |
2547 self.tr( |
2548 "Shall the project file be added" |
2548 "Shall the project file be added" |
2549 " to the repository?"), |
2549 " to the repository?"), |
2561 self.vcs is None and |
2561 self.vcs is None and |
2562 self.vcsSoftwareAvailable() and |
2562 self.vcsSoftwareAvailable() and |
2563 self.vcsRequested |
2563 self.vcsRequested |
2564 ): |
2564 ): |
2565 vcsSystemsDict = ( |
2565 vcsSystemsDict = ( |
2566 e5App().getObject("PluginManager") |
2566 ericApp().getObject("PluginManager") |
2567 .getPluginDisplayStrings("version_control") |
2567 .getPluginDisplayStrings("version_control") |
2568 ) |
2568 ) |
2569 vcsSystemsDisplay = [self.tr("None")] |
2569 vcsSystemsDisplay = [self.tr("None")] |
2570 keys = sorted(vcsSystemsDict.keys()) |
2570 keys = sorted(vcsSystemsDict.keys()) |
2571 for key in keys: |
2571 for key in keys: |
2596 self.vcs = self.initVCS() |
2596 self.vcs = self.initVCS() |
2597 self.setDirty(True) |
2597 self.setDirty(True) |
2598 if self.vcs is not None: |
2598 if self.vcs is not None: |
2599 # edit VCS command options |
2599 # edit VCS command options |
2600 if self.vcs.vcsSupportCommandOptions(): |
2600 if self.vcs.vcsSupportCommandOptions(): |
2601 vcores = E5MessageBox.yesNo( |
2601 vcores = EricMessageBox.yesNo( |
2602 self.ui, |
2602 self.ui, |
2603 self.tr("New Project"), |
2603 self.tr("New Project"), |
2604 self.tr( |
2604 self.tr( |
2605 """Would you like to edit the VCS command""" |
2605 """Would you like to edit the VCS command""" |
2606 """ options?""")) |
2606 """ options?""")) |
2634 @param mainscript name of the mainscript (string) |
2634 @param mainscript name of the mainscript (string) |
2635 """ |
2635 """ |
2636 # Show the file type associations for the user to change |
2636 # Show the file type associations for the user to change |
2637 self.__showFiletypeAssociations() |
2637 self.__showFiletypeAssociations() |
2638 |
2638 |
2639 with E5OverrideCursor(): |
2639 with EricOverrideCursor(): |
2640 # search the project directory for files with known extensions |
2640 # search the project directory for files with known extensions |
2641 filespecs = list(self.pdata["FILETYPES"].keys()) |
2641 filespecs = list(self.pdata["FILETYPES"].keys()) |
2642 for filespec in filespecs: |
2642 for filespec in filespecs: |
2643 files = Utilities.direntries(self.ppath, True, filespec) |
2643 files = Utilities.direntries(self.ppath, True, filespec) |
2644 for file in files: |
2644 for file in files: |
2750 if not os.path.exists(mf): |
2750 if not os.path.exists(mf): |
2751 try: |
2751 try: |
2752 with open(mf, "w"): |
2752 with open(mf, "w"): |
2753 pass |
2753 pass |
2754 except OSError as err: |
2754 except OSError as err: |
2755 E5MessageBox.critical( |
2755 EricMessageBox.critical( |
2756 self.ui, |
2756 self.ui, |
2757 self.tr("Create Makefile"), |
2757 self.tr("Create Makefile"), |
2758 self.tr( |
2758 self.tr( |
2759 "<p>The makefile <b>{0}</b> could not" |
2759 "<p>The makefile <b>{0}</b> could not" |
2760 " be created.<br/>Reason: {1}</p>") |
2760 " be created.<br/>Reason: {1}</p>") |
2817 if self.vcs is not None: |
2817 if self.vcs is not None: |
2818 self.vcs.stopStatusMonitor() |
2818 self.vcs.stopStatusMonitor() |
2819 self.vcs.vcsShutdown() |
2819 self.vcs.vcsShutdown() |
2820 self.vcs.deleteLater() |
2820 self.vcs.deleteLater() |
2821 self.vcs = None |
2821 self.vcs = None |
2822 e5App().getObject("PluginManager").deactivateVcsPlugins() |
2822 ericApp().getObject("PluginManager").deactivateVcsPlugins() |
2823 # reinit VCS |
2823 # reinit VCS |
2824 self.vcs = self.initVCS() |
2824 self.vcs = self.initVCS() |
2825 # start the VCS monitor thread |
2825 # start the VCS monitor thread |
2826 if self.vcs is not None: |
2826 if self.vcs is not None: |
2827 self.vcs.startStatusMonitor(self) |
2827 self.vcs.startStatusMonitor(self) |
2913 """ |
2913 """ |
2914 if not self.checkDirty(): |
2914 if not self.checkDirty(): |
2915 return |
2915 return |
2916 |
2916 |
2917 if fn is None: |
2917 if fn is None: |
2918 fn = E5FileDialog.getOpenFileName( |
2918 fn = EricFileDialog.getOpenFileName( |
2919 self.parent(), |
2919 self.parent(), |
2920 self.tr("Open project"), |
2920 self.tr("Open project"), |
2921 Preferences.getMultiProject("Workspace") or |
2921 Preferences.getMultiProject("Workspace") or |
2922 Utilities.getHomeDir(), |
2922 Utilities.getHomeDir(), |
2923 self.tr("Project Files (*.epj);;XML Project Files (*.e4p)")) |
2923 self.tr("Project Files (*.epj);;XML Project Files (*.e4p)")) |
2924 |
2924 |
2925 QApplication.processEvents() |
2925 QApplication.processEvents() |
2926 |
2926 |
2927 if fn and self.closeProject(): |
2927 if fn and self.closeProject(): |
2928 with E5OverrideCursor(): |
2928 with EricOverrideCursor(): |
2929 ok = self.__readProject(fn) |
2929 ok = self.__readProject(fn) |
2930 if ok: |
2930 if ok: |
2931 self.opened = True |
2931 self.opened = True |
2932 if not self.pdata["FILETYPES"]: |
2932 if not self.pdata["FILETYPES"]: |
2933 self.initFileTypes() |
2933 self.initFileTypes() |
2948 return |
2948 return |
2949 |
2949 |
2950 # read a user specific project file |
2950 # read a user specific project file |
2951 self.__readUserProperties() |
2951 self.__readUserProperties() |
2952 |
2952 |
2953 with E5OverrideCursor(): |
2953 with EricOverrideCursor(): |
2954 oldState = self.isDirty() |
2954 oldState = self.isDirty() |
2955 self.vcs = self.initVCS() |
2955 self.vcs = self.initVCS() |
2956 if self.vcs is None and self.isDirty() == oldState: |
2956 if self.vcs is None and self.isDirty() == oldState: |
2957 # check, if project is version controlled |
2957 # check, if project is version controlled |
2958 pluginManager = e5App().getObject("PluginManager") |
2958 pluginManager = ericApp().getObject("PluginManager") |
2959 for indicator, vcsData in ( |
2959 for indicator, vcsData in ( |
2960 pluginManager.getVcsSystemIndicators().items() |
2960 pluginManager.getVcsSystemIndicators().items() |
2961 ): |
2961 ): |
2962 if os.path.exists( |
2962 if os.path.exists( |
2963 os.path.join(self.ppath, indicator)): |
2963 os.path.join(self.ppath, indicator)): |
2965 vcsList = [] |
2965 vcsList = [] |
2966 for ( |
2966 for ( |
2967 _vcsSystemStr, vcsSystemDisplay |
2967 _vcsSystemStr, vcsSystemDisplay |
2968 ) in vcsData: |
2968 ) in vcsData: |
2969 vcsList.append(vcsSystemDisplay) |
2969 vcsList.append(vcsSystemDisplay) |
2970 with E5OverridenCursor(): |
2970 with EricOverridenCursor(): |
2971 res, vcs_ok = QInputDialog.getItem( |
2971 res, vcs_ok = QInputDialog.getItem( |
2972 None, |
2972 None, |
2973 self.tr("New Project"), |
2973 self.tr("New Project"), |
2974 self.tr( |
2974 self.tr( |
2975 "Select Version Control" |
2975 "Select Version Control" |
3039 # read a project tasks file |
3039 # read a project tasks file |
3040 self.__readTasks() |
3040 self.__readTasks() |
3041 self.ui.taskViewer.setProjectOpen(True) |
3041 self.ui.taskViewer.setProjectOpen(True) |
3042 # rescan project tasks |
3042 # rescan project tasks |
3043 if Preferences.getProject("TasksProjectRescanOnOpen"): |
3043 if Preferences.getProject("TasksProjectRescanOnOpen"): |
3044 e5App().getObject("TaskViewer" |
3044 ericApp().getObject("TaskViewer" |
3045 ).regenerateProjectTasks(quiet=True) |
3045 ).regenerateProjectTasks(quiet=True) |
3046 |
3046 |
3047 if restoreSession: |
3047 if restoreSession: |
3048 # open the main script |
3048 # open the main script |
3049 if self.pdata["MAINSCRIPT"]: |
3049 if self.pdata["MAINSCRIPT"]: |
3112 self.ppath |
3112 self.ppath |
3113 if self.ppath else |
3113 if self.ppath else |
3114 (Preferences.getMultiProject("Workspace") or |
3114 (Preferences.getMultiProject("Workspace") or |
3115 Utilities.getHomeDir()) |
3115 Utilities.getHomeDir()) |
3116 ) |
3116 ) |
3117 fn, selectedFilter = E5FileDialog.getSaveFileNameAndFilter( |
3117 fn, selectedFilter = EricFileDialog.getSaveFileNameAndFilter( |
3118 self.parent(), |
3118 self.parent(), |
3119 self.tr("Save Project"), |
3119 self.tr("Save Project"), |
3120 defaultPath, |
3120 defaultPath, |
3121 self.tr("Project Files (*.epj)"), |
3121 self.tr("Project Files (*.epj)"), |
3122 defaultFilter, |
3122 defaultFilter, |
3123 E5FileDialog.DontConfirmOverwrite) |
3123 EricFileDialog.DontConfirmOverwrite) |
3124 |
3124 |
3125 if fn: |
3125 if fn: |
3126 ext = QFileInfo(fn).suffix() |
3126 ext = QFileInfo(fn).suffix() |
3127 if not ext: |
3127 if not ext: |
3128 ex = selectedFilter.split("(*")[1].split(")")[0] |
3128 ex = selectedFilter.split("(*")[1].split(")")[0] |
3129 if ex: |
3129 if ex: |
3130 fn += ex |
3130 fn += ex |
3131 if QFileInfo(fn).exists(): |
3131 if QFileInfo(fn).exists(): |
3132 res = E5MessageBox.yesNo( |
3132 res = EricMessageBox.yesNo( |
3133 self.ui, |
3133 self.ui, |
3134 self.tr("Save File"), |
3134 self.tr("Save File"), |
3135 self.tr("""<p>The file <b>{0}</b> already exists.""" |
3135 self.tr("""<p>The file <b>{0}</b> already exists.""" |
3136 """ Overwrite it?</p>""").format(fn), |
3136 """ Overwrite it?</p>""").format(fn), |
3137 icon=E5MessageBox.Warning) |
3137 icon=EricMessageBox.Warning) |
3138 if not res: |
3138 if not res: |
3139 return False |
3139 return False |
3140 |
3140 |
3141 self.name = QFileInfo(fn).baseName() |
3141 self.name = QFileInfo(fn).baseName() |
3142 ok = self.__writeProject(fn) |
3142 ok = self.__writeProject(fn) |
3163 Public method to check dirty status and open a message window. |
3163 Public method to check dirty status and open a message window. |
3164 |
3164 |
3165 @return flag indicating whether this operation was successful (boolean) |
3165 @return flag indicating whether this operation was successful (boolean) |
3166 """ |
3166 """ |
3167 if self.isDirty(): |
3167 if self.isDirty(): |
3168 res = E5MessageBox.okToClearData( |
3168 res = EricMessageBox.okToClearData( |
3169 self.parent(), |
3169 self.parent(), |
3170 self.tr("Close Project"), |
3170 self.tr("Close Project"), |
3171 self.tr("The current project has unsaved changes."), |
3171 self.tr("The current project has unsaved changes."), |
3172 self.saveProject) |
3172 self.saveProject) |
3173 if res: |
3173 if res: |
3222 self.isDebugPropertiesLoaded() and |
3222 self.isDebugPropertiesLoaded() and |
3223 not noSave and self.debugPropertiesChanged |
3223 not noSave and self.debugPropertiesChanged |
3224 ): |
3224 ): |
3225 self.__writeDebugProperties(True) |
3225 self.__writeDebugProperties(True) |
3226 |
3226 |
3227 vm = e5App().getObject("ViewManager") |
3227 vm = ericApp().getObject("ViewManager") |
3228 |
3228 |
3229 # check dirty status of all project files first |
3229 # check dirty status of all project files first |
3230 for fn in vm.getOpenFilenames(): |
3230 for fn in vm.getOpenFilenames(): |
3231 if self.isProjectFile(fn): |
3231 if self.isProjectFile(fn): |
3232 reset = vm.checkFileDirty(fn) |
3232 reset = vm.checkFileDirty(fn) |
3255 # now shutdown the vcs interface |
3255 # now shutdown the vcs interface |
3256 if self.vcs: |
3256 if self.vcs: |
3257 self.vcs.vcsShutdown() |
3257 self.vcs.vcsShutdown() |
3258 self.vcs.deleteLater() |
3258 self.vcs.deleteLater() |
3259 self.vcs = None |
3259 self.vcs = None |
3260 e5App().getObject("PluginManager").deactivateVcsPlugins() |
3260 ericApp().getObject("PluginManager").deactivateVcsPlugins() |
3261 |
3261 |
3262 # now close all project related tool windows |
3262 # now close all project related tool windows |
3263 self.__closeAllWindows() |
3263 self.__closeAllWindows() |
3264 |
3264 |
3265 self.__initData() |
3265 self.__initData() |
3296 |
3296 |
3297 @param reportSyntaxErrors flag indicating special reporting |
3297 @param reportSyntaxErrors flag indicating special reporting |
3298 for syntax errors (boolean) |
3298 for syntax errors (boolean) |
3299 @return flag indicating success (boolean) |
3299 @return flag indicating success (boolean) |
3300 """ |
3300 """ |
3301 vm = e5App().getObject("ViewManager") |
3301 vm = ericApp().getObject("ViewManager") |
3302 success = True |
3302 success = True |
3303 filesWithSyntaxErrors = 0 |
3303 filesWithSyntaxErrors = 0 |
3304 for fn in vm.getOpenFilenames(): |
3304 for fn in vm.getOpenFilenames(): |
3305 rfn = self.getRelativePath(fn) |
3305 rfn = self.getRelativePath(fn) |
3306 if rfn in self.pdata["SOURCES"] or rfn in self.pdata["OTHERS"]: |
3306 if rfn in self.pdata["SOURCES"] or rfn in self.pdata["OTHERS"]: |
3308 success &= vm.saveEditorEd(editor) |
3308 success &= vm.saveEditorEd(editor) |
3309 if reportSyntaxErrors and editor.hasSyntaxErrors(): |
3309 if reportSyntaxErrors and editor.hasSyntaxErrors(): |
3310 filesWithSyntaxErrors += 1 |
3310 filesWithSyntaxErrors += 1 |
3311 |
3311 |
3312 if reportSyntaxErrors and filesWithSyntaxErrors > 0: |
3312 if reportSyntaxErrors and filesWithSyntaxErrors > 0: |
3313 E5MessageBox.critical( |
3313 EricMessageBox.critical( |
3314 self.ui, |
3314 self.ui, |
3315 self.tr("Syntax errors detected"), |
3315 self.tr("Syntax errors detected"), |
3316 self.tr( |
3316 self.tr( |
3317 """The project contains %n file(s) with syntax errors.""", |
3317 """The project contains %n file(s) with syntax errors.""", |
3318 "", filesWithSyntaxErrors) |
3318 "", filesWithSyntaxErrors) |
3328 |
3328 |
3329 @param reportSyntaxErrors flag indicating special reporting |
3329 @param reportSyntaxErrors flag indicating special reporting |
3330 for syntax errors (boolean) |
3330 for syntax errors (boolean) |
3331 @return flag indicating success (boolean) |
3331 @return flag indicating success (boolean) |
3332 """ |
3332 """ |
3333 vm = e5App().getObject("ViewManager") |
3333 vm = ericApp().getObject("ViewManager") |
3334 success = True |
3334 success = True |
3335 filesWithSyntaxErrors = 0 |
3335 filesWithSyntaxErrors = 0 |
3336 for fn in vm.getOpenFilenames(): |
3336 for fn in vm.getOpenFilenames(): |
3337 rfn = self.getRelativePath(fn) |
3337 rfn = self.getRelativePath(fn) |
3338 if rfn in self.pdata["SOURCES"] or rfn in self.pdata["OTHERS"]: |
3338 if rfn in self.pdata["SOURCES"] or rfn in self.pdata["OTHERS"]: |
3340 success &= editor.checkDirty() |
3340 success &= editor.checkDirty() |
3341 if reportSyntaxErrors and editor.hasSyntaxErrors(): |
3341 if reportSyntaxErrors and editor.hasSyntaxErrors(): |
3342 filesWithSyntaxErrors += 1 |
3342 filesWithSyntaxErrors += 1 |
3343 |
3343 |
3344 if reportSyntaxErrors and filesWithSyntaxErrors > 0: |
3344 if reportSyntaxErrors and filesWithSyntaxErrors > 0: |
3345 E5MessageBox.critical( |
3345 EricMessageBox.critical( |
3346 self.ui, |
3346 self.ui, |
3347 self.tr("Syntax errors detected"), |
3347 self.tr("Syntax errors detected"), |
3348 self.tr( |
3348 self.tr( |
3349 """The project contains %n file(s) with syntax errors.""", |
3349 """The project contains %n file(s) with syntax errors.""", |
3350 "", filesWithSyntaxErrors) |
3350 "", filesWithSyntaxErrors) |
3826 """ |
3826 """ |
3827 self.actions = [] |
3827 self.actions = [] |
3828 |
3828 |
3829 self.actGrp1 = createActionGroup(self) |
3829 self.actGrp1 = createActionGroup(self) |
3830 |
3830 |
3831 act = E5Action( |
3831 act = EricAction( |
3832 self.tr('New project'), |
3832 self.tr('New project'), |
3833 UI.PixmapCache.getIcon("projectNew"), |
3833 UI.PixmapCache.getIcon("projectNew"), |
3834 self.tr('&New...'), 0, 0, |
3834 self.tr('&New...'), 0, 0, |
3835 self.actGrp1, 'project_new') |
3835 self.actGrp1, 'project_new') |
3836 act.setStatusTip(self.tr('Generate a new project')) |
3836 act.setStatusTip(self.tr('Generate a new project')) |
3840 """ new project.</p>""" |
3840 """ new project.</p>""" |
3841 )) |
3841 )) |
3842 act.triggered.connect(self.createNewProject) |
3842 act.triggered.connect(self.createNewProject) |
3843 self.actions.append(act) |
3843 self.actions.append(act) |
3844 |
3844 |
3845 act = E5Action( |
3845 act = EricAction( |
3846 self.tr('Open project'), |
3846 self.tr('Open project'), |
3847 UI.PixmapCache.getIcon("projectOpen"), |
3847 UI.PixmapCache.getIcon("projectOpen"), |
3848 self.tr('&Open...'), 0, 0, |
3848 self.tr('&Open...'), 0, 0, |
3849 self.actGrp1, 'project_open') |
3849 self.actGrp1, 'project_open') |
3850 act.setStatusTip(self.tr('Open an existing project')) |
3850 act.setStatusTip(self.tr('Open an existing project')) |
3853 """<p>This opens an existing project.</p>""" |
3853 """<p>This opens an existing project.</p>""" |
3854 )) |
3854 )) |
3855 act.triggered.connect(self.openProject) |
3855 act.triggered.connect(self.openProject) |
3856 self.actions.append(act) |
3856 self.actions.append(act) |
3857 |
3857 |
3858 self.closeAct = E5Action( |
3858 self.closeAct = EricAction( |
3859 self.tr('Close project'), |
3859 self.tr('Close project'), |
3860 UI.PixmapCache.getIcon("projectClose"), |
3860 UI.PixmapCache.getIcon("projectClose"), |
3861 self.tr('&Close'), 0, 0, self, 'project_close') |
3861 self.tr('&Close'), 0, 0, self, 'project_close') |
3862 self.closeAct.setStatusTip(self.tr('Close the current project')) |
3862 self.closeAct.setStatusTip(self.tr('Close the current project')) |
3863 self.closeAct.setWhatsThis(self.tr( |
3863 self.closeAct.setWhatsThis(self.tr( |
3865 """<p>This closes the current project.</p>""" |
3865 """<p>This closes the current project.</p>""" |
3866 )) |
3866 )) |
3867 self.closeAct.triggered.connect(self.closeProject) |
3867 self.closeAct.triggered.connect(self.closeProject) |
3868 self.actions.append(self.closeAct) |
3868 self.actions.append(self.closeAct) |
3869 |
3869 |
3870 self.saveAct = E5Action( |
3870 self.saveAct = EricAction( |
3871 self.tr('Save project'), |
3871 self.tr('Save project'), |
3872 UI.PixmapCache.getIcon("projectSave"), |
3872 UI.PixmapCache.getIcon("projectSave"), |
3873 self.tr('&Save'), 0, 0, self, 'project_save') |
3873 self.tr('&Save'), 0, 0, self, 'project_save') |
3874 self.saveAct.setStatusTip(self.tr('Save the current project')) |
3874 self.saveAct.setStatusTip(self.tr('Save the current project')) |
3875 self.saveAct.setWhatsThis(self.tr( |
3875 self.saveAct.setWhatsThis(self.tr( |
3877 """<p>This saves the current project.</p>""" |
3877 """<p>This saves the current project.</p>""" |
3878 )) |
3878 )) |
3879 self.saveAct.triggered.connect(self.saveProject) |
3879 self.saveAct.triggered.connect(self.saveProject) |
3880 self.actions.append(self.saveAct) |
3880 self.actions.append(self.saveAct) |
3881 |
3881 |
3882 self.saveasAct = E5Action( |
3882 self.saveasAct = EricAction( |
3883 self.tr('Save project as'), |
3883 self.tr('Save project as'), |
3884 UI.PixmapCache.getIcon("projectSaveAs"), |
3884 UI.PixmapCache.getIcon("projectSaveAs"), |
3885 self.tr('Save &as...'), 0, 0, self, 'project_save_as') |
3885 self.tr('Save &as...'), 0, 0, self, 'project_save_as') |
3886 self.saveasAct.setStatusTip(self.tr( |
3886 self.saveasAct.setStatusTip(self.tr( |
3887 'Save the current project to a new file')) |
3887 'Save the current project to a new file')) |
3892 self.saveasAct.triggered.connect(self.saveProjectAs) |
3892 self.saveasAct.triggered.connect(self.saveProjectAs) |
3893 self.actions.append(self.saveasAct) |
3893 self.actions.append(self.saveasAct) |
3894 |
3894 |
3895 self.actGrp2 = createActionGroup(self) |
3895 self.actGrp2 = createActionGroup(self) |
3896 |
3896 |
3897 self.addFilesAct = E5Action( |
3897 self.addFilesAct = EricAction( |
3898 self.tr('Add files to project'), |
3898 self.tr('Add files to project'), |
3899 UI.PixmapCache.getIcon("fileMisc"), |
3899 UI.PixmapCache.getIcon("fileMisc"), |
3900 self.tr('Add &files...'), 0, 0, |
3900 self.tr('Add &files...'), 0, 0, |
3901 self.actGrp2, 'project_add_file') |
3901 self.actGrp2, 'project_add_file') |
3902 self.addFilesAct.setStatusTip(self.tr( |
3902 self.addFilesAct.setStatusTip(self.tr( |
3908 """ determined by the file extension.</p>""" |
3908 """ determined by the file extension.</p>""" |
3909 )) |
3909 )) |
3910 self.addFilesAct.triggered.connect(self.addFiles) |
3910 self.addFilesAct.triggered.connect(self.addFiles) |
3911 self.actions.append(self.addFilesAct) |
3911 self.actions.append(self.addFilesAct) |
3912 |
3912 |
3913 self.addDirectoryAct = E5Action( |
3913 self.addDirectoryAct = EricAction( |
3914 self.tr('Add directory to project'), |
3914 self.tr('Add directory to project'), |
3915 UI.PixmapCache.getIcon("dirOpen"), |
3915 UI.PixmapCache.getIcon("dirOpen"), |
3916 self.tr('Add directory...'), 0, 0, |
3916 self.tr('Add directory...'), 0, 0, |
3917 self.actGrp2, 'project_add_directory') |
3917 self.actGrp2, 'project_add_directory') |
3918 self.addDirectoryAct.setStatusTip( |
3918 self.addDirectoryAct.setStatusTip( |
3923 """ to the current project.</p>""" |
3923 """ to the current project.</p>""" |
3924 )) |
3924 )) |
3925 self.addDirectoryAct.triggered.connect(self.addDirectory) |
3925 self.addDirectoryAct.triggered.connect(self.addDirectory) |
3926 self.actions.append(self.addDirectoryAct) |
3926 self.actions.append(self.addDirectoryAct) |
3927 |
3927 |
3928 self.addLanguageAct = E5Action( |
3928 self.addLanguageAct = EricAction( |
3929 self.tr('Add translation to project'), |
3929 self.tr('Add translation to project'), |
3930 UI.PixmapCache.getIcon("linguist4"), |
3930 UI.PixmapCache.getIcon("linguist4"), |
3931 self.tr('Add &translation...'), 0, 0, |
3931 self.tr('Add &translation...'), 0, 0, |
3932 self.actGrp2, 'project_add_translation') |
3932 self.actGrp2, 'project_add_translation') |
3933 self.addLanguageAct.setStatusTip( |
3933 self.addLanguageAct.setStatusTip( |
3938 """ to the current project.</p>""" |
3938 """ to the current project.</p>""" |
3939 )) |
3939 )) |
3940 self.addLanguageAct.triggered.connect(self.addLanguage) |
3940 self.addLanguageAct.triggered.connect(self.addLanguage) |
3941 self.actions.append(self.addLanguageAct) |
3941 self.actions.append(self.addLanguageAct) |
3942 |
3942 |
3943 act = E5Action( |
3943 act = EricAction( |
3944 self.tr('Search new files'), |
3944 self.tr('Search new files'), |
3945 self.tr('Searc&h new files...'), 0, 0, |
3945 self.tr('Searc&h new files...'), 0, 0, |
3946 self.actGrp2, 'project_search_new_files') |
3946 self.actGrp2, 'project_search_new_files') |
3947 act.setStatusTip(self.tr( |
3947 act.setStatusTip(self.tr( |
3948 'Search new files in the project directory.')) |
3948 'Search new files in the project directory.')) |
3953 """ subdirectories.</p>""" |
3953 """ subdirectories.</p>""" |
3954 )) |
3954 )) |
3955 act.triggered.connect(self.__searchNewFiles) |
3955 act.triggered.connect(self.__searchNewFiles) |
3956 self.actions.append(act) |
3956 self.actions.append(act) |
3957 |
3957 |
3958 act = E5Action( |
3958 act = EricAction( |
3959 self.tr('Search Project File'), |
3959 self.tr('Search Project File'), |
3960 self.tr('Search Project File...'), |
3960 self.tr('Search Project File...'), |
3961 QKeySequence(self.tr("Alt+Ctrl+P", "Project|Search Project File")), |
3961 QKeySequence(self.tr("Alt+Ctrl+P", "Project|Search Project File")), |
3962 0, |
3962 0, |
3963 self.actGrp2, 'project_search_project_file') |
3963 self.actGrp2, 'project_search_project_file') |
3968 """<p>This searches for a file in the project list of files.</p>""" |
3968 """<p>This searches for a file in the project list of files.</p>""" |
3969 )) |
3969 )) |
3970 act.triggered.connect(self.__searchProjectFile) |
3970 act.triggered.connect(self.__searchProjectFile) |
3971 self.actions.append(act) |
3971 self.actions.append(act) |
3972 |
3972 |
3973 self.propsAct = E5Action( |
3973 self.propsAct = EricAction( |
3974 self.tr('Project properties'), |
3974 self.tr('Project properties'), |
3975 UI.PixmapCache.getIcon("projectProps"), |
3975 UI.PixmapCache.getIcon("projectProps"), |
3976 self.tr('&Properties...'), 0, 0, self, |
3976 self.tr('&Properties...'), 0, 0, self, |
3977 'project_properties') |
3977 'project_properties') |
3978 self.propsAct.setStatusTip(self.tr('Show the project properties')) |
3978 self.propsAct.setStatusTip(self.tr('Show the project properties')) |
3981 """<p>This shows a dialog to edit the project properties.</p>""" |
3981 """<p>This shows a dialog to edit the project properties.</p>""" |
3982 )) |
3982 )) |
3983 self.propsAct.triggered.connect(self.__showProperties) |
3983 self.propsAct.triggered.connect(self.__showProperties) |
3984 self.actions.append(self.propsAct) |
3984 self.actions.append(self.propsAct) |
3985 |
3985 |
3986 self.userPropsAct = E5Action( |
3986 self.userPropsAct = EricAction( |
3987 self.tr('User project properties'), |
3987 self.tr('User project properties'), |
3988 UI.PixmapCache.getIcon("projectUserProps"), |
3988 UI.PixmapCache.getIcon("projectUserProps"), |
3989 self.tr('&User Properties...'), 0, 0, self, |
3989 self.tr('&User Properties...'), 0, 0, self, |
3990 'project_user_properties') |
3990 'project_user_properties') |
3991 self.userPropsAct.setStatusTip(self.tr( |
3991 self.userPropsAct.setStatusTip(self.tr( |
3996 """ properties.</p>""" |
3996 """ properties.</p>""" |
3997 )) |
3997 )) |
3998 self.userPropsAct.triggered.connect(self.__showUserProperties) |
3998 self.userPropsAct.triggered.connect(self.__showUserProperties) |
3999 self.actions.append(self.userPropsAct) |
3999 self.actions.append(self.userPropsAct) |
4000 |
4000 |
4001 self.filetypesAct = E5Action( |
4001 self.filetypesAct = EricAction( |
4002 self.tr('Filetype Associations'), |
4002 self.tr('Filetype Associations'), |
4003 self.tr('Filetype Associations...'), 0, 0, |
4003 self.tr('Filetype Associations...'), 0, 0, |
4004 self, 'project_filetype_associations') |
4004 self, 'project_filetype_associations') |
4005 self.filetypesAct.setStatusTip( |
4005 self.filetypesAct.setStatusTip( |
4006 self.tr('Show the project file type associations')) |
4006 self.tr('Show the project file type associations')) |
4014 )) |
4014 )) |
4015 self.filetypesAct.triggered.connect( |
4015 self.filetypesAct.triggered.connect( |
4016 self.__showFiletypeAssociations) |
4016 self.__showFiletypeAssociations) |
4017 self.actions.append(self.filetypesAct) |
4017 self.actions.append(self.filetypesAct) |
4018 |
4018 |
4019 self.lexersAct = E5Action( |
4019 self.lexersAct = EricAction( |
4020 self.tr('Lexer Associations'), |
4020 self.tr('Lexer Associations'), |
4021 self.tr('Lexer Associations...'), 0, 0, |
4021 self.tr('Lexer Associations...'), 0, 0, |
4022 self, 'project_lexer_associations') |
4022 self, 'project_lexer_associations') |
4023 self.lexersAct.setStatusTip(self.tr( |
4023 self.lexersAct.setStatusTip(self.tr( |
4024 'Show the project lexer associations (overriding defaults)')) |
4024 'Show the project lexer associations (overriding defaults)')) |
4032 self.lexersAct.triggered.connect(self.__showLexerAssociations) |
4032 self.lexersAct.triggered.connect(self.__showLexerAssociations) |
4033 self.actions.append(self.lexersAct) |
4033 self.actions.append(self.lexersAct) |
4034 |
4034 |
4035 self.dbgActGrp = createActionGroup(self) |
4035 self.dbgActGrp = createActionGroup(self) |
4036 |
4036 |
4037 act = E5Action( |
4037 act = EricAction( |
4038 self.tr('Debugger Properties'), |
4038 self.tr('Debugger Properties'), |
4039 self.tr('Debugger &Properties...'), 0, 0, |
4039 self.tr('Debugger &Properties...'), 0, 0, |
4040 self.dbgActGrp, 'project_debugger_properties') |
4040 self.dbgActGrp, 'project_debugger_properties') |
4041 act.setStatusTip(self.tr('Show the debugger properties')) |
4041 act.setStatusTip(self.tr('Show the debugger properties')) |
4042 act.setWhatsThis(self.tr( |
4042 act.setWhatsThis(self.tr( |
4045 """ settings.</p>""" |
4045 """ settings.</p>""" |
4046 )) |
4046 )) |
4047 act.triggered.connect(self.__showDebugProperties) |
4047 act.triggered.connect(self.__showDebugProperties) |
4048 self.actions.append(act) |
4048 self.actions.append(act) |
4049 |
4049 |
4050 act = E5Action( |
4050 act = EricAction( |
4051 self.tr('Load'), |
4051 self.tr('Load'), |
4052 self.tr('&Load'), 0, 0, |
4052 self.tr('&Load'), 0, 0, |
4053 self.dbgActGrp, 'project_debugger_properties_load') |
4053 self.dbgActGrp, 'project_debugger_properties_load') |
4054 act.setStatusTip(self.tr('Load the debugger properties')) |
4054 act.setStatusTip(self.tr('Load the debugger properties')) |
4055 act.setWhatsThis(self.tr( |
4055 act.setWhatsThis(self.tr( |
4057 """<p>This loads the project specific debugger settings.</p>""" |
4057 """<p>This loads the project specific debugger settings.</p>""" |
4058 )) |
4058 )) |
4059 act.triggered.connect(self.__readDebugProperties) |
4059 act.triggered.connect(self.__readDebugProperties) |
4060 self.actions.append(act) |
4060 self.actions.append(act) |
4061 |
4061 |
4062 act = E5Action( |
4062 act = EricAction( |
4063 self.tr('Save'), |
4063 self.tr('Save'), |
4064 self.tr('&Save'), 0, 0, |
4064 self.tr('&Save'), 0, 0, |
4065 self.dbgActGrp, 'project_debugger_properties_save') |
4065 self.dbgActGrp, 'project_debugger_properties_save') |
4066 act.setStatusTip(self.tr('Save the debugger properties')) |
4066 act.setStatusTip(self.tr('Save the debugger properties')) |
4067 act.setWhatsThis(self.tr( |
4067 act.setWhatsThis(self.tr( |
4069 """<p>This saves the project specific debugger settings.</p>""" |
4069 """<p>This saves the project specific debugger settings.</p>""" |
4070 )) |
4070 )) |
4071 act.triggered.connect(self.__writeDebugProperties) |
4071 act.triggered.connect(self.__writeDebugProperties) |
4072 self.actions.append(act) |
4072 self.actions.append(act) |
4073 |
4073 |
4074 act = E5Action( |
4074 act = EricAction( |
4075 self.tr('Delete'), |
4075 self.tr('Delete'), |
4076 self.tr('&Delete'), 0, 0, |
4076 self.tr('&Delete'), 0, 0, |
4077 self.dbgActGrp, 'project_debugger_properties_delete') |
4077 self.dbgActGrp, 'project_debugger_properties_delete') |
4078 act.setStatusTip(self.tr('Delete the debugger properties')) |
4078 act.setStatusTip(self.tr('Delete the debugger properties')) |
4079 act.setWhatsThis(self.tr( |
4079 act.setWhatsThis(self.tr( |
4082 """ debugger settings.</p>""" |
4082 """ debugger settings.</p>""" |
4083 )) |
4083 )) |
4084 act.triggered.connect(self.__deleteDebugProperties) |
4084 act.triggered.connect(self.__deleteDebugProperties) |
4085 self.actions.append(act) |
4085 self.actions.append(act) |
4086 |
4086 |
4087 act = E5Action( |
4087 act = EricAction( |
4088 self.tr('Reset'), |
4088 self.tr('Reset'), |
4089 self.tr('&Reset'), 0, 0, |
4089 self.tr('&Reset'), 0, 0, |
4090 self.dbgActGrp, 'project_debugger_properties_resets') |
4090 self.dbgActGrp, 'project_debugger_properties_resets') |
4091 act.setStatusTip(self.tr('Reset the debugger properties')) |
4091 act.setStatusTip(self.tr('Reset the debugger properties')) |
4092 act.setWhatsThis(self.tr( |
4092 act.setWhatsThis(self.tr( |
4096 act.triggered.connect(self.__initDebugProperties) |
4096 act.triggered.connect(self.__initDebugProperties) |
4097 self.actions.append(act) |
4097 self.actions.append(act) |
4098 |
4098 |
4099 self.sessActGrp = createActionGroup(self) |
4099 self.sessActGrp = createActionGroup(self) |
4100 |
4100 |
4101 act = E5Action( |
4101 act = EricAction( |
4102 self.tr('Load session'), |
4102 self.tr('Load session'), |
4103 self.tr('Load session'), 0, 0, |
4103 self.tr('Load session'), 0, 0, |
4104 self.sessActGrp, 'project_load_session') |
4104 self.sessActGrp, 'project_load_session') |
4105 act.setStatusTip(self.tr('Load the projects session file.')) |
4105 act.setStatusTip(self.tr('Load the projects session file.')) |
4106 act.setWhatsThis(self.tr( |
4106 act.setWhatsThis(self.tr( |
4114 """- the exception reporting flag</p>""" |
4114 """- the exception reporting flag</p>""" |
4115 )) |
4115 )) |
4116 act.triggered.connect(self.__readSession) |
4116 act.triggered.connect(self.__readSession) |
4117 self.actions.append(act) |
4117 self.actions.append(act) |
4118 |
4118 |
4119 act = E5Action( |
4119 act = EricAction( |
4120 self.tr('Save session'), |
4120 self.tr('Save session'), |
4121 self.tr('Save session'), 0, 0, |
4121 self.tr('Save session'), 0, 0, |
4122 self.sessActGrp, 'project_save_session') |
4122 self.sessActGrp, 'project_save_session') |
4123 act.setStatusTip(self.tr('Save the projects session file.')) |
4123 act.setStatusTip(self.tr('Save the projects session file.')) |
4124 act.setWhatsThis(self.tr( |
4124 act.setWhatsThis(self.tr( |
4132 """- the exception reporting flag</p>""" |
4132 """- the exception reporting flag</p>""" |
4133 )) |
4133 )) |
4134 act.triggered.connect(self.__writeSession) |
4134 act.triggered.connect(self.__writeSession) |
4135 self.actions.append(act) |
4135 self.actions.append(act) |
4136 |
4136 |
4137 act = E5Action( |
4137 act = EricAction( |
4138 self.tr('Delete session'), |
4138 self.tr('Delete session'), |
4139 self.tr('Delete session'), 0, 0, |
4139 self.tr('Delete session'), 0, 0, |
4140 self.sessActGrp, 'project_delete_session') |
4140 self.sessActGrp, 'project_delete_session') |
4141 act.setStatusTip(self.tr('Delete the projects session file.')) |
4141 act.setStatusTip(self.tr('Delete the projects session file.')) |
4142 act.setWhatsThis(self.tr( |
4142 act.setWhatsThis(self.tr( |
4146 act.triggered.connect(self.__deleteSession) |
4146 act.triggered.connect(self.__deleteSession) |
4147 self.actions.append(act) |
4147 self.actions.append(act) |
4148 |
4148 |
4149 self.chkGrp = createActionGroup(self) |
4149 self.chkGrp = createActionGroup(self) |
4150 |
4150 |
4151 self.codeMetricsAct = E5Action( |
4151 self.codeMetricsAct = EricAction( |
4152 self.tr('Code Metrics'), |
4152 self.tr('Code Metrics'), |
4153 self.tr('&Code Metrics...'), 0, 0, |
4153 self.tr('&Code Metrics...'), 0, 0, |
4154 self.chkGrp, 'project_code_metrics') |
4154 self.chkGrp, 'project_code_metrics') |
4155 self.codeMetricsAct.setStatusTip( |
4155 self.codeMetricsAct.setStatusTip( |
4156 self.tr('Show some code metrics for the project.')) |
4156 self.tr('Show some code metrics for the project.')) |
4160 """ the project.</p>""" |
4160 """ the project.</p>""" |
4161 )) |
4161 )) |
4162 self.codeMetricsAct.triggered.connect(self.__showCodeMetrics) |
4162 self.codeMetricsAct.triggered.connect(self.__showCodeMetrics) |
4163 self.actions.append(self.codeMetricsAct) |
4163 self.actions.append(self.codeMetricsAct) |
4164 |
4164 |
4165 self.codeCoverageAct = E5Action( |
4165 self.codeCoverageAct = EricAction( |
4166 self.tr('Python Code Coverage'), |
4166 self.tr('Python Code Coverage'), |
4167 self.tr('Code Co&verage...'), 0, 0, |
4167 self.tr('Code Co&verage...'), 0, 0, |
4168 self.chkGrp, 'project_code_coverage') |
4168 self.chkGrp, 'project_code_coverage') |
4169 self.codeCoverageAct.setStatusTip( |
4169 self.codeCoverageAct.setStatusTip( |
4170 self.tr('Show code coverage information for the project.')) |
4170 self.tr('Show code coverage information for the project.')) |
4174 """ files in the project.</p>""" |
4174 """ files in the project.</p>""" |
4175 )) |
4175 )) |
4176 self.codeCoverageAct.triggered.connect(self.__showCodeCoverage) |
4176 self.codeCoverageAct.triggered.connect(self.__showCodeCoverage) |
4177 self.actions.append(self.codeCoverageAct) |
4177 self.actions.append(self.codeCoverageAct) |
4178 |
4178 |
4179 self.codeProfileAct = E5Action( |
4179 self.codeProfileAct = EricAction( |
4180 self.tr('Profile Data'), |
4180 self.tr('Profile Data'), |
4181 self.tr('&Profile Data...'), 0, 0, |
4181 self.tr('&Profile Data...'), 0, 0, |
4182 self.chkGrp, 'project_profile_data') |
4182 self.chkGrp, 'project_profile_data') |
4183 self.codeProfileAct.setStatusTip( |
4183 self.codeProfileAct.setStatusTip( |
4184 self.tr('Show profiling data for the project.')) |
4184 self.tr('Show profiling data for the project.')) |
4189 self.codeProfileAct.triggered.connect(self.__showProfileData) |
4189 self.codeProfileAct.triggered.connect(self.__showProfileData) |
4190 self.actions.append(self.codeProfileAct) |
4190 self.actions.append(self.codeProfileAct) |
4191 |
4191 |
4192 self.graphicsGrp = createActionGroup(self) |
4192 self.graphicsGrp = createActionGroup(self) |
4193 |
4193 |
4194 self.applicationDiagramAct = E5Action( |
4194 self.applicationDiagramAct = EricAction( |
4195 self.tr('Application Diagram'), |
4195 self.tr('Application Diagram'), |
4196 self.tr('&Application Diagram...'), 0, 0, |
4196 self.tr('&Application Diagram...'), 0, 0, |
4197 self.graphicsGrp, 'project_application_diagram') |
4197 self.graphicsGrp, 'project_application_diagram') |
4198 self.applicationDiagramAct.setStatusTip( |
4198 self.applicationDiagramAct.setStatusTip( |
4199 self.tr('Show a diagram of the project.')) |
4199 self.tr('Show a diagram of the project.')) |
4203 )) |
4203 )) |
4204 self.applicationDiagramAct.triggered.connect( |
4204 self.applicationDiagramAct.triggered.connect( |
4205 self.handleApplicationDiagram) |
4205 self.handleApplicationDiagram) |
4206 self.actions.append(self.applicationDiagramAct) |
4206 self.actions.append(self.applicationDiagramAct) |
4207 |
4207 |
4208 self.loadDiagramAct = E5Action( |
4208 self.loadDiagramAct = EricAction( |
4209 self.tr('Load Diagram'), |
4209 self.tr('Load Diagram'), |
4210 self.tr('&Load Diagram...'), 0, 0, |
4210 self.tr('&Load Diagram...'), 0, 0, |
4211 self.graphicsGrp, 'project_load_diagram') |
4211 self.graphicsGrp, 'project_load_diagram') |
4212 self.loadDiagramAct.setStatusTip( |
4212 self.loadDiagramAct.setStatusTip( |
4213 self.tr('Load a diagram from file.')) |
4213 self.tr('Load a diagram from file.')) |
4218 self.loadDiagramAct.triggered.connect(self.__loadDiagram) |
4218 self.loadDiagramAct.triggered.connect(self.__loadDiagram) |
4219 self.actions.append(self.loadDiagramAct) |
4219 self.actions.append(self.loadDiagramAct) |
4220 |
4220 |
4221 self.pluginGrp = createActionGroup(self) |
4221 self.pluginGrp = createActionGroup(self) |
4222 |
4222 |
4223 self.pluginPkgListAct = E5Action( |
4223 self.pluginPkgListAct = EricAction( |
4224 self.tr('Create Package List'), |
4224 self.tr('Create Package List'), |
4225 UI.PixmapCache.getIcon("pluginArchiveList"), |
4225 UI.PixmapCache.getIcon("pluginArchiveList"), |
4226 self.tr('Create &Package List'), 0, 0, |
4226 self.tr('Create &Package List'), 0, 0, |
4227 self.pluginGrp, 'project_plugin_pkglist') |
4227 self.pluginGrp, 'project_plugin_pkglist') |
4228 self.pluginPkgListAct.setStatusTip( |
4228 self.pluginPkgListAct.setStatusTip( |
4234 """ file.</p>""" |
4234 """ file.</p>""" |
4235 )) |
4235 )) |
4236 self.pluginPkgListAct.triggered.connect(self.__pluginCreatePkgList) |
4236 self.pluginPkgListAct.triggered.connect(self.__pluginCreatePkgList) |
4237 self.actions.append(self.pluginPkgListAct) |
4237 self.actions.append(self.pluginPkgListAct) |
4238 |
4238 |
4239 self.pluginArchiveAct = E5Action( |
4239 self.pluginArchiveAct = EricAction( |
4240 self.tr('Create Plugin Archives'), |
4240 self.tr('Create Plugin Archives'), |
4241 UI.PixmapCache.getIcon("pluginArchive"), |
4241 UI.PixmapCache.getIcon("pluginArchive"), |
4242 self.tr('Create Plugin &Archives'), 0, 0, |
4242 self.tr('Create Plugin &Archives'), 0, 0, |
4243 self.pluginGrp, 'project_plugin_archive') |
4243 self.pluginGrp, 'project_plugin_archive') |
4244 self.pluginArchiveAct.setStatusTip( |
4244 self.pluginArchiveAct.setStatusTip( |
4251 """ the package list file.</p>""" |
4251 """ the package list file.</p>""" |
4252 )) |
4252 )) |
4253 self.pluginArchiveAct.triggered.connect(self.__pluginCreateArchives) |
4253 self.pluginArchiveAct.triggered.connect(self.__pluginCreateArchives) |
4254 self.actions.append(self.pluginArchiveAct) |
4254 self.actions.append(self.pluginArchiveAct) |
4255 |
4255 |
4256 self.pluginSArchiveAct = E5Action( |
4256 self.pluginSArchiveAct = EricAction( |
4257 self.tr('Create Plugin Archives (Snapshot)'), |
4257 self.tr('Create Plugin Archives (Snapshot)'), |
4258 UI.PixmapCache.getIcon("pluginArchiveSnapshot"), |
4258 UI.PixmapCache.getIcon("pluginArchiveSnapshot"), |
4259 self.tr('Create Plugin Archives (&Snapshot)'), 0, 0, |
4259 self.tr('Create Plugin Archives (&Snapshot)'), 0, 0, |
4260 self.pluginGrp, 'project_plugin_sarchive') |
4260 self.pluginGrp, 'project_plugin_sarchive') |
4261 self.pluginSArchiveAct.setStatusTip(self.tr( |
4261 self.pluginSArchiveAct.setStatusTip(self.tr( |
4272 self.__pluginCreateSnapshotArchives) |
4272 self.__pluginCreateSnapshotArchives) |
4273 self.actions.append(self.pluginSArchiveAct) |
4273 self.actions.append(self.pluginSArchiveAct) |
4274 |
4274 |
4275 self.makeGrp = createActionGroup(self) |
4275 self.makeGrp = createActionGroup(self) |
4276 |
4276 |
4277 self.makeExecuteAct = E5Action( |
4277 self.makeExecuteAct = EricAction( |
4278 self.tr('Execute Make'), |
4278 self.tr('Execute Make'), |
4279 self.tr('&Execute Make'), 0, 0, |
4279 self.tr('&Execute Make'), 0, 0, |
4280 self.makeGrp, 'project_make_execute') |
4280 self.makeGrp, 'project_make_execute') |
4281 self.makeExecuteAct.setStatusTip( |
4281 self.makeExecuteAct.setStatusTip( |
4282 self.tr("Perform a 'make' run.")) |
4282 self.tr("Perform a 'make' run.")) |
4286 """ target.</p>""" |
4286 """ target.</p>""" |
4287 )) |
4287 )) |
4288 self.makeExecuteAct.triggered.connect(self.__executeMake) |
4288 self.makeExecuteAct.triggered.connect(self.__executeMake) |
4289 self.actions.append(self.makeExecuteAct) |
4289 self.actions.append(self.makeExecuteAct) |
4290 |
4290 |
4291 self.makeTestAct = E5Action( |
4291 self.makeTestAct = EricAction( |
4292 self.tr('Test for Changes'), |
4292 self.tr('Test for Changes'), |
4293 self.tr('&Test for Changes'), 0, 0, |
4293 self.tr('&Test for Changes'), 0, 0, |
4294 self.makeGrp, 'project_make_test') |
4294 self.makeGrp, 'project_make_test') |
4295 self.makeTestAct.setStatusTip( |
4295 self.makeTestAct.setStatusTip( |
4296 self.tr("Question 'make', if a rebuild is needed.")) |
4296 self.tr("Question 'make', if a rebuild is needed.")) |
4454 """ |
4454 """ |
4455 Public slot to initialize the project toolbar and the basic VCS |
4455 Public slot to initialize the project toolbar and the basic VCS |
4456 toolbar. |
4456 toolbar. |
4457 |
4457 |
4458 @param toolbarManager reference to a toolbar manager object |
4458 @param toolbarManager reference to a toolbar manager object |
4459 (E5ToolBarManager) |
4459 (EricToolBarManager) |
4460 @return tuple of the generated toolbars (tuple of two QToolBar) |
4460 @return tuple of the generated toolbars (tuple of two QToolBar) |
4461 """ |
4461 """ |
4462 tb = QToolBar(self.tr("Project"), self.ui) |
4462 tb = QToolBar(self.tr("Project"), self.ui) |
4463 tb.setIconSize(UI.Config.ToolBarIconSize) |
4463 tb.setIconSize(UI.Config.ToolBarIconSize) |
4464 tb.setObjectName("ProjectToolbar") |
4464 tb.setObjectName("ProjectToolbar") |
4719 |
4719 |
4720 def getActions(self): |
4720 def getActions(self): |
4721 """ |
4721 """ |
4722 Public method to get a list of all actions. |
4722 Public method to get a list of all actions. |
4723 |
4723 |
4724 @return list of all actions (list of E5Action) |
4724 @return list of all actions (list of EricAction) |
4725 """ |
4725 """ |
4726 return self.actions[:] |
4726 return self.actions[:] |
4727 |
4727 |
4728 def addE5Actions(self, actions): |
4728 def addEricActions(self, actions): |
4729 """ |
4729 """ |
4730 Public method to add actions to the list of actions. |
4730 Public method to add actions to the list of actions. |
4731 |
4731 |
4732 @param actions list of actions (list of E5Action) |
4732 @param actions list of actions (list of EricAction) |
4733 """ |
4733 """ |
4734 self.actions.extend(actions) |
4734 self.actions.extend(actions) |
4735 |
4735 |
4736 def removeE5Actions(self, actions): |
4736 def removeEricActions(self, actions): |
4737 """ |
4737 """ |
4738 Public method to remove actions from the list of actions. |
4738 Public method to remove actions from the list of actions. |
4739 |
4739 |
4740 @param actions list of actions (list of E5Action) |
4740 @param actions list of actions (list of EricAction) |
4741 """ |
4741 """ |
4742 for act in actions: |
4742 for act in actions: |
4743 with contextlib.suppress(ValueError): |
4743 with contextlib.suppress(ValueError): |
4744 self.actions.remove(act) |
4744 self.actions.remove(act) |
4745 |
4745 |
4762 @param fullname full name of the item to repopulate (string) |
4762 @param fullname full name of the item to repopulate (string) |
4763 """ |
4763 """ |
4764 if not self.isOpen(): |
4764 if not self.isOpen(): |
4765 return |
4765 return |
4766 |
4766 |
4767 with E5OverrideCursor(): |
4767 with EricOverrideCursor(): |
4768 name = self.getRelativePath(fullname) |
4768 name = self.getRelativePath(fullname) |
4769 self.prepareRepopulateItem.emit(name) |
4769 self.prepareRepopulateItem.emit(name) |
4770 self.__model.repopulateItem(name) |
4770 self.__model.repopulateItem(name) |
4771 self.completeRepopulateItem.emit(name) |
4771 self.completeRepopulateItem.emit(name) |
4772 |
4772 |
4816 if vcs: |
4816 if vcs: |
4817 vcsExists, msg = vcs.vcsExists() |
4817 vcsExists, msg = vcs.vcsExists() |
4818 if not vcsExists: |
4818 if not vcsExists: |
4819 if override: |
4819 if override: |
4820 # override failed, revert to original |
4820 # override failed, revert to original |
4821 with E5OverridenCursor(): |
4821 with EricOverridenCursor(): |
4822 E5MessageBox.critical( |
4822 EricMessageBox.critical( |
4823 self.ui, |
4823 self.ui, |
4824 self.tr("Version Control System"), |
4824 self.tr("Version Control System"), |
4825 self.tr( |
4825 self.tr( |
4826 "<p>The selected VCS <b>{0}</b> could not be" |
4826 "<p>The selected VCS <b>{0}</b> could not be" |
4827 " found. <br/>Reverting override.</p><p>{1}" |
4827 " found. <br/>Reverting override.</p><p>{1}" |
4828 "</p>") |
4828 "</p>") |
4829 .format(vcsSystem, msg)) |
4829 .format(vcsSystem, msg)) |
4830 self.pudata["VCSOVERRIDE"] = "" |
4830 self.pudata["VCSOVERRIDE"] = "" |
4831 return self.initVCS(nooverride=True) |
4831 return self.initVCS(nooverride=True) |
4832 |
4832 |
4833 with E5OverridenCursor(): |
4833 with EricOverridenCursor(): |
4834 E5MessageBox.critical( |
4834 EricMessageBox.critical( |
4835 self.ui, |
4835 self.ui, |
4836 self.tr("Version Control System"), |
4836 self.tr("Version Control System"), |
4837 self.tr( |
4837 self.tr( |
4838 "<p>The selected VCS <b>{0}</b> could not be" |
4838 "<p>The selected VCS <b>{0}</b> could not be" |
4839 " found.<br/>Disabling version control.</p>" |
4839 " found.<br/>Disabling version control.</p>" |
4874 """ |
4874 """ |
4875 Public method to reset the VCS. |
4875 Public method to reset the VCS. |
4876 """ |
4876 """ |
4877 self.pdata["VCS"] = 'None' |
4877 self.pdata["VCS"] = 'None' |
4878 self.vcs = self.initVCS() |
4878 self.vcs = self.initVCS() |
4879 e5App().getObject("PluginManager").deactivateVcsPlugins() |
4879 ericApp().getObject("PluginManager").deactivateVcsPlugins() |
4880 |
4880 |
4881 def __showContextMenuVCS(self): |
4881 def __showContextMenuVCS(self): |
4882 """ |
4882 """ |
4883 Private slot called before the vcs menu is shown. |
4883 Private slot called before the vcs menu is shown. |
4884 """ |
4884 """ |
4955 Private slot used to show the code coverage information for the |
4955 Private slot used to show the code coverage information for the |
4956 project files. |
4956 project files. |
4957 """ |
4957 """ |
4958 fn = self.getMainScript(True) |
4958 fn = self.getMainScript(True) |
4959 if fn is None: |
4959 if fn is None: |
4960 E5MessageBox.critical( |
4960 EricMessageBox.critical( |
4961 self.ui, |
4961 self.ui, |
4962 self.tr("Coverage Data"), |
4962 self.tr("Coverage Data"), |
4963 self.tr( |
4963 self.tr( |
4964 "There is no main script defined for the" |
4964 "There is no main script defined for the" |
4965 " current project. Aborting")) |
4965 " current project. Aborting")) |
5005 """ |
5005 """ |
5006 Private slot used to show the profiling information for the project. |
5006 Private slot used to show the profiling information for the project. |
5007 """ |
5007 """ |
5008 fn = self.getMainScript(True) |
5008 fn = self.getMainScript(True) |
5009 if fn is None: |
5009 if fn is None: |
5010 E5MessageBox.critical( |
5010 EricMessageBox.critical( |
5011 self.ui, |
5011 self.ui, |
5012 self.tr("Profile Data"), |
5012 self.tr("Profile Data"), |
5013 self.tr( |
5013 self.tr( |
5014 "There is no main script defined for the" |
5014 "There is no main script defined for the" |
5015 " current project. Aborting")) |
5015 " current project. Aborting")) |
5082 |
5082 |
5083 def handleApplicationDiagram(self): |
5083 def handleApplicationDiagram(self): |
5084 """ |
5084 """ |
5085 Public method to handle the application diagram context menu action. |
5085 Public method to handle the application diagram context menu action. |
5086 """ |
5086 """ |
5087 res = E5MessageBox.yesNo( |
5087 res = EricMessageBox.yesNo( |
5088 self.ui, |
5088 self.ui, |
5089 self.tr("Application Diagram"), |
5089 self.tr("Application Diagram"), |
5090 self.tr("""Include module names?"""), |
5090 self.tr("""Include module names?"""), |
5091 yesDefault=True) |
5091 yesDefault=True) |
5092 |
5092 |
5227 """ |
5227 """ |
5228 Private slot to create a PKGLIST file needed for archive file creation. |
5228 Private slot to create a PKGLIST file needed for archive file creation. |
5229 """ |
5229 """ |
5230 pkglist = os.path.join(self.ppath, "PKGLIST") |
5230 pkglist = os.path.join(self.ppath, "PKGLIST") |
5231 if os.path.exists(pkglist): |
5231 if os.path.exists(pkglist): |
5232 res = E5MessageBox.yesNo( |
5232 res = EricMessageBox.yesNo( |
5233 self.ui, |
5233 self.ui, |
5234 self.tr("Create Package List"), |
5234 self.tr("Create Package List"), |
5235 self.tr( |
5235 self.tr( |
5236 "<p>The file <b>PKGLIST</b> already" |
5236 "<p>The file <b>PKGLIST</b> already" |
5237 " exists.</p><p>Overwrite it?</p>"), |
5237 " exists.</p><p>Overwrite it?</p>"), |
5238 icon=E5MessageBox.Warning) |
5238 icon=EricMessageBox.Warning) |
5239 if not res: |
5239 if not res: |
5240 return # don't overwrite |
5240 return # don't overwrite |
5241 |
5241 |
5242 # build the list of entries |
5242 # build the list of entries |
5243 lst_ = [] |
5243 lst_ = [] |
5275 "\n".join([Utilities.fromNativeSeparators(f) |
5275 "\n".join([Utilities.fromNativeSeparators(f) |
5276 for f in lst])) |
5276 for f in lst])) |
5277 pkglistFile.write("\n") |
5277 pkglistFile.write("\n") |
5278 # ensure the file ends with an empty line |
5278 # ensure the file ends with an empty line |
5279 except OSError as why: |
5279 except OSError as why: |
5280 E5MessageBox.critical( |
5280 EricMessageBox.critical( |
5281 self.ui, |
5281 self.ui, |
5282 self.tr("Create Package List"), |
5282 self.tr("Create Package List"), |
5283 self.tr( |
5283 self.tr( |
5284 """<p>The file <b>PKGLIST</b> could not be created.</p>""" |
5284 """<p>The file <b>PKGLIST</b> could not be created.</p>""" |
5285 """<p>Reason: {0}</p>""").format(str(why))) |
5285 """<p>Reason: {0}</p>""").format(str(why))) |
5294 Private slot to create eric plugin archives. |
5294 Private slot to create eric plugin archives. |
5295 |
5295 |
5296 @param snapshot flag indicating snapshot archives (boolean) |
5296 @param snapshot flag indicating snapshot archives (boolean) |
5297 """ |
5297 """ |
5298 if not self.pdata["MAINSCRIPT"]: |
5298 if not self.pdata["MAINSCRIPT"]: |
5299 E5MessageBox.critical( |
5299 EricMessageBox.critical( |
5300 self.ui, |
5300 self.ui, |
5301 self.tr("Create Plugin Archive"), |
5301 self.tr("Create Plugin Archive"), |
5302 self.tr( |
5302 self.tr( |
5303 """The project does not have a main script defined. """ |
5303 """The project does not have a main script defined. """ |
5304 """Aborting...""")) |
5304 """Aborting...""")) |
5308 pkglists = [os.path.basename(f) for f in |
5308 pkglists = [os.path.basename(f) for f in |
5309 glob.glob(os.path.join(self.ppath, "PKGLIST*"))] |
5309 glob.glob(os.path.join(self.ppath, "PKGLIST*"))] |
5310 if len(pkglists) == 1: |
5310 if len(pkglists) == 1: |
5311 selectedLists = [os.path.join(self.ppath, pkglists[0])] |
5311 selectedLists = [os.path.join(self.ppath, pkglists[0])] |
5312 elif len(pkglists) > 1: |
5312 elif len(pkglists) > 1: |
5313 dlg = E5ListSelectionDialog( |
5313 dlg = EricListSelectionDialog( |
5314 sorted(pkglists), title=self.tr("Create Plugin Archive"), |
5314 sorted(pkglists), title=self.tr("Create Plugin Archive"), |
5315 message=self.tr("Select package lists:"), |
5315 message=self.tr("Select package lists:"), |
5316 checkBoxSelection=True) |
5316 checkBoxSelection=True) |
5317 if dlg.exec() == QDialog.DialogCode.Accepted: |
5317 if dlg.exec() == QDialog.DialogCode.Accepted: |
5318 selectedLists = [os.path.join(self.ppath, s) |
5318 selectedLists = [os.path.join(self.ppath, s) |
5319 for s in dlg.getSelection()] |
5319 for s in dlg.getSelection()] |
5320 else: |
5320 else: |
5321 return |
5321 return |
5322 |
5322 |
5323 if not selectedLists: |
5323 if not selectedLists: |
5324 E5MessageBox.critical( |
5324 EricMessageBox.critical( |
5325 self.ui, |
5325 self.ui, |
5326 self.tr("Create Plugin Archive"), |
5326 self.tr("Create Plugin Archive"), |
5327 self.tr("""<p>No package list files (PKGLIST*) available or""" |
5327 self.tr("""<p>No package list files (PKGLIST*) available or""" |
5328 """ selected. Aborting...</p>""")) |
5328 """ selected. Aborting...</p>""")) |
5329 return |
5329 return |
5330 |
5330 |
5331 progress = E5ProgressDialog( |
5331 progress = EricProgressDialog( |
5332 self.tr("Creating plugin archives..."), self.tr("Abort"), |
5332 self.tr("Creating plugin archives..."), self.tr("Abort"), |
5333 0, len(selectedLists), self.tr("%v/%m Archives")) |
5333 0, len(selectedLists), self.tr("%v/%m Archives")) |
5334 progress.setMinimumDuration(0) |
5334 progress.setMinimumDuration(0) |
5335 progress.setWindowTitle(self.tr("Create Plugin Archives")) |
5335 progress.setWindowTitle(self.tr("Create Plugin Archives")) |
5336 errors = 0 |
5336 errors = 0 |
5341 |
5341 |
5342 try: |
5342 try: |
5343 with open(pkglist, "r", encoding="utf-8") as pkglistFile: |
5343 with open(pkglist, "r", encoding="utf-8") as pkglistFile: |
5344 names = pkglistFile.read() |
5344 names = pkglistFile.read() |
5345 except OSError as why: |
5345 except OSError as why: |
5346 E5MessageBox.critical( |
5346 EricMessageBox.critical( |
5347 self.ui, |
5347 self.ui, |
5348 self.tr("Create Plugin Archive"), |
5348 self.tr("Create Plugin Archive"), |
5349 self.tr( |
5349 self.tr( |
5350 """<p>The file <b>{0}</b> could not be read.</p>""" |
5350 """<p>The file <b>{0}</b> could not be read.</p>""" |
5351 """<p>Reason: {1}</p>""").format( |
5351 """<p>Reason: {1}</p>""").format( |
5368 if line.startswith("archive_name="): |
5368 if line.startswith("archive_name="): |
5369 archiveName = line.split("=")[1] |
5369 archiveName = line.split("=")[1] |
5370 elif line.startswith("archive_version="): |
5370 elif line.startswith("archive_version="): |
5371 archiveVersion = line.split("=")[1] |
5371 archiveVersion = line.split("=")[1] |
5372 elif line.startswith("initial_list "): |
5372 elif line.startswith("initial_list "): |
5373 E5MessageBox.critical( |
5373 EricMessageBox.critical( |
5374 self.ui, |
5374 self.ui, |
5375 self.tr("Create Plugin Archive"), |
5375 self.tr("Create Plugin Archive"), |
5376 self.tr( |
5376 self.tr( |
5377 """<p>The file <b>{0}</b> is not ready yet.""" |
5377 """<p>The file <b>{0}</b> is not ready yet.""" |
5378 """</p><p>Please rework it and delete the""" |
5378 """</p><p>Please rework it and delete the""" |
5395 self.pdata["MAINSCRIPT"].replace(".py", ".zip")) |
5395 self.pdata["MAINSCRIPT"].replace(".py", ".zip")) |
5396 ) |
5396 ) |
5397 try: |
5397 try: |
5398 archiveFile = zipfile.ZipFile(archive, "w") |
5398 archiveFile = zipfile.ZipFile(archive, "w") |
5399 except OSError as why: |
5399 except OSError as why: |
5400 E5MessageBox.critical( |
5400 EricMessageBox.critical( |
5401 self.ui, |
5401 self.ui, |
5402 self.tr("Create Plugin Archive"), |
5402 self.tr("Create Plugin Archive"), |
5403 self.tr( |
5403 self.tr( |
5404 """<p>The eric plugin archive file <b>{0}</b>""" |
5404 """<p>The eric plugin archive file <b>{0}</b>""" |
5405 """ could not be created.</p>""" |
5405 """ could not be created.</p>""" |
5430 self.__pluginVersionToTuple(version) < |
5430 self.__pluginVersionToTuple(version) < |
5431 self.__pluginVersionToTuple(archiveVersion) |
5431 self.__pluginVersionToTuple(archiveVersion) |
5432 ): |
5432 ): |
5433 version = archiveVersion |
5433 version = archiveVersion |
5434 except OSError as why: |
5434 except OSError as why: |
5435 E5MessageBox.critical( |
5435 EricMessageBox.critical( |
5436 self.ui, |
5436 self.ui, |
5437 self.tr("Create Plugin Archive"), |
5437 self.tr("Create Plugin Archive"), |
5438 self.tr( |
5438 self.tr( |
5439 """<p>The file <b>{0}</b> could not be""" |
5439 """<p>The file <b>{0}</b> could not be""" |
5440 """ stored in the archive. Ignoring it.</p>""" |
5440 """ stored in the archive. Ignoring it.</p>""" |
5499 """ |
5499 """ |
5500 try: |
5500 try: |
5501 sourcelines, encoding = Utilities.readEncodedFile(filename) |
5501 sourcelines, encoding = Utilities.readEncodedFile(filename) |
5502 sourcelines = sourcelines.splitlines(True) |
5502 sourcelines = sourcelines.splitlines(True) |
5503 except (OSError, UnicodeError) as why: |
5503 except (OSError, UnicodeError) as why: |
5504 E5MessageBox.critical( |
5504 EricMessageBox.critical( |
5505 self.ui, |
5505 self.ui, |
5506 self.tr("Create Plugin Archive"), |
5506 self.tr("Create Plugin Archive"), |
5507 self.tr("""<p>The plugin file <b>{0}</b> could """ |
5507 self.tr("""<p>The plugin file <b>{0}</b> could """ |
5508 """not be read.</p>""" |
5508 """not be read.</p>""" |
5509 """<p>Reason: {1}</p>""") |
5509 """<p>Reason: {1}</p>""") |
5540 version = "0.0.0" |
5540 version = "0.0.0" |
5541 try: |
5541 try: |
5542 sourcelines = Utilities.readEncodedFile(filename)[0] |
5542 sourcelines = Utilities.readEncodedFile(filename)[0] |
5543 sourcelines = sourcelines.splitlines(True) |
5543 sourcelines = sourcelines.splitlines(True) |
5544 except (OSError, UnicodeError) as why: |
5544 except (OSError, UnicodeError) as why: |
5545 E5MessageBox.critical( |
5545 EricMessageBox.critical( |
5546 self.ui, |
5546 self.ui, |
5547 self.tr("Create Plugin Archive"), |
5547 self.tr("Create Plugin Archive"), |
5548 self.tr( |
5548 self.tr( |
5549 """<p>The plugin file <b>{0}</b> could """ |
5549 """<p>The plugin file <b>{0}</b> could """ |
5550 """not be read.</p> <p>Reason: {1}</p>""") |
5550 """not be read.</p> <p>Reason: {1}</p>""") |
5655 exitCode, exitStatus, questionOnly, interactive)) |
5655 exitCode, exitStatus, questionOnly, interactive)) |
5656 self.__makeProcess.setWorkingDirectory(self.getProjectPath()) |
5656 self.__makeProcess.setWorkingDirectory(self.getProjectPath()) |
5657 self.__makeProcess.start(prog, args) |
5657 self.__makeProcess.start(prog, args) |
5658 |
5658 |
5659 if not self.__makeProcess.waitForStarted(): |
5659 if not self.__makeProcess.waitForStarted(): |
5660 E5MessageBox.critical( |
5660 EricMessageBox.critical( |
5661 self.ui, |
5661 self.ui, |
5662 self.tr("Execute Make"), |
5662 self.tr("Execute Make"), |
5663 self.tr("""The make process did not start.""")) |
5663 self.tr("""The make process did not start.""")) |
5664 |
5664 |
5665 self.__cleanupMake() |
5665 self.__cleanupMake() |
5700 @param interactive flag indicating an interactive invocation (i.e. |
5700 @param interactive flag indicating an interactive invocation (i.e. |
5701 through a menu action) |
5701 through a menu action) |
5702 @type bool |
5702 @type bool |
5703 """ |
5703 """ |
5704 if exitStatus == QProcess.ExitStatus.CrashExit: |
5704 if exitStatus == QProcess.ExitStatus.CrashExit: |
5705 E5MessageBox.critical( |
5705 EricMessageBox.critical( |
5706 self.ui, |
5706 self.ui, |
5707 self.tr("Execute Make"), |
5707 self.tr("Execute Make"), |
5708 self.tr("""The make process crashed.""")) |
5708 self.tr("""The make process crashed.""")) |
5709 else: |
5709 else: |
5710 if questionOnly and exitCode == 1: |
5710 if questionOnly and exitCode == 1: |