118 "DESCRIPTION", "VERSION", "HASH", |
118 "DESCRIPTION", "VERSION", "HASH", |
119 "AUTHOR", "EMAIL", |
119 "AUTHOR", "EMAIL", |
120 "SOURCES", "FORMS", "RESOURCES", |
120 "SOURCES", "FORMS", "RESOURCES", |
121 "TRANSLATIONS", "TRANSLATIONPATTERN", "TRANSLATIONSBINPATH", |
121 "TRANSLATIONS", "TRANSLATIONPATTERN", "TRANSLATIONSBINPATH", |
122 "TRANSLATIONEXCEPTIONS", |
122 "TRANSLATIONEXCEPTIONS", |
123 "MAINSCRIPT", |
123 "MAINSCRIPT", "EOL", |
124 "VCS", "VCSOPTIONS", "VCSOTHERDATA", |
124 "VCS", "VCSOPTIONS", "VCSOTHERDATA", |
125 "OTHERS", "INTERFACES", |
125 "OTHERS", "INTERFACES", |
126 "FILETYPES", "LEXERASSOCS", |
126 "FILETYPES", "LEXERASSOCS", |
127 "PROJECTTYPESPECIFICDATA", |
127 "PROJECTTYPESPECIFICDATA", |
128 "DOCUMENTATIONPARMS", |
128 "DOCUMENTATIONPARMS", |
142 |
142 |
143 userKeynames = [ |
143 userKeynames = [ |
144 "VCSOVERRIDE", "VCSSTATUSMONITORINTERVAL", |
144 "VCSOVERRIDE", "VCSSTATUSMONITORINTERVAL", |
145 ] |
145 ] |
146 |
146 |
|
147 eols = [os.linesep, "\n", "\r", "\r\n"] |
|
148 |
147 def __init__(self, parent = None, filename = None): |
149 def __init__(self, parent = None, filename = None): |
148 """ |
150 """ |
149 Constructor |
151 Constructor |
150 |
152 |
151 @param parent parent widget (usually the ui object) (QWidget) |
153 @param parent parent widget (usually the ui object) (QWidget) |
316 self.pdata["PROJECTTYPESPECIFICDATA"] = {} |
318 self.pdata["PROJECTTYPESPECIFICDATA"] = {} |
317 self.pdata["CHECKERSPARMS"] = {} |
319 self.pdata["CHECKERSPARMS"] = {} |
318 self.pdata["PACKAGERSPARMS"] = {} |
320 self.pdata["PACKAGERSPARMS"] = {} |
319 self.pdata["DOCUMENTATIONPARMS"] = {} |
321 self.pdata["DOCUMENTATIONPARMS"] = {} |
320 self.pdata["OTHERTOOLSPARMS"] = {} |
322 self.pdata["OTHERTOOLSPARMS"] = {} |
|
323 self.pdata["EOL"] = [0] |
321 |
324 |
322 self.__initDebugProperties() |
325 self.__initDebugProperties() |
323 |
326 |
324 self.pudata = {} |
327 self.pudata = {} |
325 for key in self.__class__.userKeynames: |
328 for key in self.__class__.userKeynames: |
750 |
753 |
751 @param fn the filename of the project file (string) |
754 @param fn the filename of the project file (string) |
752 @return flag indicating success (boolean) |
755 @return flag indicating success (boolean) |
753 """ |
756 """ |
754 try: |
757 try: |
|
758 if self.pdata["EOL"][0] == 0: |
|
759 newline = None |
|
760 else: |
|
761 newline = self.getEolString() |
755 if fn.lower().endswith("e4pz"): |
762 if fn.lower().endswith("e4pz"): |
756 try: |
763 try: |
757 import gzip |
764 import gzip |
758 except ImportError: |
765 except ImportError: |
759 QMessageBox.critical(None, |
766 QMessageBox.critical(None, |
760 self.trUtf8("Save project file"), |
767 self.trUtf8("Save project file"), |
761 self.trUtf8("""Compressed project files not supported.""" |
768 self.trUtf8("""Compressed project files not supported.""" |
762 """ The compression library is missing.""")) |
769 """ The compression library is missing.""")) |
763 return False |
770 return False |
764 f = io.StringIO() |
771 f = io.StringIO(newline = newline) |
765 else: |
772 else: |
766 f = open(fn, "w", encoding = "utf-8") |
773 f = open(fn, "w", encoding = "utf-8", newline = newline) |
767 |
774 |
768 ProjectWriter(f, os.path.splitext(os.path.basename(fn))[0]).writeXML() |
775 ProjectWriter(f, os.path.splitext(os.path.basename(fn))[0]).writeXML() |
769 |
776 |
770 if fn.lower().endswith("e4pz"): |
777 if fn.lower().endswith("e4pz"): |
771 g = gzip.open(fn, "wb") |
778 g = gzip.open(fn, "wb") |
3222 """ |
3229 """ |
3223 if not os.path.isabs(fn): |
3230 if not os.path.isabs(fn): |
3224 fn = os.path.join(self.ppath, Utilities.toNativeSeparators(fn)) |
3231 fn = os.path.join(self.ppath, Utilities.toNativeSeparators(fn)) |
3225 return fn |
3232 return fn |
3226 |
3233 |
|
3234 def getEolString(self): |
|
3235 """ |
|
3236 Public method to get the EOL-string to be used by the project. |
|
3237 |
|
3238 @return eol string (string) |
|
3239 """ |
|
3240 return self.eols[self.pdata["EOL"][0]] |
|
3241 |
|
3242 def useSystemEol(self): |
|
3243 """ |
|
3244 Public method to check, if the project uses the system eol setting. |
|
3245 |
|
3246 @return flag indicating the usage of system eol (boolean) |
|
3247 """ |
|
3248 return self.pdata["EOL"][0] == 0 |
|
3249 |
3227 def isProjectFile(self, fn): |
3250 def isProjectFile(self, fn): |
3228 """ |
3251 """ |
3229 Public method used to check, if the passed in filename belongs to the project. |
3252 Public method used to check, if the passed in filename belongs to the project. |
3230 |
3253 |
3231 @param fn filename to be checked (string) |
3254 @param fn filename to be checked (string) |
4463 if "PKGLIST" in lst: |
4486 if "PKGLIST" in lst: |
4464 lst.remove("PKGLIST") |
4487 lst.remove("PKGLIST") |
4465 |
4488 |
4466 # write the file |
4489 # write the file |
4467 try: |
4490 try: |
4468 pkglistFile = open(pkglist, "w", encoding = "utf-8") |
4491 if self.pdata["EOL"][0] == 0: |
|
4492 newline = None |
|
4493 else: |
|
4494 newline = self.getEolString() |
|
4495 pkglistFile = open(pkglist, "w", encoding = "utf-8", newline = newline) |
4469 pkglistFile.write("\n".join(lst)) |
4496 pkglistFile.write("\n".join(lst)) |
4470 pkglistFile.close() |
4497 pkglistFile.close() |
4471 except IOError as why: |
4498 except IOError as why: |
4472 QMessageBox.critical(None, |
4499 QMessageBox.critical(None, |
4473 self.trUtf8("Create Package List"), |
4500 self.trUtf8("Create Package List"), |