337 # extend existing file |
337 # extend existing file |
338 try: |
338 try: |
339 srcFile = open(self.srcFile, 'r', encoding = "utf-8") |
339 srcFile = open(self.srcFile, 'r', encoding = "utf-8") |
340 sourceImpl = srcFile.readlines() |
340 sourceImpl = srcFile.readlines() |
341 srcFile.close() |
341 srcFile.close() |
342 if not sourceImpl[-1].endswith(os.linesep): |
342 if not sourceImpl[-1].endswith("\n"): |
343 sourceImpl[-1] = "%s%s" % (sourceImpl[-1], os.linesep) |
343 sourceImpl[-1] = "%s%s" % (sourceImpl[-1], "\n") |
344 except IOError as why: |
344 except IOError as why: |
345 QMessageBox.critical(self, |
345 QMessageBox.critical(self, |
346 self.trUtf8("Code Generation"), |
346 self.trUtf8("Code Generation"), |
347 self.trUtf8("""<p>Could not open the source file "{0}".</p>""" |
347 self.trUtf8("""<p>Could not open the source file "{0}".</p>""" |
348 """<p>Reason: {1}</p>""")\ |
348 """<p>Reason: {1}</p>""")\ |