Commit faffebe3 authored by Pierre-Antoine Rouby's avatar Pierre-Antoine Rouby
Browse files

SolverLog: Add code base.

Showing with 91 additions and 9 deletions
+91 -9
......@@ -37,9 +37,9 @@ class Study(Serializable):
lst = [
StudyNetworkReachChecker(),
StudyGeometryChecker(),
DummyOK(),
DummyWARNING(),
DummyERROR(),
# DummyOK(),
# DummyWARNING(),
# DummyERROR(),
]
return lst
......
......@@ -40,6 +40,7 @@ class CheckListWindow(ASubMainWindow, ListedSubWindow):
self._study = study
self._config = config
self._solver = solver
self._parent = parent
super(CheckListWindow, self).__init__(
name=self._title, ui="CheckList", parent=parent
......@@ -139,7 +140,7 @@ class CheckListWindow(ASubMainWindow, ListedSubWindow):
self.find(QPushButton, "pushButton_retry").setEnabled(True)
errors = any(filter(lambda c: c.is_error(), self._checker_list))
if errors:
if not errors:
self.find(QPushButton, "pushButton_ok").setEnabled(True)
self.update_statusbar()
......@@ -167,5 +168,5 @@ class CheckListWindow(ASubMainWindow, ListedSubWindow):
self.end()
def accept(self):
print("ok")
self._parent.solver_log(self._solver)
self.end()
......@@ -28,7 +28,7 @@ from View.InitialConditions.Window import InitialConditionsWindow
from View.Stricklers.Window import StricklersWindow
from View.Sections.Window import SectionsWindow
from View.SolverParameters.Window import SolverParametersWindow
from View.RunSolver.Window import SelectSolverWindow
from View.RunSolver.Window import SelectSolverWindow, SolverLogWindow
from View.CheckList.Window import CheckListWindow
from Model.Study import Study
......@@ -391,6 +391,15 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
)
check.show()
def solver_log(self, solver):
sol = SolverLogWindow(
study = self.model,
config = self.conf,
solver = solver,
parent = self
)
sol.show()
# TODO: Delete me !
###############
# DUMMY STUFF #
......
......@@ -2,7 +2,7 @@
from tools import trace, timer
from View.ASubWindow import ASubWindow
from View.ASubWindow import ASubWindow, ASubMainWindow
from View.ListedSubWindow import ListedSubWindow
from PyQt5.QtGui import (
......@@ -12,7 +12,7 @@ from PyQt5.QtGui import (
from PyQt5.QtCore import (
Qt, QVariant, QAbstractTableModel,
QCoreApplication, QModelIndex, pyqtSlot,
QRect,
QRect, QTimer,
)
from PyQt5.QtWidgets import (
......@@ -66,3 +66,65 @@ class SelectSolverWindow(ASubWindow, ListedSubWindow):
)
super(SelectSolverWindow, self).accept()
class SolverLogWindow(ASubMainWindow, ListedSubWindow):
def __init__(self, title="Solver logs",
study=None, config=None,
solver=None, parent=None):
self._title = title
self._study = study
self._config = config
self._solver = solver
super(SolverLogWindow, self).__init__(
name=self._title, ui="SolverLog", parent=parent
)
self.ui.setWindowTitle(self._title)
self.setup_action()
self.setup_alarm()
self.setup_connections()
self._alarm.start(500)
def setup_action(self):
self.find(QAction, "action_start").setEnabled(False)
self.find(QAction, "action_pause").setEnabled(True)
self.find(QAction, "action_stop").setEnabled(True)
def setup_alarm(self):
self._alarm = QTimer()
def setup_connections(self):
self.find(QAction, "action_start").triggered.connect(self.start)
self.find(QAction, "action_pause").triggered.connect(self.pause)
self.find(QAction, "action_stop").triggered.connect(self.stop)
self._alarm.timeout.connect(self.update)
def update(self):
print("update")
def start(self):
print("start")
self.find(QAction, "action_start").setEnabled(False)
self.find(QAction, "action_pause").setEnabled(True)
self.find(QAction, "action_stop").setEnabled(True)
def pause(self):
print("pause")
self.find(QAction, "action_start").setEnabled(True)
self.find(QAction, "action_pause").setEnabled(False)
self.find(QAction, "action_stop").setEnabled(True)
def stop(self):
print("stop")
self.find(QAction, "action_start").setEnabled(True)
self.find(QAction, "action_pause").setEnabled(False)
self.find(QAction, "action_stop").setEnabled(False)
......@@ -16,7 +16,17 @@
<widget class="QWidget" name="centralwidget">
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QTextEdit" name="textEdit"/>
<widget class="QTextEdit" name="textEdit">
<property name="documentTitle">
<string notr="true"/>
</property>
<property name="undoRedoEnabled">
<bool>false</bool>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment