def on_actionRun_triggered(self): self.tabWidgetLogs.setCurrentIndex(1) self.dockWidgetLogs.show() self.consoleOutput.setFocus(True) source_fn = self.tabWidgetEditors.currentWidget().filePath source_fn = os.path.join(os.path.dirname(source_fn), "bin", os.path.basename(source_fn)) target = compiler.makeOutputFilePath( source_fn, self.tabWidgetEditors.currentWidget().programType) cwd = os.path.join(os.path.dirname(target)) self.actionRun.setEnabled(False) self.consoleOutput.processFinished.connect(self.onProgramFinished) self.consoleOutput.runProcess(target, cwd=cwd)
def on_actionRun_triggered(self): source_fn = self.tabWidgetEditors.currentWidget().filePath source_fn = os.path.join(os.path.dirname(source_fn), "bin", os.path.basename(source_fn)) target = compiler.makeOutputFilePath( source_fn, self.tabWidgetEditors.currentWidget().programType) wd = os.path.join(os.path.dirname(target)) if not Settings().runInExternalTerminal: self.tabWidgetLogs.setCurrentIndex(1) self.dockWidgetLogs.show() self.consoleOutput.setFocus(True) self.actionRun.setEnabled(False) self.consoleOutput.processFinished.connect(self.onProgramFinished) self.consoleOutput.runProcess(target, cwd=wd) else: if sys.platform == "win32": subprocess.Popen( target, cwd=wd, creationflags=subprocess.CREATE_NEW_CONSOLE) else: subprocess.Popen(Settings().shellCommand.split(' ') + [target], cwd=wd)