Skip to content

Commit fe8e2bb

Browse files
author
Shengjie Xu
committed
[GUI/PySide6] hide console when launching; improve output readability
1 parent d661a10 commit fe8e2bb

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/preppipe_gui_pyside6/execution.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -203,13 +203,17 @@ def launch(self, wait : bool = False):
203203
self.outputs = []
204204
commands = self.get_final_commands()
205205
self.state = ExecutionState.RUNNING
206+
creationflags = 0
207+
if platform.system() == 'Windows':
208+
creationflags = subprocess.CREATE_NO_WINDOW
206209
try:
207210
self.proc = subprocess.Popen(
208211
commands,
209212
stdout=subprocess.PIPE,
210213
stderr=subprocess.STDOUT,
211214
env=self.composed_envs,
212-
universal_newlines=False
215+
universal_newlines=False,
216+
creationflags=creationflags
213217
)
214218
except Exception as e:
215219
self.state = ExecutionState.FAILED_LAUNCH

src/preppipe_gui_pyside6/toolwidgets/execute.py

+4
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ def setData(self, execinfo : ExecutionInfo):
9898
for key, value in execinfo.envs.items():
9999
self.appendPlainText(f"{key}={value}\n")
100100
self.appendPlainText(' '.join(self.exec.get_final_commands()) + '\n')
101+
self.appendPlainText('='*20 + '\n')
101102
self.exec.outputAvailable.connect(self.handleOutput)
102103

103104
for out in execinfo.specified_outputs:
@@ -135,6 +136,9 @@ def appendPlainText(self, text : str):
135136

136137
@Slot()
137138
def handle_process_finished(self):
139+
if self.exec is None:
140+
raise RuntimeError("ExecuteWidget handle_process_finished() called before setData()")
141+
self.appendPlainText('='*20 + '\n')
138142
if result := self.exec.result:
139143
exitcode = result.returncode
140144
if exitcode == 0:

0 commit comments

Comments
 (0)