mirror of https://gitlab.com/pamhyr/pamhyr2
display adists results from main
parent
97c161fc3f
commit
36fd8cdc8a
|
|
@ -23,6 +23,8 @@ import logging
|
|||
import subprocess
|
||||
from queue import Queue
|
||||
from functools import reduce
|
||||
|
||||
from numpy.core.multiarray import where
|
||||
from platformdirs import user_cache_dir
|
||||
|
||||
from Solver.AdisTS import AdisTS
|
||||
|
|
@ -41,6 +43,7 @@ from PyQt5.QtWidgets import (
|
|||
QMainWindow, QApplication, QAction,
|
||||
QFileDialog, QShortcut, QMenu, QToolBar,
|
||||
QMessageBox, QProgressDialog, QTabWidget,
|
||||
QDialog, QVBoxLayout, QLabel,
|
||||
)
|
||||
from PyQt5.uic import loadUi
|
||||
|
||||
|
|
@ -106,6 +109,7 @@ model_action = [
|
|||
"action_menu_close", "action_menu_edit", "action_menu_save",
|
||||
"action_menu_save_as", "action_toolBar_close", "action_toolBar_save",
|
||||
"action_menu_numerical_parameter", "action_open_results_from_file",
|
||||
"action_open_results_adists",
|
||||
]
|
||||
|
||||
other_model_action = [
|
||||
|
|
@ -271,6 +275,7 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
|
|||
"action_menu_close": self.close_model,
|
||||
"action_menu_results_last": self.open_last_results,
|
||||
"action_open_results_from_file": self.open_results_from_file,
|
||||
"action_open_results_adists": self.open_results_adists,
|
||||
# Help
|
||||
"action_menu_pamhyr_users_wiki": self.open_doc_user,
|
||||
"action_menu_pamhyr_developers_pdf":
|
||||
|
|
@ -1532,6 +1537,47 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
|
|||
results=file_name[0]
|
||||
)
|
||||
|
||||
def open_results_adists(self):
|
||||
if self._study is None:
|
||||
return
|
||||
|
||||
if self._study.filename == "":
|
||||
return
|
||||
|
||||
options = QFileDialog.Options()
|
||||
options |= QFileDialog.DontUseNativeDialog
|
||||
|
||||
dialog = QFileDialog(self, options=options)
|
||||
dialog.setFileMode(QFileDialog.DirectoryOnly) ##QFileDialog.FileMode.ExistingFile)
|
||||
|
||||
if self._last_solver is None:
|
||||
dialog.setDirectory(
|
||||
os.path.dirname(self._study.filename)
|
||||
)
|
||||
else:
|
||||
dialog.setDirectory(
|
||||
self._solver_workdir(self._last_solver)
|
||||
)
|
||||
|
||||
if dialog.exec_():
|
||||
dir_path = dialog.selectedFiles()[0]
|
||||
dir_list = os.listdir(dir_path)
|
||||
bin_list = list(filter(lambda s: "bin" in s, dir_list))
|
||||
logger.info(f"Select results: {dir_path}")
|
||||
if len(bin_list) >= 2 and ("total_sediment.bin" in bin_list):
|
||||
self.open_solver_results_adists(
|
||||
self._last_solver,
|
||||
results=None,
|
||||
)
|
||||
else:
|
||||
dlg = QDialog(self)
|
||||
dlg.setWindowTitle("AdisTS Results")
|
||||
layout = QVBoxLayout()
|
||||
message = QLabel("AdisTS Results not found")
|
||||
layout.addWidget(message)
|
||||
dlg.setLayout(layout)
|
||||
dlg.exec()
|
||||
|
||||
#################
|
||||
# DOCUMENTATION #
|
||||
#################
|
||||
|
|
|
|||
|
|
@ -27,7 +27,8 @@ class ResultsTranslate(MainTranslate):
|
|||
def __init__(self, pollutants=None):
|
||||
if pollutants is not None:
|
||||
self.pollutants = pollutants
|
||||
self.pollutants.remove("total_sediment")
|
||||
if "total_sediment" in self.pollutants:
|
||||
self.pollutants.remove("total_sediment")
|
||||
else:
|
||||
self.pollutants = pollutants
|
||||
|
||||
|
|
|
|||
|
|
@ -161,6 +161,7 @@
|
|||
</property>
|
||||
<addaction name="action_menu_results_last"/>
|
||||
<addaction name="action_open_results_from_file"/>
|
||||
<addaction name="action_open_results_adists"/>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menu_help">
|
||||
<property name="title">
|
||||
|
|
@ -773,6 +774,14 @@
|
|||
<string>DIF</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="action_open_results_adists">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Open results AdisTS</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections>
|
||||
|
|
|
|||
Loading…
Reference in New Issue