mirror of https://gitlab.com/pamhyr/pamhyr2
Solver: Get process finished event.
parent
dd66faff45
commit
527a16f818
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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):
|
||||
|
|
|
|||
Loading…
Reference in New Issue