Results: Add InputDialog to select solver.

This commit is contained in:
parouby committed 2025-11-04 16:22:11 +01:00
1 parent 81d58122d6
commit b04e367e72
3 files changed
+49 -17

No files matched your search

+45 -12
View File
@@ -47,7 +47,7 @@ from PyQt5.QtWidgets import (
QMainWindow, QApplication, QAction,
QFileDialog, QShortcut, QMenu, QToolBar,
QMessageBox, QProgressDialog, QTabWidget,
QDialog, QVBoxLayout, QLabel,
QDialog, QVBoxLayout, QLabel, QInputDialog,
)
from PyQt5.uic import loadUi
@@ -606,6 +606,16 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
return None
def get_last_results(self, solver):
if self._study is None:
return None
results = self._study.results
if solver in results:
return self._study.results[solver]
return None
@last_results.setter
def last_results(self, results):
if self._study is None:
@@ -1534,14 +1544,14 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
# If no specific results, get last results
if results is None:
def reading_fn():
self._tmp_results = self.last_results
self._tmp_results = solver.results(
self._study,
self._solver_workdir(solver),
)
if self.last_results is None:
if solver == self._last_solver:
def reading_fn():
self._tmp_results = solver.results(
self._study,
self._solver_workdir(solver),
)
self._tmp_results = self.last_results
# Open from file
if type(results) is str:
@@ -1566,7 +1576,7 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
)
dlg.exec_()
results = self._tmp_results
self.last_results = results
# self.last_results = results
# No results available
if results is None:
@@ -1691,12 +1701,35 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
if self._last_solver is None:
return
solver_type = self._study.results
solver_name, ok = QInputDialog.getItem(
self, self._trad['Solver'],
self._trad['Solver'] + ":",
list(
map(lambda s: s.name,
filter(lambda s: s._type in solver_type,
self.conf.solvers))
)
)
if not ok:
return
solver = next(
filter(
lambda s: s.name == solver_name,
self.conf.solvers
)
)
if self._last_solver._type == "mage8":
self.open_solver_results(self._last_solver,
self.last_results)
self.open_solver_results(
solver, # self.last_results
)
elif self._last_solver._type == "adistswc":
self.open_solver_results_adists(self._last_solver,
self.last_results)
self.open_solver_results_adists(
solver, # self.last_results
)
def open_results_from_file(self):
if self._study is None: