mirror of
https://gitlab.com/pamhyr/pamhyr2.git
synced 2026-10-30 03:20:41 +01:00
Solver: Get process finished event.
This commit is contained in:
1 parent
dd66faff45
commit
527a16f818
2 files changed
+9
-1
No files matched your search
@@ -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):
|
||||
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):
|
||||
|
||||
Reference in new issue
Block a user