From 8004fbcdcc08f7415f6563a263eca43d40ee7a91 Mon Sep 17 00:00:00 2001 From: Pierre-Antoine Rouby <pierre-antoine.rouby@inrae.fr> Date: Tue, 12 Sep 2023 10:42:51 +0200 Subject: [PATCH] Solver, View: Add some comment. --- src/Solver/ASolver.py | 3 +++ src/View/CheckList/Worker.py | 3 ++- src/View/Debug/Window.py | 4 ++++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/Solver/ASolver.py b/src/Solver/ASolver.py index a87dad97..568890f5 100644 --- a/src/Solver/ASolver.py +++ b/src/Solver/ASolver.py @@ -22,6 +22,7 @@ import logging from tools import timer try: + # Installation allow Unix-like signal from signal import SIGTERM, SIGSTOP, SIGCONT _signal = True except: @@ -358,6 +359,7 @@ class AbstractSolver(object): def start(self, study, process = None): if _signal: + # Solver is PAUSED, so continue execution if self._status == STATUS.PAUSED: os.kill(self._process.pid(), SIGCONT) self._status = STATUS.RUNNING @@ -371,6 +373,7 @@ class AbstractSolver(object): if self._process is None: return False + # Send SIGSTOP to PAUSED solver os.kill(self._process.pid(), SIGSTOP) self._status = STATUS.PAUSED return True diff --git a/src/View/CheckList/Worker.py b/src/View/CheckList/Worker.py index efd95ded..66e34d2c 100644 --- a/src/View/CheckList/Worker.py +++ b/src/View/CheckList/Worker.py @@ -37,10 +37,11 @@ class Worker(QObject): self.signalStatus.emit('end') def _compute(self): + # The computation loop for checker in self._checker_list: self.signalStatus.emit(checker.name) - # time.sleep(1) + # Run checker checker.run(self._study) self.signalStatus.emit("progress") diff --git a/src/View/Debug/Window.py b/src/View/Debug/Window.py index 346c2ce0..9b14aa20 100644 --- a/src/View/Debug/Window.py +++ b/src/View/Debug/Window.py @@ -92,7 +92,9 @@ class ReplWindow(ASubMainWindow, ListedSubWindow): self.set_plaintext_edit_text("plainTextEdit", "") self._history_ind = 0 + # Code to rich_code 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 = "\n".join(rich_code) logger.debug(f"User debug command : {rich_code}") @@ -102,6 +104,8 @@ class ReplWindow(ASubMainWindow, ListedSubWindow): except Exception as e: value = f"<font color=\"red\">" + str(e) + "</font>" + # Display code msg = f"<font color=\"grey\"> # " + code + " #</font>" self.find(QTextEdit, "textEdit").append(msg) + # Display results self.find(QTextEdit, "textEdit").append(str(value)) -- GitLab