538 self.pdata[index].remove(file) |
538 self.pdata[index].remove(file) |
539 self.setDirty(True) |
539 self.setDirty(True) |
540 |
540 |
541 def __readProject(self, fn): |
541 def __readProject(self, fn): |
542 """ |
542 """ |
543 Private method to read in a project (.e4p, .e4pz, .e3p, .e3pz) file. |
543 Private method to read in a project (.e4p, .e4pz) file. |
544 |
544 |
545 @param fn filename of the project file to be read (string) |
545 @param fn filename of the project file to be read (string) |
546 @return flag indicating success |
546 @return flag indicating success |
547 """ |
547 """ |
548 try: |
548 try: |
549 if fn.lower().endswith("e4pz") or fn.lower().endswith("e3pz"): |
549 if fn.lower().endswith("e4pz"): |
550 try: |
550 try: |
551 import gzip |
551 import gzip |
552 except ImportError: |
552 except ImportError: |
553 QApplication.restoreOverrideCursor() |
553 QApplication.restoreOverrideCursor() |
554 QMessageBox.critical(None, |
554 QMessageBox.critical(None, |
623 for fn in self.pdata["OTHERS"]: |
623 for fn in self.pdata["OTHERS"]: |
624 dn = os.path.dirname(fn) |
624 dn = os.path.dirname(fn) |
625 if dn not in self.otherssubdirs: |
625 if dn not in self.otherssubdirs: |
626 self.otherssubdirs.append(dn) |
626 self.otherssubdirs.append(dn) |
627 |
627 |
628 if self.pfile.endswith('e3p') or self.pfile.endswith('e3pz'): |
|
629 # needs conversion to new format |
|
630 self.setDirty(True) |
|
631 |
|
632 return res |
628 return res |
633 |
629 |
634 def __readXMLProject(self, fn, validating): |
630 def __readXMLProject(self, fn, validating): |
635 """ |
631 """ |
636 Private method to read the project data from an XML file. |
632 Private method to read the project data from an XML file. |
638 @param fn filename of the project file to be read (string) |
634 @param fn filename of the project file to be read (string) |
639 @param validating flag indicating a validation of the XML file is |
635 @param validating flag indicating a validation of the XML file is |
640 requested (boolean) |
636 requested (boolean) |
641 @return flag indicating success (boolean) |
637 @return flag indicating success (boolean) |
642 """ |
638 """ |
643 if fn.lower().endswith("e4pz") or fn.lower().endswith("e3pz"): |
639 if fn.lower().endswith("e4pz"): |
644 # work around for a bug in xmlproc |
640 # work around for a bug in xmlproc |
645 validating = False |
641 validating = False |
646 |
642 |
647 parser = make_parser(validating) |
643 parser = make_parser(validating) |
648 handler = ProjectHandler(self) |
644 handler = ProjectHandler(self) |
652 parser.setContentHandler(handler) |
648 parser.setContentHandler(handler) |
653 parser.setEntityResolver(er) |
649 parser.setEntityResolver(er) |
654 parser.setErrorHandler(eh) |
650 parser.setErrorHandler(eh) |
655 |
651 |
656 try: |
652 try: |
657 if fn.lower().endswith("e4pz") or fn.lower().endswith("e3pz"): |
653 if fn.lower().endswith("e4pz"): |
658 try: |
654 try: |
659 import gzip |
655 import gzip |
660 except ImportError: |
656 except ImportError: |
661 QApplication.restoreOverrideCursor() |
657 QApplication.restoreOverrideCursor() |
662 QMessageBox.critical(None, |
658 QMessageBox.critical(None, |
808 |
804 |
809 def __writeUserProperties(self): |
805 def __writeUserProperties(self): |
810 """ |
806 """ |
811 Private method to write the project data to an XML file. |
807 Private method to write the project data to an XML file. |
812 """ |
808 """ |
813 if self.pfile is None or \ |
809 if self.pfile is None: |
814 self.pfile.endswith('e3p') or \ |
|
815 self.pfile.endswith('e3pz'): |
|
816 return |
810 return |
817 |
811 |
818 fn, ext = os.path.splitext(os.path.basename(self.pfile)) |
812 fn, ext = os.path.splitext(os.path.basename(self.pfile)) |
819 |
813 |
820 fn = os.path.join(self.getProjectManagementDir(), '%s.e4q' % fn) |
814 fn = os.path.join(self.getProjectManagementDir(), '%s.e4q' % fn) |
831 self.trUtf8("<p>The user specific project properties file <b>{0}</b>" |
825 self.trUtf8("<p>The user specific project properties file <b>{0}</b>" |
832 " could not be written.</p>").format(fn)) |
826 " could not be written.</p>").format(fn)) |
833 |
827 |
834 def __readSession(self, quiet = False, indicator = ""): |
828 def __readSession(self, quiet = False, indicator = ""): |
835 """ |
829 """ |
836 Private method to read in the project session file (.e4s, .e3s) |
830 Private method to read in the project session file (.e4s) |
837 |
831 |
838 @param quiet flag indicating quiet operations. |
832 @param quiet flag indicating quiet operations. |
839 If this flag is true, no errors are reported. |
833 If this flag is true, no errors are reported. |
840 @keyparam indicator indicator string (string) |
834 @keyparam indicator indicator string (string) |
841 """ |
835 """ |
847 return |
841 return |
848 |
842 |
849 fn, ext = os.path.splitext(os.path.basename(self.pfile)) |
843 fn, ext = os.path.splitext(os.path.basename(self.pfile)) |
850 |
844 |
851 try: |
845 try: |
852 if ext.lower() in [".e4pz", ".e3pz"]: |
846 if ext.lower() in [".e4pz"]: |
853 if ext.lower() == ".e3pz": |
847 fn = os.path.join(self.getProjectManagementDir(), |
854 fn = os.path.join(self.ppath, '%s.e3sz' % fn) |
848 '%s%s.e4sz' % (fn, indicator)) |
855 else: |
|
856 fn = os.path.join(self.getProjectManagementDir(), |
|
857 '%s%s.e4sz' % (fn, indicator)) |
|
858 try: |
849 try: |
859 import gzip |
850 import gzip |
860 except ImportError: |
851 except ImportError: |
861 if not quiet: |
852 if not quiet: |
862 QMessageBox.critical(None, |
853 QMessageBox.critical(None, |
864 self.trUtf8("""Compressed project session files not""" |
855 self.trUtf8("""Compressed project session files not""" |
865 """ supported. The compression library is missing.""")) |
856 """ supported. The compression library is missing.""")) |
866 return |
857 return |
867 f = gzip.open(fn, "r") |
858 f = gzip.open(fn, "r") |
868 else: |
859 else: |
869 if ext.lower() == ".e3p": |
860 fn = os.path.join(self.getProjectManagementDir(), |
870 fn = os.path.join(self.ppath, '%s.e3s' % fn) |
861 '%s%s.e4s' % (fn, indicator)) |
871 else: |
|
872 fn = os.path.join(self.getProjectManagementDir(), |
|
873 '%s%s.e4s' % (fn, indicator)) |
|
874 f = open(fn, "r") |
862 f = open(fn, "r") |
875 line = f.readline() |
863 line = f.readline() |
876 dtdLine = f.readline() |
864 dtdLine = f.readline() |
877 f.close() |
865 f.close() |
878 except EnvironmentError: |
866 except EnvironmentError: |
914 @param validating flag indicating a validation of the XML file is |
902 @param validating flag indicating a validation of the XML file is |
915 requested (boolean) |
903 requested (boolean) |
916 @param quiet flag indicating quiet operations. |
904 @param quiet flag indicating quiet operations. |
917 If this flag is true, no errors are reported. |
905 If this flag is true, no errors are reported. |
918 """ |
906 """ |
919 if fn.lower().endswith("e4sz") or fn.lower().endswith("e3sz"): |
907 if fn.lower().endswith("e4sz"): |
920 # work around for a bug in xmlproc |
908 # work around for a bug in xmlproc |
921 validating = False |
909 validating = False |
922 |
910 |
923 parser = make_parser(validating) |
911 parser = make_parser(validating) |
924 handler = SessionHandler(self) |
912 handler = SessionHandler(self) |
928 parser.setContentHandler(handler) |
916 parser.setContentHandler(handler) |
929 parser.setEntityResolver(er) |
917 parser.setEntityResolver(er) |
930 parser.setErrorHandler(eh) |
918 parser.setErrorHandler(eh) |
931 |
919 |
932 try: |
920 try: |
933 if fn.lower().endswith("e4sz") or fn.lower().endswith("e3sz"): |
921 if fn.lower().endswith("e4sz"): |
934 try: |
922 try: |
935 import gzip |
923 import gzip |
936 except ImportError: |
924 except ImportError: |
937 if not quiet: |
925 if not quiet: |
938 QMessageBox.critical(None, |
926 QMessageBox.critical(None, |
983 |
971 |
984 @param quiet flag indicating quiet operations. |
972 @param quiet flag indicating quiet operations. |
985 If this flag is true, no errors are reported. |
973 If this flag is true, no errors are reported. |
986 @keyparam indicator indicator string (string) |
974 @keyparam indicator indicator string (string) |
987 """ |
975 """ |
988 if self.pfile is None or \ |
976 if self.pfile is None: |
989 self.pfile.endswith('e3p') or \ |
|
990 self.pfile.endswith('e3pz'): |
|
991 if not quiet: |
977 if not quiet: |
992 QMessageBox.critical(None, |
978 QMessageBox.critical(None, |
993 self.trUtf8("Save project session"), |
979 self.trUtf8("Save project session"), |
994 self.trUtf8("Please save the project first.")) |
980 self.trUtf8("Please save the project first.")) |
995 return |
981 return |
1038 return |
1024 return |
1039 |
1025 |
1040 fname, ext = os.path.splitext(os.path.basename(self.pfile)) |
1026 fname, ext = os.path.splitext(os.path.basename(self.pfile)) |
1041 |
1027 |
1042 for fn in [os.path.join(self.getProjectManagementDir(), "%s.e4sz" % fname), |
1028 for fn in [os.path.join(self.getProjectManagementDir(), "%s.e4sz" % fname), |
1043 os.path.join(self.getProjectManagementDir(), "%s.e4s" % fname), |
1029 os.path.join(self.getProjectManagementDir(), "%s.e4s" % fname)]: |
1044 os.path.join(self.ppath, "%s.e3sz" % fname), |
|
1045 os.path.join(self.ppath, "%s.e3s" % fname)]: |
|
1046 if os.path.exists(fn): |
1030 if os.path.exists(fn): |
1047 try: |
1031 try: |
1048 os.remove(fn) |
1032 os.remove(fn) |
1049 except OSError: |
1033 except OSError: |
1050 QMessageBox.critical(None, |
1034 QMessageBox.critical(None, |
1052 self.trUtf8("<p>The project session file <b>{0}</b> could not be" |
1036 self.trUtf8("<p>The project session file <b>{0}</b> could not be" |
1053 " deleted.</p>").format(fn)) |
1037 " deleted.</p>").format(fn)) |
1054 |
1038 |
1055 def __readTasks(self): |
1039 def __readTasks(self): |
1056 """ |
1040 """ |
1057 Private method to read in the project tasks file (.e4t, .e3t) |
1041 Private method to read in the project tasks file (.e4t) |
1058 """ |
1042 """ |
1059 if self.pfile is None: |
1043 if self.pfile is None: |
1060 QMessageBox.critical(None, |
1044 QMessageBox.critical(None, |
1061 self.trUtf8("Read tasks"), |
1045 self.trUtf8("Read tasks"), |
1062 self.trUtf8("Please save the project first.")) |
1046 self.trUtf8("Please save the project first.")) |
1063 return |
1047 return |
1064 |
1048 |
1065 fn, ext = os.path.splitext(os.path.basename(self.pfile)) |
1049 fn, ext = os.path.splitext(os.path.basename(self.pfile)) |
1066 |
1050 |
1067 try: |
1051 try: |
1068 if ext.lower() in [".e4pz", "*.e3pz"]: |
1052 if ext.lower() in [".e4pz"]: |
1069 if ext.lower() == ".e3pz": |
1053 fn = os.path.join(self.getProjectManagementDir(), '%s.e4tz' % fn) |
1070 fn = os.path.join(self.ppath, '%s.e3tz' % fn) |
|
1071 else: |
|
1072 fn = os.path.join(self.getProjectManagementDir(), '%s.e4tz' % fn) |
|
1073 if not os.path.exists(fn): |
1054 if not os.path.exists(fn): |
1074 return |
1055 return |
1075 try: |
1056 try: |
1076 import gzip |
1057 import gzip |
1077 except ImportError: |
1058 except ImportError: |
1080 self.trUtf8("""Compressed tasks files not supported.""" |
1061 self.trUtf8("""Compressed tasks files not supported.""" |
1081 """ The compression library is missing.""")) |
1062 """ The compression library is missing.""")) |
1082 return |
1063 return |
1083 f = gzip.open(fn, "r") |
1064 f = gzip.open(fn, "r") |
1084 else: |
1065 else: |
1085 if ext.lower() == ".e3p": |
1066 fn = os.path.join(self.getProjectManagementDir(), '%s.e4t' % fn) |
1086 fn = os.path.join(self.ppath, '%s.e3t' % fn) |
|
1087 else: |
|
1088 fn = os.path.join(self.getProjectManagementDir(), '%s.e4t' % fn) |
|
1089 if not os.path.exists(fn): |
1067 if not os.path.exists(fn): |
1090 return |
1068 return |
1091 f = open(fn, "r") |
1069 f = open(fn, "r") |
1092 line = f.readline() |
1070 line = f.readline() |
1093 dtdLine = f.readline() |
1071 dtdLine = f.readline() |
1115 |
1093 |
1116 @param fn filename of the project tasks file to be read (string) |
1094 @param fn filename of the project tasks file to be read (string) |
1117 @param validating flag indicating a validation of the XML file is |
1095 @param validating flag indicating a validation of the XML file is |
1118 requested (boolean) |
1096 requested (boolean) |
1119 """ |
1097 """ |
1120 if fn.lower().endswith("e4tz") or fn.lower().endswith("e3tz"): |
1098 if fn.lower().endswith("e4tz"): |
1121 # work around for a bug in xmlproc |
1099 # work around for a bug in xmlproc |
1122 validating = False |
1100 validating = False |
1123 |
1101 |
1124 parser = make_parser(validating) |
1102 parser = make_parser(validating) |
1125 handler = TasksHandler(1) |
1103 handler = TasksHandler(1) |
1129 parser.setContentHandler(handler) |
1107 parser.setContentHandler(handler) |
1130 parser.setEntityResolver(er) |
1108 parser.setEntityResolver(er) |
1131 parser.setErrorHandler(eh) |
1109 parser.setErrorHandler(eh) |
1132 |
1110 |
1133 try: |
1111 try: |
1134 if fn.lower().endswith("e4tz") or fn.lower().endswith("e3tz"): |
1112 if fn.lower().endswith("e4tz"): |
1135 try: |
1113 try: |
1136 import gzip |
1114 import gzip |
1137 except ImportError: |
1115 except ImportError: |
1138 QMessageBox.critical(None, |
1116 QMessageBox.critical(None, |
1139 self.trUtf8("Read tasks"), |
1117 self.trUtf8("Read tasks"), |
1198 self.trUtf8("<p>The tasks file <b>{0}</b> could not be written.</p>") |
1176 self.trUtf8("<p>The tasks file <b>{0}</b> could not be written.</p>") |
1199 .format(fn)) |
1177 .format(fn)) |
1200 |
1178 |
1201 def __readDebugProperties(self, quiet = False): |
1179 def __readDebugProperties(self, quiet = False): |
1202 """ |
1180 """ |
1203 Private method to read in the project debugger properties file (.e4d, .e3d) |
1181 Private method to read in the project debugger properties file (.e4d) |
1204 |
1182 |
1205 @param quiet flag indicating quiet operations. |
1183 @param quiet flag indicating quiet operations. |
1206 If this flag is true, no errors are reported. |
1184 If this flag is true, no errors are reported. |
1207 """ |
1185 """ |
1208 if self.pfile is None: |
1186 if self.pfile is None: |
1213 return |
1191 return |
1214 |
1192 |
1215 fn, ext = os.path.splitext(os.path.basename(self.pfile)) |
1193 fn, ext = os.path.splitext(os.path.basename(self.pfile)) |
1216 |
1194 |
1217 try: |
1195 try: |
1218 if ext.lower() in [".e4pz", "*.e3pz"]: |
1196 if ext.lower() in [".e4pz"]: |
1219 if ext.lower() == ".e3pz": |
1197 fn = os.path.join(self.getProjectManagementDir(), '%s.e4dz' % fn) |
1220 fn = os.path.join(self.ppath, '%s.e3dz' % fn) |
|
1221 else: |
|
1222 fn = os.path.join(self.getProjectManagementDir(), '%s.e4dz' % fn) |
|
1223 try: |
1198 try: |
1224 import gzip |
1199 import gzip |
1225 except ImportError: |
1200 except ImportError: |
1226 if not quiet: |
1201 if not quiet: |
1227 QMessageBox.critical(None, |
1202 QMessageBox.critical(None, |
1230 """ supported. The compression library is""" |
1205 """ supported. The compression library is""" |
1231 """ missing.""")) |
1206 """ missing.""")) |
1232 return |
1207 return |
1233 f = gzip.open(fn, "r") |
1208 f = gzip.open(fn, "r") |
1234 else: |
1209 else: |
1235 if ext.lower() == ".e3p": |
1210 fn = os.path.join(self.getProjectManagementDir(), '%s.e4d' % fn) |
1236 fn = os.path.join(self.ppath, '%s.e3d' % fn) |
|
1237 else: |
|
1238 fn = os.path.join(self.getProjectManagementDir(), '%s.e4d' % fn) |
|
1239 f = open(fn, "r") |
1211 f = open(fn, "r") |
1240 line = f.readline() |
1212 line = f.readline() |
1241 dtdLine = f.readline() |
1213 dtdLine = f.readline() |
1242 f.close() |
1214 f.close() |
1243 except EnvironmentError: |
1215 except EnvironmentError: |
1267 @param validating flag indicating a validation of the XML file is |
1239 @param validating flag indicating a validation of the XML file is |
1268 requested (boolean) |
1240 requested (boolean) |
1269 @param quiet flag indicating quiet operations. |
1241 @param quiet flag indicating quiet operations. |
1270 If this flag is true, no errors are reported. |
1242 If this flag is true, no errors are reported. |
1271 """ |
1243 """ |
1272 if fn.lower().endswith("e4dz") or fn.lower().endswith("e3dz"): |
1244 if fn.lower().endswith("e4dz"): |
1273 # work around for a bug in xmlproc |
1245 # work around for a bug in xmlproc |
1274 validating = False |
1246 validating = False |
1275 |
1247 |
1276 parser = make_parser(validating) |
1248 parser = make_parser(validating) |
1277 handler = DebuggerPropertiesHandler(self) |
1249 handler = DebuggerPropertiesHandler(self) |
1281 parser.setContentHandler(handler) |
1253 parser.setContentHandler(handler) |
1282 parser.setEntityResolver(er) |
1254 parser.setEntityResolver(er) |
1283 parser.setErrorHandler(eh) |
1255 parser.setErrorHandler(eh) |
1284 |
1256 |
1285 try: |
1257 try: |
1286 if fn.lower().endswith("e4dz") or fn.lower().endswith("e3dz"): |
1258 if fn.lower().endswith("e4dz"): |
1287 try: |
1259 try: |
1288 import gzip |
1260 import gzip |
1289 except ImportError: |
1261 except ImportError: |
1290 if not quiet: |
1262 if not quiet: |
1291 QMessageBox.critical(None, |
1263 QMessageBox.critical(None, |
1328 Private method to write the project debugger properties file (.e4d) |
1300 Private method to write the project debugger properties file (.e4d) |
1329 |
1301 |
1330 @param quiet flag indicating quiet operations. |
1302 @param quiet flag indicating quiet operations. |
1331 If this flag is true, no errors are reported. |
1303 If this flag is true, no errors are reported. |
1332 """ |
1304 """ |
1333 if self.pfile is None or \ |
1305 if self.pfile is None: |
1334 self.pfile.endswith('e3p') or \ |
|
1335 self.pfile.endswith('e3pz'): |
|
1336 if not quiet: |
1306 if not quiet: |
1337 QMessageBox.critical(None, |
1307 QMessageBox.critical(None, |
1338 self.trUtf8("Save debugger properties"), |
1308 self.trUtf8("Save debugger properties"), |
1339 self.trUtf8("Please save the project first.")) |
1309 self.trUtf8("Please save the project first.")) |
1340 return |
1310 return |
1372 " not be written.</p>") |
1342 " not be written.</p>") |
1373 .format(fn)) |
1343 .format(fn)) |
1374 |
1344 |
1375 def __deleteDebugProperties(self): |
1345 def __deleteDebugProperties(self): |
1376 """ |
1346 """ |
1377 Private method to delete the project debugger properties file (.e3d) |
1347 Private method to delete the project debugger properties file (.e4d) |
1378 """ |
1348 """ |
1379 if self.pfile is None: |
1349 if self.pfile is None: |
1380 if not quiet: |
1350 if not quiet: |
1381 QMessageBox.critical(None, |
1351 QMessageBox.critical(None, |
1382 self.trUtf8("Delete debugger properties"), |
1352 self.trUtf8("Delete debugger properties"), |
1384 return |
1354 return |
1385 |
1355 |
1386 fname, ext = os.path.splitext(os.path.basename(self.pfile)) |
1356 fname, ext = os.path.splitext(os.path.basename(self.pfile)) |
1387 |
1357 |
1388 for fn in [os.path.join(self.getProjectManagementDir(), "%s.e4dz" % fname), |
1358 for fn in [os.path.join(self.getProjectManagementDir(), "%s.e4dz" % fname), |
1389 os.path.join(self.getProjectManagementDir(), "%s.e4d" % fname), |
1359 os.path.join(self.getProjectManagementDir(), "%s.e4d" % fname)]: |
1390 os.path.join(self.ppath, "%s.e3dz" % fname), |
|
1391 os.path.join(self.ppath, "%s.e3d" % fname)]: |
|
1392 if os.path.exists(fn): |
1360 if os.path.exists(fn): |
1393 try: |
1361 try: |
1394 os.remove(fn) |
1362 os.remove(fn) |
1395 except OSError: |
1363 except OSError: |
1396 QMessageBox.critical(None, |
1364 QMessageBox.critical(None, |
2675 if fn is None: |
2643 if fn is None: |
2676 fn = QFileDialog.getOpenFileName(\ |
2644 fn = QFileDialog.getOpenFileName(\ |
2677 self.parent(), |
2645 self.parent(), |
2678 self.trUtf8("Open project"), |
2646 self.trUtf8("Open project"), |
2679 "", |
2647 "", |
2680 self.trUtf8("Project Files (*.e4p *.e4pz *.e3p *.e3pz)")) |
2648 self.trUtf8("Project Files (*.e4p *.e4pz)")) |
2681 |
2649 |
2682 QApplication.processEvents() |
2650 QApplication.processEvents() |
2683 |
2651 |
2684 if fn: |
2652 if fn: |
2685 if self.closeProject(): |
2653 if self.closeProject(): |
2818 |
2786 |
2819 @return flag indicating success |
2787 @return flag indicating success |
2820 """ |
2788 """ |
2821 if self.isDirty(): |
2789 if self.isDirty(): |
2822 if len(self.pfile) > 0: |
2790 if len(self.pfile) > 0: |
2823 if self.pfile.endswith("e3pz") or self.pfile.endswith("e3p"): |
2791 ok = self.__writeProject() |
2824 ok = self.saveProjectAs() |
|
2825 else: |
|
2826 ok = self.__writeProject() |
|
2827 else: |
2792 else: |
2828 ok = self.saveProjectAs() |
2793 ok = self.saveProjectAs() |
2829 else: |
2794 else: |
2830 ok = True |
2795 ok = True |
2831 self.sessActGrp.setEnabled(ok) |
2796 self.sessActGrp.setEnabled(ok) |
3140 Public method to get the path of the management directory. |
3105 Public method to get the path of the management directory. |
3141 |
3106 |
3142 @return path of the management directory (string) |
3107 @return path of the management directory (string) |
3143 """ |
3108 """ |
3144 if Utilities.isWindowsPlatform(): |
3109 if Utilities.isWindowsPlatform(): |
3145 return os.path.join(self.ppath, "_eric4project") |
3110 return os.path.join(self.ppath, "_eric5project") |
3146 else: |
3111 else: |
3147 return os.path.join(self.ppath, ".eric4project") |
3112 return os.path.join(self.ppath, ".eric5project") |
3148 |
3113 |
3149 def isProjectFile(self, fn): |
3114 def isProjectFile(self, fn): |
3150 """ |
3115 """ |
3151 Public method used to check, if the passed in filename belongs to the project. |
3116 Public method used to check, if the passed in filename belongs to the project. |
3152 |
3117 |
3554 self.pluginPkgListAct = E4Action(self.trUtf8('Create Package List'), |
3519 self.pluginPkgListAct = E4Action(self.trUtf8('Create Package List'), |
3555 UI.PixmapCache.getIcon("pluginArchiveList.png"), |
3520 UI.PixmapCache.getIcon("pluginArchiveList.png"), |
3556 self.trUtf8('Create &Package List'), 0, 0, |
3521 self.trUtf8('Create &Package List'), 0, 0, |
3557 self.pluginGrp,'project_plugin_pkglist') |
3522 self.pluginGrp,'project_plugin_pkglist') |
3558 self.pluginPkgListAct.setStatusTip(\ |
3523 self.pluginPkgListAct.setStatusTip(\ |
3559 self.trUtf8('Create an initial PKGLIST file for an eric4 plugin.')) |
3524 self.trUtf8('Create an initial PKGLIST file for an eric5 plugin.')) |
3560 self.pluginPkgListAct.setWhatsThis(self.trUtf8( |
3525 self.pluginPkgListAct.setWhatsThis(self.trUtf8( |
3561 """<b>Create Package List</b>""" |
3526 """<b>Create Package List</b>""" |
3562 """<p>This creates an initial list of files to include in an eric4 """ |
3527 """<p>This creates an initial list of files to include in an eric5 """ |
3563 """plugin archive. The list is created from the project file.</p>""" |
3528 """plugin archive. The list is created from the project file.</p>""" |
3564 )) |
3529 )) |
3565 self.connect(self.pluginPkgListAct, SIGNAL('triggered()'), |
3530 self.connect(self.pluginPkgListAct, SIGNAL('triggered()'), |
3566 self.__pluginCreatePkgList) |
3531 self.__pluginCreatePkgList) |
3567 self.actions.append(self.pluginPkgListAct) |
3532 self.actions.append(self.pluginPkgListAct) |
3569 self.pluginArchiveAct = E4Action(self.trUtf8('Create Plugin Archive'), |
3534 self.pluginArchiveAct = E4Action(self.trUtf8('Create Plugin Archive'), |
3570 UI.PixmapCache.getIcon("pluginArchive.png"), |
3535 UI.PixmapCache.getIcon("pluginArchive.png"), |
3571 self.trUtf8('Create Plugin &Archive'), 0, 0, |
3536 self.trUtf8('Create Plugin &Archive'), 0, 0, |
3572 self.pluginGrp,'project_plugin_archive') |
3537 self.pluginGrp,'project_plugin_archive') |
3573 self.pluginArchiveAct.setStatusTip(\ |
3538 self.pluginArchiveAct.setStatusTip(\ |
3574 self.trUtf8('Create an eric4 plugin archive file.')) |
3539 self.trUtf8('Create an eric5 plugin archive file.')) |
3575 self.pluginArchiveAct.setWhatsThis(self.trUtf8( |
3540 self.pluginArchiveAct.setWhatsThis(self.trUtf8( |
3576 """<b>Create Plugin Archive</b>""" |
3541 """<b>Create Plugin Archive</b>""" |
3577 """<p>This creates an eric4 plugin archive file using the list of files """ |
3542 """<p>This creates an eric5 plugin archive file using the list of files """ |
3578 """given in the PKGLIST file. The archive name is built from the main """ |
3543 """given in the PKGLIST file. The archive name is built from the main """ |
3579 """script name.</p>""" |
3544 """script name.</p>""" |
3580 )) |
3545 )) |
3581 self.connect(self.pluginArchiveAct, SIGNAL('triggered()'), |
3546 self.connect(self.pluginArchiveAct, SIGNAL('triggered()'), |
3582 self.__pluginCreateArchive) |
3547 self.__pluginCreateArchive) |
3585 self.pluginSArchiveAct = E4Action(self.trUtf8('Create Plugin Archive (Snapshot)'), |
3550 self.pluginSArchiveAct = E4Action(self.trUtf8('Create Plugin Archive (Snapshot)'), |
3586 UI.PixmapCache.getIcon("pluginArchiveSnapshot.png"), |
3551 UI.PixmapCache.getIcon("pluginArchiveSnapshot.png"), |
3587 self.trUtf8('Create Plugin Archive (&Snapshot)'), 0, 0, |
3552 self.trUtf8('Create Plugin Archive (&Snapshot)'), 0, 0, |
3588 self.pluginGrp,'project_plugin_sarchive') |
3553 self.pluginGrp,'project_plugin_sarchive') |
3589 self.pluginSArchiveAct.setStatusTip(\ |
3554 self.pluginSArchiveAct.setStatusTip(\ |
3590 self.trUtf8('Create an eric4 plugin archive file (snapshot release).')) |
3555 self.trUtf8('Create an eric5 plugin archive file (snapshot release).')) |
3591 self.pluginSArchiveAct.setWhatsThis(self.trUtf8( |
3556 self.pluginSArchiveAct.setWhatsThis(self.trUtf8( |
3592 """<b>Create Plugin Archive (Snapshot)</b>""" |
3557 """<b>Create Plugin Archive (Snapshot)</b>""" |
3593 """<p>This creates an eric4 plugin archive file using the list of files """ |
3558 """<p>This creates an eric5 plugin archive file using the list of files """ |
3594 """given in the PKGLIST file. The archive name is built from the main """ |
3559 """given in the PKGLIST file. The archive name is built from the main """ |
3595 """script name. The version entry of the main script is modified to """ |
3560 """script name. The version entry of the main script is modified to """ |
3596 """reflect a snapshot release.</p>""" |
3561 """reflect a snapshot release.</p>""" |
3597 )) |
3562 )) |
3598 self.connect(self.pluginSArchiveAct, SIGNAL('triggered()'), |
3563 self.connect(self.pluginSArchiveAct, SIGNAL('triggered()'), |
4401 if not "PKGLIST" in self.pdata["OTHERS"]: |
4366 if not "PKGLIST" in self.pdata["OTHERS"]: |
4402 self.appendFile("PKGLIST") |
4367 self.appendFile("PKGLIST") |
4403 |
4368 |
4404 def __pluginCreateArchive(self, snapshot = False): |
4369 def __pluginCreateArchive(self, snapshot = False): |
4405 """ |
4370 """ |
4406 Private slot to create an eric4 plugin archive. |
4371 Private slot to create an eric5 plugin archive. |
4407 |
4372 |
4408 @param snapshot flag indicating a snapshot archive (boolean) |
4373 @param snapshot flag indicating a snapshot archive (boolean) |
4409 """ |
4374 """ |
4410 pkglist = os.path.join(self.ppath, "PKGLIST") |
4375 pkglist = os.path.join(self.ppath, "PKGLIST") |
4411 if not os.path.exists(pkglist): |
4376 if not os.path.exists(pkglist): |
4449 except RuntimeError: |
4414 except RuntimeError: |
4450 archiveFile = zipfile.ZipFile(archive, "w") |
4415 archiveFile = zipfile.ZipFile(archive, "w") |
4451 except IOError as why: |
4416 except IOError as why: |
4452 QMessageBox.critical(None, |
4417 QMessageBox.critical(None, |
4453 self.trUtf8("Create Plugin Archive"), |
4418 self.trUtf8("Create Plugin Archive"), |
4454 self.trUtf8("""<p>The eric4 plugin archive file <b>{0}</b> could """ |
4419 self.trUtf8("""<p>The eric5 plugin archive file <b>{0}</b> could """ |
4455 """not be created.</p>""" |
4420 """not be created.</p>""" |
4456 """<p>Reason: {1}</p>""").format(archive, str(why)), |
4421 """<p>Reason: {1}</p>""").format(archive, str(why)), |
4457 QMessageBox.StandardButtons(\ |
4422 QMessageBox.StandardButtons(\ |
4458 QMessageBox.Ok)) |
4423 QMessageBox.Ok)) |
4459 return |
4424 return |
4485 if not archive in self.pdata["OTHERS"]: |
4450 if not archive in self.pdata["OTHERS"]: |
4486 self.appendFile(archive) |
4451 self.appendFile(archive) |
4487 |
4452 |
4488 QMessageBox.information(None, |
4453 QMessageBox.information(None, |
4489 self.trUtf8("Create Plugin Archive"), |
4454 self.trUtf8("Create Plugin Archive"), |
4490 self.trUtf8("""<p>The eric4 plugin archive file <b>{0}</b> was """ |
4455 self.trUtf8("""<p>The eric5 plugin archive file <b>{0}</b> was """ |
4491 """created successfully.</p>""").format(archive), |
4456 """created successfully.</p>""").format(archive), |
4492 QMessageBox.StandardButtons(\ |
4457 QMessageBox.StandardButtons(\ |
4493 QMessageBox.Ok)) |
4458 QMessageBox.Ok)) |
4494 |
4459 |
4495 def __pluginCreateSnapshotArchive(self): |
4460 def __pluginCreateSnapshotArchive(self): |
4496 """ |
4461 """ |
4497 Private slot to create an eric4 plugin archive snapshot release. |
4462 Private slot to create an eric5 plugin archive snapshot release. |
4498 """ |
4463 """ |
4499 self.__pluginCreateArchive(True) |
4464 self.__pluginCreateArchive(True) |
4500 |
4465 |
4501 def __createZipDirEntries(self, path, zipFile): |
4466 def __createZipDirEntries(self, path, zipFile): |
4502 """ |
4467 """ |