diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 61a4ab6f..31672cf2 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -33,7 +33,7 @@ dl-mage-linux: rules: - if: $CI_COMMIT_BRANCH == 'ci-test' || $CI_COMMIT_BRANCH == 'master' || $CI_COMMIT_TAG script: - - curl -L -o mage.tgz https://gitlab.irstea.fr/jean-baptiste.faure/mage/-/releases/Test6/downloads/packages/mage_linux.tgz + - curl -L -o mage.tgz https://gitlab.irstea.fr/jean-baptiste.faure/mage/-/releases/v8.3.0/downloads/packages/mage_linux.tgz - mkdir -p mage-linux - cd mage-linux - tar xvf ../mage.tgz @@ -50,7 +50,7 @@ dl-mage-windows: rules: - if: $CI_COMMIT_BRANCH == 'ci-test' || $CI_COMMIT_BRANCH == 'master' || $CI_COMMIT_TAG script: - - curl -L -o mage.tgz https://gitlab.irstea.fr/jean-baptiste.faure/mage/-/releases/Test6/downloads/packages/mage_windows.tgz + - curl -L -o mage.tgz https://gitlab.irstea.fr/jean-baptiste.faure/mage/-/releases/v8.3.0/downloads/packages/mage_windows.tgz - mkdir -p mage-windows - cd mage-windows - tar xvf ../mage.tgz diff --git a/src/Solver/CommandLine.py b/src/Solver/CommandLine.py index b3614ca3..2a6d9ec8 100644 --- a/src/Solver/CommandLine.py +++ b/src/Solver/CommandLine.py @@ -132,7 +132,7 @@ class CommandLineSolver(AbstractSolver): return os.path.abspath( os.path.join( os.path.dirname(__file__), - "..", ".." + "..", "..", ".." ) ) diff --git a/src/View/MainWindow.py b/src/View/MainWindow.py index 4ce865db..ac1bef12 100644 --- a/src/View/MainWindow.py +++ b/src/View/MainWindow.py @@ -435,7 +435,7 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit): "", "Pamhyr(*.pamhyr)" ) - if file_name[-4:] == ".pamhyr": + if file_name.rsplit(".", 1)[-1] == ".pamhyr": self._study.filename = file_name else: self._study.filename = file_name + ".pamhyr" diff --git a/src/View/Results/Window.py b/src/View/Results/Window.py index 75e95f21..bbb62e85 100644 --- a/src/View/Results/Window.py +++ b/src/View/Results/Window.py @@ -16,9 +16,10 @@ # -*- coding: utf-8 -*- +import os import logging -from datetime import datetime +from datetime import datetime from tools import trace, timer from View.Tools.PamhyrWindow import PamhyrWindow @@ -69,6 +70,14 @@ class ResultsWindow(PamhyrWindow): _pamhyr_ui = "Results" _pamhyr_name = "Results" + def _path_file(self, filename): + return os.path.abspath( + os.path.join( + os.path.dirname(__file__), + "..", "..", filename + ) + ) + def __init__(self, study=None, config=None, solver=None, results=None, parent=None): @@ -124,13 +133,15 @@ class ResultsWindow(PamhyrWindow): self._slider_time.setMaximum(len(self._timestamps) - 1) self._slider_time.setValue(len(self._timestamps) - 1) + file_path = os.path.abspath(os.path.dirname(__file__)) + self._icon_start = QIcon() self._icon_start.addPixmap( - QPixmap('./src/View/ui/ressources/media-playback-start.png') + QPixmap(f'{file_path}/../ui/ressources/media-playback-start.png') ) self._icon_pause = QIcon() self._icon_pause.addPixmap( - QPixmap('./src/View/ui/ressources/media-playback-pause.png') + QPixmap(f'{file_path}/../ui/ressources/media-playback-pause.png') ) self._button_play = self.find(QPushButton, f"playButton") self._button_play.setIcon(self._icon_start) @@ -254,6 +265,10 @@ class ResultsWindow(PamhyrWindow): ) self.plot_sed_profile.draw() + def closeEvent(self, event): + self._timer.stop() + super(ResultsWindow, self).closeEvent(event) + def _compute_status_label(self): # Timestamp ts = self._timestamps[self._slider_time.value()] diff --git a/src/View/RunSolver/Window.py b/src/View/RunSolver/Window.py index 6067f5e1..b950b929 100644 --- a/src/View/RunSolver/Window.py +++ b/src/View/RunSolver/Window.py @@ -21,7 +21,7 @@ import logging import tempfile from queue import Queue -from tools import trace, timer +from tools import trace, timer, logger_exception from View.Tools.PamhyrWindow import PamhyrDialog, PamhyrWindow @@ -195,7 +195,7 @@ class SolverLogWindow(PamhyrWindow): os.makedirs(self._workdir, exist_ok=True) def setup_process(self): - self._alarm.start(500) + self._alarm.start(100) self._output = Queue() self._process = self.new_process(self._parent) @@ -210,6 +210,10 @@ class SolverLogWindow(PamhyrWindow): self._solver.export(self._study, self._workdir, qlog=self._output) self.update() + def closeEvent(self, event): + self._alarm.stop() + super(SolverLogWindow, self).closeEvent(event) + ####### # LOG # ####### @@ -259,16 +263,21 @@ class SolverLogWindow(PamhyrWindow): if self._solver.log_file() != "": self.find(QAction, "action_log_file").setEnabled(True) + self._update_logs_all() self._update_get_results() self._update_logs_all() def _update_get_results(self): if self._results is None: - self._results = self._solver.results( - self._study, self._workdir, qlog=self._output - ) - self._parent.set_results(self._solver, self._results) + try: + self._results = self._solver.results( + self._study, self._workdir, qlog=self._output + ) + self._parent.set_results(self._solver, self._results) + except Exception as e: + logger.error(f"Failed to open results") + logger_exception(e) def _update_logs_all(self): while self._output.qsize() != 0: diff --git a/src/View/Tools/Plot/PamhyrToolbar.py b/src/View/Tools/Plot/PamhyrToolbar.py index 977087d0..489d47b1 100644 --- a/src/View/Tools/Plot/PamhyrToolbar.py +++ b/src/View/Tools/Plot/PamhyrToolbar.py @@ -98,7 +98,7 @@ class PamhyrPlotToolbar(NavigationToolbar2QT): icon_zoom = QtGui.QIcon() icon_zoom.addPixmap(QtGui.QPixmap( - os.path.abspath(f"{file_path}/../ui/ressources/zoom.png") + os.path.abspath(f"{file_path}/../../ui/ressources/zoom.png") )) icons.append(("zoom", icon_zoom)) @@ -122,7 +122,7 @@ class PamhyrPlotToolbar(NavigationToolbar2QT): icon_btn_isometric_view.addPixmap( QtGui.QPixmap( os.path.abspath( - f"{file_path}/../ui/ressources/zoom_fit_11.png" + f"{file_path}/../../ui/ressources/zoom_fit_11.png" ) ) ) @@ -131,7 +131,7 @@ class PamhyrPlotToolbar(NavigationToolbar2QT): icon_btn_global_view.addPixmap( QtGui.QPixmap( os.path.abspath( - f"{file_path}/../ui/ressources/zoom_fit.png" + f"{file_path}/../../ui/ressources/zoom_fit.png" ) ) ) diff --git a/src/View/ui/Results.ui b/src/View/ui/Results.ui index 9d879e2d..7ff3f594 100644 --- a/src/View/ui/Results.ui +++ b/src/View/ui/Results.ui @@ -6,8 +6,8 @@ 0 0 - 874 - 745 + 1280 + 720 @@ -34,7 +34,7 @@ Qt::Vertical - + @@ -55,7 +55,7 @@ - + @@ -228,7 +228,7 @@ 0 0 - 874 + 1280 22 diff --git a/src/pamhyr.py b/src/pamhyr.py index 5d274166..8a125fc3 100755 --- a/src/pamhyr.py +++ b/src/pamhyr.py @@ -39,6 +39,7 @@ from Scripts.P3DST import Script3DST from Scripts.Hello import ScriptHello from Scripts.ListSolver import ScriptListSolver from Scripts.Run import ScriptExport, ScriptRun +from Scripts.MageMesh import MageMesh from init import legal_info, debug_info, setup_lang @@ -50,6 +51,7 @@ scripts = { "export": ScriptExport, "run": ScriptRun, "3DST": Script3DST, + "mesh": MageMesh, }