mirror of https://gitlab.com/pamhyr/pamhyr2
Solver, View: Add some comment.
parent
bb6292ce90
commit
8004fbcdcc
|
|
@ -22,6 +22,7 @@ import logging
|
||||||
from tools import timer
|
from tools import timer
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
# Installation allow Unix-like signal
|
||||||
from signal import SIGTERM, SIGSTOP, SIGCONT
|
from signal import SIGTERM, SIGSTOP, SIGCONT
|
||||||
_signal = True
|
_signal = True
|
||||||
except:
|
except:
|
||||||
|
|
@ -358,6 +359,7 @@ class AbstractSolver(object):
|
||||||
|
|
||||||
def start(self, study, process = None):
|
def start(self, study, process = None):
|
||||||
if _signal:
|
if _signal:
|
||||||
|
# Solver is PAUSED, so continue execution
|
||||||
if self._status == STATUS.PAUSED:
|
if self._status == STATUS.PAUSED:
|
||||||
os.kill(self._process.pid(), SIGCONT)
|
os.kill(self._process.pid(), SIGCONT)
|
||||||
self._status = STATUS.RUNNING
|
self._status = STATUS.RUNNING
|
||||||
|
|
@ -371,6 +373,7 @@ class AbstractSolver(object):
|
||||||
if self._process is None:
|
if self._process is None:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
# Send SIGSTOP to PAUSED solver
|
||||||
os.kill(self._process.pid(), SIGSTOP)
|
os.kill(self._process.pid(), SIGSTOP)
|
||||||
self._status = STATUS.PAUSED
|
self._status = STATUS.PAUSED
|
||||||
return True
|
return True
|
||||||
|
|
|
||||||
|
|
@ -37,10 +37,11 @@ class Worker(QObject):
|
||||||
self.signalStatus.emit('end')
|
self.signalStatus.emit('end')
|
||||||
|
|
||||||
def _compute(self):
|
def _compute(self):
|
||||||
|
# The computation loop
|
||||||
for checker in self._checker_list:
|
for checker in self._checker_list:
|
||||||
self.signalStatus.emit(checker.name)
|
self.signalStatus.emit(checker.name)
|
||||||
|
|
||||||
# time.sleep(1)
|
# Run checker
|
||||||
checker.run(self._study)
|
checker.run(self._study)
|
||||||
|
|
||||||
self.signalStatus.emit("progress")
|
self.signalStatus.emit("progress")
|
||||||
|
|
|
||||||
|
|
@ -92,7 +92,9 @@ class ReplWindow(ASubMainWindow, ListedSubWindow):
|
||||||
self.set_plaintext_edit_text("plainTextEdit", "")
|
self.set_plaintext_edit_text("plainTextEdit", "")
|
||||||
self._history_ind = 0
|
self._history_ind = 0
|
||||||
|
|
||||||
|
# Code to rich_code
|
||||||
rich_code = code.strip().split("\n")
|
rich_code = code.strip().split("\n")
|
||||||
|
# Add return variable for results display at last row
|
||||||
rich_code[-1] = "self.__debug_exec_result__ = " + rich_code[-1]
|
rich_code[-1] = "self.__debug_exec_result__ = " + rich_code[-1]
|
||||||
rich_code = "\n".join(rich_code)
|
rich_code = "\n".join(rich_code)
|
||||||
logger.debug(f"User debug command : {rich_code}")
|
logger.debug(f"User debug command : {rich_code}")
|
||||||
|
|
@ -102,6 +104,8 @@ class ReplWindow(ASubMainWindow, ListedSubWindow):
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
value = f"<font color=\"red\">" + str(e) + "</font>"
|
value = f"<font color=\"red\">" + str(e) + "</font>"
|
||||||
|
|
||||||
|
# Display code
|
||||||
msg = f"<font color=\"grey\"> # " + code + " #</font>"
|
msg = f"<font color=\"grey\"> # " + code + " #</font>"
|
||||||
self.find(QTextEdit, "textEdit").append(msg)
|
self.find(QTextEdit, "textEdit").append(msg)
|
||||||
|
# Display results
|
||||||
self.find(QTextEdit, "textEdit").append(str(value))
|
self.find(QTextEdit, "textEdit").append(str(value))
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue