639 if self.compileProc is None: |
639 if self.compileProc is None: |
640 return |
640 return |
641 self.compileProc.setReadChannel(QProcess.ProcessChannel.StandardOutput) |
641 self.compileProc.setReadChannel(QProcess.ProcessChannel.StandardOutput) |
642 |
642 |
643 while self.compileProc and self.compileProc.canReadLine(): |
643 while self.compileProc and self.compileProc.canReadLine(): |
644 self.buf += str( |
644 self.__buf.append( |
645 self.compileProc.readLine(), |
645 str( |
646 Preferences.getSystem("IOEncoding"), |
646 self.compileProc.readLine(), |
647 "replace", |
647 Preferences.getSystem("IOEncoding"), |
|
648 "replace", |
|
649 ).rstrip() |
648 ) |
650 ) |
649 |
651 |
650 def __readStderr(self): |
652 def __readStderr(self): |
651 """ |
653 """ |
652 Private slot to handle the readyReadStandardError signal of the |
654 Private slot to handle the readyReadStandardError signal of the |
672 @param exitStatus exit status of the process (QProcess.ExitStatus) |
674 @param exitStatus exit status of the process (QProcess.ExitStatus) |
673 """ |
675 """ |
674 self.compileRunning = False |
676 self.compileRunning = False |
675 ericApp().getObject("ViewManager").enableEditorsCheckFocusIn(True) |
677 ericApp().getObject("ViewManager").enableEditorsCheckFocusIn(True) |
676 ui = ericApp().getObject("UserInterface") |
678 ui = ericApp().getObject("UserInterface") |
677 if exitStatus == QProcess.ExitStatus.NormalExit and exitCode == 0 and self.buf: |
679 if ( |
|
680 exitStatus == QProcess.ExitStatus.NormalExit |
|
681 and exitCode == 0 |
|
682 and self.__buf |
|
683 ): |
678 ofn = os.path.join(self.project.ppath, self.compiledFile) |
684 ofn = os.path.join(self.project.ppath, self.compiledFile) |
679 try: |
685 try: |
680 newline = ( |
686 newline = ( |
681 None if self.project.useSystemEol() else self.project.getEolString() |
687 None if self.project.useSystemEol() else self.project.getEolString() |
682 ) |
688 ) |
683 with open(ofn, "w", encoding="utf-8", newline=newline) as f: |
689 with open(ofn, "w", encoding="utf-8", newline=newline) as f: |
684 for line in self.buf.splitlines(): |
690 f.write("\n".join(self.__buf) + "\n") |
685 f.write(line + "\n") |
|
686 if self.compiledFile not in self.project.getProjectData( |
691 if self.compiledFile not in self.project.getProjectData( |
687 dataKey="SOURCES" |
692 dataKey="SOURCES" |
688 ): |
693 ): |
689 self.project.appendFile(ofn) |
694 self.project.appendFile(ofn) |
690 ui.showNotification( |
695 ui.showNotification( |
721 @param progress reference to the progress dialog |
726 @param progress reference to the progress dialog |
722 @return reference to the compile process (QProcess) |
727 @return reference to the compile process (QProcess) |
723 """ |
728 """ |
724 self.compileProc = QProcess() |
729 self.compileProc = QProcess() |
725 args = [] |
730 args = [] |
726 self.buf = "" |
731 self.__buf = [] |
727 |
732 |
728 if self.project.getProjectLanguage() == "Python3": |
733 if self.project.getProjectLanguage() == "Python3": |
729 if self.project.getProjectType() in ["PyQt5", "PyQt5C"]: |
734 if self.project.getProjectType() in ["PyQt5", "PyQt5C"]: |
730 self.rccCompiler = QtUtilities.generatePyQtToolPath("pyrcc5") |
735 self.rccCompiler = QtUtilities.generatePyQtToolPath("pyrcc5") |
731 elif self.project.getProjectType() in ["PySide2", "PySide2C"]: |
736 elif self.project.getProjectType() in ["PySide2", "PySide2C"]: |