--- a/Project/Project.py Mon Sep 13 16:14:10 2010 +0200 +++ b/Project/Project.py Mon Sep 13 19:52:30 2010 +0200 @@ -756,7 +756,16 @@ if fn is None: fn = self.pfile - res = self.__writeXMLProject(fn) + f = QFile(fn) + if f.open(QIODevice.WriteOnly): + ProjectWriter(f, os.path.splitext(os.path.basename(fn))[0]).writeXML() + res = True + else: + E5MessageBox.critical(self.ui, + self.trUtf8("Save project file"), + self.trUtf8("<p>The project file <b>{0}</b> could not be written.</p>")\ + .format(fn)) + res = False if res: self.pfile = os.path.abspath(fn) @@ -773,48 +782,6 @@ return res - def __writeXMLProject(self, fn = None): - """ - Private method to write the project data to an XML file. - - @param fn the filename of the project file (string) - @return flag indicating success (boolean) - """ - try: - if self.pdata["EOL"][0] == 0: - newline = None - else: - newline = self.getEolString() - if fn.lower().endswith("e4pz"): - try: - import gzip - except ImportError: - E5MessageBox.critical(self.ui, - self.trUtf8("Save project file"), - self.trUtf8("""Compressed project files not supported.""" - """ The compression library is missing.""")) - return False - f = io.StringIO(newline = newline) - else: - f = open(fn, "w", encoding = "utf-8", newline = newline) - - ProjectWriter(f, os.path.splitext(os.path.basename(fn))[0]).writeXML() - - if fn.lower().endswith("e4pz"): - g = gzip.open(fn, "wb") - g.write(f.getvalue().encode("utf-8")) - g.close() - f.close() - - except IOError: - E5MessageBox.critical(self.ui, - self.trUtf8("Save project file"), - self.trUtf8("<p>The project file <b>{0}</b> could not be written.</p>")\ - .format(fn)) - return False - - return True - def __readUserProperties(self): """ Private method to read in the user specific project file (.e4q)