src/eric7/Project/ProjectFormsBrowser.py

branch
eric7
changeset 9627
4e926eb7e148
parent 9624
b47dfa7a137d
child 9653
e67609152c5e
diff -r 5bb5c85d71c3 -r 4e926eb7e148 src/eric7/Project/ProjectFormsBrowser.py
--- a/src/eric7/Project/ProjectFormsBrowser.py	Mon Dec 19 17:50:02 2022 +0100
+++ b/src/eric7/Project/ProjectFormsBrowser.py	Mon Dec 19 19:31:43 2022 +0100
@@ -793,7 +793,9 @@
         self.compileProc.setReadChannel(QProcess.ProcessChannel.StandardOutput)
 
         while self.compileProc and self.compileProc.canReadLine():
-            self.buf += str(self.compileProc.readLine(), "utf-8", "replace")
+            self.__buf.append(
+                str(self.compileProc.readLine(), "utf-8", "replace").rstrip()
+            )
 
     def __readStderr(self):
         """
@@ -822,15 +824,18 @@
         self.compileRunning = False
         ericApp().getObject("ViewManager").enableEditorsCheckFocusIn(True)
         ui = ericApp().getObject("UserInterface")
-        if exitStatus == QProcess.ExitStatus.NormalExit and exitCode == 0 and self.buf:
+        if (
+            exitStatus == QProcess.ExitStatus.NormalExit
+            and exitCode == 0
+            and self.__buf
+        ):
             ofn = os.path.join(self.project.ppath, self.compiledFile)
             try:
                 newline = (
                     None if self.project.useSystemEol() else self.project.getEolString()
                 )
                 with open(ofn, "w", encoding="utf-8", newline=newline) as f:
-                    for line in self.buf.splitlines():
-                        f.write(line + "\n")
+                    f.write("\n".join(self.__buf) + "\n")
                 if self.compiledFile not in self.project.getProjectData(
                     dataKey="SOURCES"
                 ):
@@ -873,7 +878,7 @@
         """
         self.compileProc = QProcess()
         args = []
-        self.buf = ""
+        self.__buf = []
 
         uicompiler = self.getUiCompiler()
         if not uicompiler:

eric ide

mercurial