Solver: Get process finished event.

mesh
Pierre-Antoine Rouby 2023-06-19 17:11:08 +02:00
parent dd66faff45
commit 527a16f818
2 changed files with 11 additions and 3 deletions

View File

@ -135,6 +135,7 @@ class AbstractSolver(object):
exe, args,
)
self._process.readyRead.connect(self._data_ready)
self._process.finished.connect(self._finished)
return True
@ -149,6 +150,10 @@ class AbstractSolver(object):
if self._output is not None:
self._output.put(s)
def _finished(self, exit_code, exit_status):
if self._output is not None:
self._output.put(exit_code)
def run(self, process, output_queue):
self._process = process
self._output = output_queue

View File

@ -111,13 +111,16 @@ class SolverLogWindow(ASubMainWindow, ListedSubWindow):
self._alarm.timeout.connect(self.update)
def _log(self, msg):
msg = msg.rsplit('\n')[0]
self.find(QTextEdit, "textEdit").append(msg)
if type(msg) == str:
msg = msg.rsplit('\n')[0]
self.find(QTextEdit, "textEdit").append(msg)
elif type(msg) == int:
self.find(QTextEdit, "textEdit")\
.append(f" *** Solver finished with code {msg}")
def update(self):
while self._output.qsize() != 0:
s = self._output.get()
print(s)
self._log(s)
def start(self):