mirror of https://gitlab.com/pamhyr/pamhyr2
Solver: Fix for windows version.
parent
8e76778ce3
commit
4715b7e470
|
|
@ -2,7 +2,12 @@
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
from signal import SIGTERM, SIGSTOP, SIGCONT
|
try:
|
||||||
|
from signal import SIGTERM, SIGSTOP, SIGCONT
|
||||||
|
_signal = True
|
||||||
|
except:
|
||||||
|
_signal = False
|
||||||
|
|
||||||
from enum import Enum
|
from enum import Enum
|
||||||
|
|
||||||
from Model.Except import NotImplementedMethodeError
|
from Model.Except import NotImplementedMethodeError
|
||||||
|
|
@ -206,21 +211,26 @@ class AbstractSolver(object):
|
||||||
if process is not None:
|
if process is not None:
|
||||||
self._process = process
|
self._process = process
|
||||||
|
|
||||||
|
if _signal:
|
||||||
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
|
||||||
else:
|
else:
|
||||||
self.run_solver()
|
self.run_solver()
|
||||||
|
else:
|
||||||
|
self.run_solver()
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def pause(self):
|
def pause(self):
|
||||||
|
if _signal:
|
||||||
if self._process is None:
|
if self._process is None:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
os.kill(self._process.pid(), SIGSTOP)
|
os.kill(self._process.pid(), SIGSTOP)
|
||||||
self._status = STATUS.PAUSED
|
self._status = STATUS.PAUSED
|
||||||
return True
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
def stop(self):
|
def stop(self):
|
||||||
if self._process is None:
|
if self._process is None:
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,12 @@ from PyQt5.QtWidgets import (
|
||||||
|
|
||||||
from View.RunSolver.Log.Window import SolverLogFileWindow
|
from View.RunSolver.Log.Window import SolverLogFileWindow
|
||||||
|
|
||||||
|
try:
|
||||||
|
from signal import SIGTERM, SIGSTOP, SIGCONT
|
||||||
|
_signal = True
|
||||||
|
except:
|
||||||
|
_signal = False
|
||||||
|
|
||||||
_translate = QCoreApplication.translate
|
_translate = QCoreApplication.translate
|
||||||
|
|
||||||
class SelectSolverWindow(ASubWindow, ListedSubWindow):
|
class SelectSolverWindow(ASubWindow, ListedSubWindow):
|
||||||
|
|
@ -126,7 +132,11 @@ class SolverLogWindow(ASubMainWindow, ListedSubWindow):
|
||||||
|
|
||||||
def setup_action(self):
|
def setup_action(self):
|
||||||
self.find(QAction, "action_start").setEnabled(False)
|
self.find(QAction, "action_start").setEnabled(False)
|
||||||
|
if _signal:
|
||||||
self.find(QAction, "action_pause").setEnabled(True)
|
self.find(QAction, "action_pause").setEnabled(True)
|
||||||
|
else:
|
||||||
|
self.find(QAction, "action_pause").setEnabled(False)
|
||||||
|
|
||||||
self.find(QAction, "action_stop").setEnabled(True)
|
self.find(QAction, "action_stop").setEnabled(True)
|
||||||
self.find(QAction, "action_log_file").setEnabled(False)
|
self.find(QAction, "action_log_file").setEnabled(False)
|
||||||
|
|
||||||
|
|
@ -176,7 +186,10 @@ class SolverLogWindow(ASubMainWindow, ListedSubWindow):
|
||||||
self._solver.start(self._process)
|
self._solver.start(self._process)
|
||||||
|
|
||||||
self.find(QAction, "action_start").setEnabled(False)
|
self.find(QAction, "action_start").setEnabled(False)
|
||||||
|
if _signal:
|
||||||
self.find(QAction, "action_pause").setEnabled(True)
|
self.find(QAction, "action_pause").setEnabled(True)
|
||||||
|
else:
|
||||||
|
self.find(QAction, "action_pause").setEnabled(False)
|
||||||
self.find(QAction, "action_stop").setEnabled(True)
|
self.find(QAction, "action_stop").setEnabled(True)
|
||||||
self.find(QAction, "action_log_file").setEnabled(False)
|
self.find(QAction, "action_log_file").setEnabled(False)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue