diff --git a/src/Solver/ASolver.py b/src/Solver/ASolver.py
index 310e2772..830d296e 100644
--- a/src/Solver/ASolver.py
+++ b/src/Solver/ASolver.py
@@ -4,6 +4,8 @@ import os
import subprocess
from enum import Enum
+from Model.Except import NotImplementedMethodeError
+
class STATUS(Enum):
STOPED = 0
RUNNING = 1
@@ -53,6 +55,13 @@ class AbstractSolver(object):
return lst
+ @classmethod
+ def checker(cls):
+ lst = [
+ ]
+
+ return lst
+
@property
def name(self):
return self._name
diff --git a/src/View/ASubWindow.py b/src/View/ASubWindow.py
index 6091c6de..5bf0940c 100644
--- a/src/View/ASubWindow.py
+++ b/src/View/ASubWindow.py
@@ -329,6 +329,19 @@ class ASubWindowFeatures(object):
"""
self.find(QComboBox, name).addItem(item)
+ def combobox_add_items(self, name:str, items:str):
+ """Add item in combo box
+
+ Args:
+ name: The combo box component name
+ item: The item to add
+
+ Returns:
+ Nothing
+ """
+ for item in items:
+ self.find(QComboBox, name).addItem(item)
+
def set_combobox_text(self, name:str, item:str):
"""Set current text of combo box
diff --git a/src/View/Configure/Window.py b/src/View/Configure/Window.py
index 43ee4528..c0c1b104 100644
--- a/src/View/Configure/Window.py
+++ b/src/View/Configure/Window.py
@@ -92,7 +92,7 @@ class ConfigureWindow(ASubWindow, ListedSubWindow):
table = self.find(QTableView, "tableView_solver")
self.solver_table_model = SolverTableModel(
headers = ["name", "type", "description"],
- rows = conf.solvers.copy()
+ rows = conf.solvers
)
table.setModel(self.solver_table_model)
table.setSelectionBehavior(QAbstractItemView.SelectRows)
diff --git a/src/View/MainWindow.py b/src/View/MainWindow.py
index 3f0b5adc..bc79d2fb 100644
--- a/src/View/MainWindow.py
+++ b/src/View/MainWindow.py
@@ -377,9 +377,11 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
def run_solver(self):
run = SelectSolverWindow(
study = self.model,
+ config = self.conf,
parent = self
)
- run.show()
+ if run.exec():
+ solver = run.solver
# TODO: Delete me !
###############
diff --git a/src/View/RunSolver/Window.py b/src/View/RunSolver/Window.py
new file mode 100644
index 00000000..024e0d96
--- /dev/null
+++ b/src/View/RunSolver/Window.py
@@ -0,0 +1,68 @@
+# -*- coding: utf-8 -*-
+
+from tools import trace, timer
+
+from View.ASubWindow import ASubWindow
+from View.ListedSubWindow import ListedSubWindow
+
+from PyQt5.QtGui import (
+ QKeySequence,
+)
+
+from PyQt5.QtCore import (
+ Qt, QVariant, QAbstractTableModel,
+ QCoreApplication, QModelIndex, pyqtSlot,
+ QRect,
+)
+
+from PyQt5.QtWidgets import (
+ QDialogButtonBox, QPushButton, QLineEdit,
+ QFileDialog, QTableView, QAbstractItemView,
+ QUndoStack, QShortcut, QAction, QItemDelegate,
+ QComboBox, QVBoxLayout, QHeaderView, QTabWidget,
+)
+
+_translate = QCoreApplication.translate
+
+class SelectSolverWindow(ASubWindow, ListedSubWindow):
+ def __init__(self, title="Select solver",
+ study=None, config=None,
+ parent=None):
+ self._title = title
+
+ self._study = study
+ self._config = config
+ self._solver = None
+
+ super(SelectSolverWindow, self).__init__(
+ name=self._title, ui="SelectSolver", parent=parent
+ )
+ self.ui.setWindowTitle(self._title)
+
+ self.setup_combobox()
+ self.setup_connections()
+
+ def setup_combobox(self):
+ solvers = self._config.solvers
+ solvers_name = list(map(lambda s: s.name, solvers))
+
+ self.combobox_add_items("comboBox", solvers_name)
+
+ def setup_connections(self):
+ self.find(QPushButton, "pushButton_run").clicked.connect(self.accept)
+ self.find(QPushButton, "pushButton_cancel").clicked.connect(self.reject)
+
+ @property
+ def solver(self):
+ return self._solver
+
+ def accept(self):
+ solver_name = self.get_combobox_text("comboBox")
+ self._solver = next(
+ filter(
+ lambda s: s.name == solver_name,
+ self._config.solvers
+ )
+ )
+
+ super(SelectSolverWindow, self).accept()
diff --git a/src/View/ui/CheckList.ui b/src/View/ui/CheckList.ui
new file mode 100644
index 00000000..79589e5e
--- /dev/null
+++ b/src/View/ui/CheckList.ui
@@ -0,0 +1,78 @@
+
+
+ MainWindow
+
+
+
+ 0
+ 0
+ 640
+ 480
+
+
+
+ MainWindow
+
+
+
+ -
+
+
+ -
+
+
+ 24
+
+
+
+ -
+
+
+ false
+
+
+ QDialogButtonBox::Cancel|QDialogButtonBox::Ok|QDialogButtonBox::Retry
+
+
+
+
+
+
+
+
+ toolBar
+
+
+ TopToolBarArea
+
+
+ false
+
+
+
+
+
+
+
+ ressources/gtk-ok.pngressources/gtk-ok.png
+
+
+ Retry
+
+
+ Retry check
+
+
+
+
+
+ ressources/gtk-stop.pngressources/gtk-stop.png
+
+
+ Cancel
+
+
+
+
+
+
diff --git a/src/View/ui/SelectSolver.ui b/src/View/ui/SelectSolver.ui
new file mode 100644
index 00000000..c621bdd4
--- /dev/null
+++ b/src/View/ui/SelectSolver.ui
@@ -0,0 +1,62 @@
+
+
+ Dialog
+
+
+
+ 0
+ 0
+ 320
+ 80
+
+
+
+ Dialog
+
+
+
+
+
+ -
+
+
+ -
+
+
-
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+ -
+
+
+ Cancel
+
+
+
+ -
+
+
+ Run
+
+
+
+ ressources/player_play.pngressources/player_play.png
+
+
+
+
+
+
+
+
+
+
diff --git a/src/View/ui/SolverLog.ui b/src/View/ui/SolverLog.ui
new file mode 100644
index 00000000..c236fb51
--- /dev/null
+++ b/src/View/ui/SolverLog.ui
@@ -0,0 +1,78 @@
+
+
+ MainWindow
+
+
+
+ 0
+ 0
+ 640
+ 480
+
+
+
+ MainWindow
+
+
+
+ -
+
+
+
+
+
+
+
+
+ toolBar
+
+
+ TopToolBarArea
+
+
+ false
+
+
+
+
+
+
+
+
+ ressources/gtk-stop.pngressources/gtk-stop.png
+
+
+ Stop
+
+
+
+
+
+ ressources/player_play.pngressources/player_play.png
+
+
+ Start
+
+
+
+
+
+ ressources/player_pause.pngressources/player_pause.png
+
+
+ Pause
+
+
+
+
+
+
diff --git a/src/config.py b/src/config.py
index 028adbda..60550351 100644
--- a/src/config.py
+++ b/src/config.py
@@ -16,8 +16,9 @@ class Config(object):
self.set_default_value()
def set_default_value(self):
+ print('toto')
# Solvers
- self.solvers = []
+ self._solvers = []
# Meshing tool
self.meshing_tool = ""
@@ -40,7 +41,7 @@ class Config(object):
@classmethod
def filename(cls):
- return os.path.expanduser('~user') + config_dir + config_file
+ return os.path.expanduser('~') + config_dir + config_file
@classmethod
def languages(cls):
@@ -50,6 +51,14 @@ class Config(object):
"French": "fr",
}
+ @property
+ def solvers(self):
+ return self._solvers.copy()
+
+ @solvers.setter
+ def solvers(self, solvers):
+ self._solvers = solvers
+
def save(self):
os.makedirs(os.path.dirname(self.filename), exist_ok=True)
with open(self.filename, 'wb') as out_file: