From 71729578dd3b320c5d515bfdb58ccb96782f99d9 Mon Sep 17 00:00:00 2001
From: Youcef AOUAD <youcef.aouad@inrae.fr>
Date: Wed, 11 Sep 2024 10:29:56 +0200
Subject: [PATCH] reload plot H

---
 src/View/Results/PlotHAdisTS.py  | 17 +++++++++++------
 src/View/Results/WindowAdisTS.py | 27 ++++++++-------------------
 2 files changed, 19 insertions(+), 25 deletions(-)

diff --git a/src/View/Results/PlotHAdisTS.py b/src/View/Results/PlotHAdisTS.py
index 299d3bab..e62e2b84 100644
--- a/src/View/Results/PlotHAdisTS.py
+++ b/src/View/Results/PlotHAdisTS.py
@@ -106,6 +106,10 @@ class PlotH(PamhyrPlot):
         #First 0 for pol and second 0 for phys var
         y = list(map(lambda data_el: data_el[0][0], profile.get_key("pols")))
 
+        print("************//////////////////")
+        print("profile: ", self._current_profile_id)
+        print("reach: ", self._current_reach_id)
+
         print("*****************draw data: ", len(x),len(y))
         print("x: ", x)
         print("y: ", y)
@@ -185,12 +189,13 @@ class PlotH(PamhyrPlot):
         profile = reach.profile(self._current_profile_id)
 
         x = self.ts
-        y = profile.get_key("Q")
+        #y = profile.get_key("Q")
+        y = list(map(lambda data_el: data_el[0][0], profile.get_key("pols")))
 
         self._line.set_data(x, y)
 
-        _, min_max = self._current.get_data()
-        self._current.set_data(
-            self._current_timestamp,
-            min_max
-        )
+       ### _, min_max = self._current.get_data()
+        ###self._current.set_data(
+            ###self._current_timestamp,
+            ###min_max
+        ###)
diff --git a/src/View/Results/WindowAdisTS.py b/src/View/Results/WindowAdisTS.py
index 50bef3ef..0c80d1de 100644
--- a/src/View/Results/WindowAdisTS.py
+++ b/src/View/Results/WindowAdisTS.py
@@ -108,8 +108,8 @@ class ResultsWindowAdisTS(PamhyrWindow):
             self.setup_table()
             self.setup_plots()
             self.setup_slider()
-            #self.setup_statusbar()
-            #self.setup_connections()
+            self.setup_statusbar()
+            self.setup_connections()
         except Exception as e:
             logger_exception(e)
             return
@@ -167,16 +167,6 @@ class ResultsWindowAdisTS(PamhyrWindow):
         super(ResultsWindowAdisTS, self).closeEvent(event)
 
     def _compute_status_label(self):
-        # Timestamp
-        ts = self._timestamps[self._slider_time.value()]
-
-        t0 = datetime.fromtimestamp(0)
-        fts = str(
-            datetime.fromtimestamp(ts) - t0
-        )
-        fts.replace("days", _translate("Results", "days"))\
-           .replace("day", _translate("Results", "day"))
-
         # Reach
         table = self.find(QTableView, f"tableView_reach")
         indexes = table.selectedIndexes()
@@ -196,8 +186,7 @@ class ResultsWindowAdisTS(PamhyrWindow):
         pname = profile.name if profile.name != "" else profile.kp
 
         return (f"Reach: {reach.name} | " +
-                f"Profile: {pname} | " +
-                f"Timestamp : {fts} ({ts} sec)")
+                f"Profile: {pname})")
 
     def setup_statusbar(self):
         txt = self._compute_status_label()
@@ -228,7 +217,7 @@ class ResultsWindowAdisTS(PamhyrWindow):
             "raw_data": self._set_current_profile_raw_data,
         }
 
-        for t in ["reach", "profile", "raw_data"]:
+        for t in ["reach", "profile"]:###, "raw_data"]:
             table = self.find(QTableView, f"tableView_{t}")
 
             table.selectionModel()\
@@ -253,10 +242,10 @@ class ResultsWindowAdisTS(PamhyrWindow):
         table.scrollTo(index)
 
         self._table["profile"].update(ind)
-        self._table["raw_data"].update(ind)
+        ###self._table["raw_data"].update(ind)
 
     def update_table_selection_profile(self, ind):
-        for t in ["profile", "raw_data"]:
+        for t in ["profile"]:###, "raw_data"]:
             table = self.find(QTableView, f"tableView_{t}")
             selectionModel = table.selectionModel()
             index = table.model().index(ind, 0)
@@ -325,7 +314,7 @@ class ResultsWindowAdisTS(PamhyrWindow):
 
         ind = indexes[0].row()
         self.update(profile_id=ind)
-        self._slider_profile.setValue(ind)
+        ###self._slider_profile.setValue(ind)
 
     def _set_current_profile_raw_data(self):
         table = self.find(QTableView, f"tableView_raw_data")
@@ -362,7 +351,7 @@ class ResultsWindowAdisTS(PamhyrWindow):
         self._timestamps = sorted(list(self._results.get("timestamps")))
 
         self._reload_plots()
-        self._reload_slider()
+        ###self._reload_slider()
 
     def _add_custom_plot(self):
         dlg = CustomPlotValuesSelectionDialog(parent=self)
-- 
GitLab