add time slider (results)

adists_release
Theophile Terraz 2024-10-11 08:57:40 +02:00
parent 91e780432d
commit 92c9b106e3
4 changed files with 100 additions and 21 deletions

View File

@ -521,13 +521,11 @@ class AdisTSlc(AdisTS):
for k in range(0, ismax, kbl):
data = np.fromfile(f, dtype=np.int32, count=1) # line length (bytes) (start)
pk[k:min(k + kbl, ismax)] = np.fromfile(f, dtype=np.float32, count=min(k + kbl, ismax) - k)
print("pk : ", pk)
data = np.fromfile(f, dtype=np.int32, count=1) # line length (bytes) (end)
# fifth line (useless)
data = np.fromfile(f, dtype=np.int32, count=1) # line length (bytes) (start)
zmin_OLD = np.fromfile(f, dtype=np.float32, count=1)[0]
print("zmin_OLD : ", zmin_OLD)
data = np.fromfile(f, dtype=np.int32, count=1) # line length (bytes) (end)
# sixth line
zf = np.zeros(ismax, dtype=np.float32)
@ -539,12 +537,10 @@ class AdisTSlc(AdisTS):
# z[i*3+1] and z[i*3+2] are useless
data = np.fromfile(f, dtype=np.int32, count=1) # line length (bytes) (end)
zf = [z[i * 3] for i in range(ismax)]
print("zf : ", zf)
# seventh line (useless)
for k in range(0, ismax, kbl):
data = np.fromfile(f, dtype=np.int32, count=1) # line length (bytes) (start)
zero = np.fromfile(f, dtype=np.int32, count=ismax)
print("zero : ", zero)
data = np.fromfile(f, dtype=np.int32, count=1) # line length (bytes) (end)
# end header
@ -648,17 +644,12 @@ class AdisTSlc(AdisTS):
#print("isma")
###print("iprofiles: ", iprofiles)
pi_tmp = []
reach_tmp = []
for i in range(ismax-1):
for i in range(ismax):
#print("first i: ", i)
reach = ip_to_r(i)
reach_tmp.append(reach)
#print("reach i:", reach)
#print("second i: ", i)
p_i = ip_to_ri(reach, i)
pi_tmp.append(p_i)
for t_data in timestamps_keys:
pol_view = []

View File

@ -99,17 +99,12 @@ class TableModel(PamhyrTableModel):
tmp_list = self._data.pollutants_list.copy()
tmp_list.remove("total_sediment")
tmp_list2 = self._data.pollutants_list.copy()
print("=============================list polutants table raw: ", tmp_list)
print("=============================list polutants table raw: ", tmp_list2)
for pol in tmp_list:
pol_index = tmp_list2.index(pol)
print("=============================pol index: ", pol_index)
header_name = pol + " Concentration"
print("=============================Headers: ", self._headers[column])
print("=============================Headers: ", header_name)
#print(f"_lst({row}): {len(self._lst[row])}")
#print(f"longueur : {len(self._lst[row].get_ts_key(self._timestamp, 'pols')[pol_index])}")
if self._headers[column] == header_name:
print("=============================Headers: ", self._headers[column])
print("=============================Headers: ", header_name)
v = self._lst[row].get_ts_key(self._timestamp, "pols")[pol_index][0]
return f"{v:.4f}"
elif self._headers[column] == pol + " Mass":

View File

@ -114,7 +114,9 @@ class ResultsWindowAdisTS(PamhyrWindow):
print("setup table adists results")
self.setup_table()
print("///setup table correct")
self.setup_plots()
print("///setup plots correct")
self.setup_slider()
print("///setup slider correct")
self.setup_statusbar()
@ -143,6 +145,27 @@ class ResultsWindowAdisTS(PamhyrWindow):
)
def setup_slider(self):
default_reach = self._results.river.reach(0)
self._slider_time = self.find(QSlider, f"horizontalSlider_time")
self._slider_time.setMaximum(len(self._timestamps) - 1)
self._slider_time.setValue(len(self._timestamps) - 1)
self._icon_start = QIcon()
self._icon_start.addPixmap(
QPixmap(self._path_file("media-playback-start.png"))
)
self._icon_pause = QIcon()
self._icon_pause.addPixmap(
QPixmap(self._path_file("media-playback-pause.png"))
)
self._button_play = self.find(QPushButton, f"playButton")
self._button_play.setIcon(self._icon_start)
self._button_back = self.find(QPushButton, f"backButton")
self._button_next = self.find(QPushButton, f"nextButton")
self._button_first = self.find(QPushButton, f"firstButton")
self._button_last = self.find(QPushButton, f"lastButton")
self._timer = QTimer(self)
def setup_plots(self):

View File

@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>1280</width>
<width>1097</width>
<height>720</height>
</rect>
</property>
@ -54,8 +54,78 @@
</widget>
<widget class="QWidget" name="layoutWidget">
<layout class="QGridLayout" name="gridLayout_2">
<item row="1" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_2"/>
<item row="4" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QPushButton" name="firstButton">
<property name="text">
<string/>
</property>
<property name="icon">
<iconset>
<normaloff>ressources/media-skip-backward.png</normaloff>ressources/media-skip-backward.png</iconset>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="backButton">
<property name="text">
<string/>
</property>
<property name="icon">
<iconset>
<normaloff>ressources/media-seek-backward.png</normaloff>ressources/media-seek-backward.png</iconset>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="playButton">
<property name="text">
<string/>
</property>
<property name="icon">
<iconset>
<normaloff>ressources/player_play.png</normaloff>
<normalon>ressources/player_pause.png</normalon>ressources/player_play.png</iconset>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="nextButton">
<property name="text">
<string/>
</property>
<property name="icon">
<iconset>
<normaloff>ressources/media-seek-forward.png</normaloff>ressources/media-seek-forward.png</iconset>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="lastButton">
<property name="text">
<string/>
</property>
<property name="icon">
<iconset>
<normaloff>ressources/media-skip-forward.png</normaloff>ressources/media-skip-forward.png</iconset>
</property>
</widget>
</item>
<item>
<widget class="QSlider" name="horizontalSlider_time">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
</layout>
</item>
<item row="0" column="0">
<widget class="QTabWidget" name="tabWidget">
@ -170,7 +240,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>1280</width>
<width>1097</width>
<height>22</height>
</rect>
</property>