Solver: RubarBE: Fix results reading.

This commit is contained in:
parouby committed 2025-10-10 16:44:16 +02:00
1 parent df3b3b604d
commit e640fa1bc0
3 files changed
+29 -14

No files matched your search

+16 -3
View File
@@ -31,6 +31,7 @@ from platformdirs import user_cache_dir
from Solver.AdisTS import AdisTS
from Solver.Mage import Mage8
from Solver.RubarBE import Rubar3
from tools import logger_exception, pamhyr_db_need_update
from PyQt5 import QtGui
@@ -1506,6 +1507,8 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
return False
def open_solver_results(self, solver, results=None):
logger.info(f"{solver} {results}")
def reading_fn():
self._tmp_results = results
@@ -1525,7 +1528,10 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
if type(results) is str:
logger.info(f"Open results from {os.path.dirname(results)}")
name = os.path.basename(results).replace(".BIN", "")
if ".BIN" in results:
name = os.path.basename(results).replace(".BIN", "")
elif "profil." in results:
name = os.path.basename(results).replace("profil.", "")
def reading_fn():
self._tmp_results = solver.results(
@@ -1664,7 +1670,7 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
dialog.setFileMode(QFileDialog.FileMode.ExistingFile)
dialog.setDefaultSuffix(".BIN")
# dialog.setFilter(dialog.filter() | QtCore.QDir.Hidden)
dialog.setNameFilters(['Mage (*.BIN)'])
dialog.setNameFilters(['Mage (*.BIN)', 'Rubar3 (profil.*)'])
if self._study.filename is not None:
if self._last_solver is None:
@@ -1679,8 +1685,15 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
if dialog.exec_():
file_name = dialog.selectedFiles()
logger.info(f"Select results: {file_name}")
solver = None
if ".BIN" in file_name:
solver = Mage8("Mage8")
else:
solver = Rubar3("Rubar3")
self.open_solver_results(
Mage8("Mage"),
solver,
results=file_name[0]
)
+2 -1
View File
@@ -63,7 +63,8 @@ class TableModel(PamhyrTableModel):
self._lst = self._parent._solvers
def __init__(self, **kwargs):
self._timestamp = 0.0
self._timestamp = max(kwargs["parent"]._timestamps)
super(TableModel, self).__init__(**kwargs)
def data(self, index, role=Qt.DisplayRole):