mirror of https://gitlab.com/pamhyr/pamhyr2
Results: Add status bar timestamp information.
parent
09bdb7dd92
commit
5e5cc8d050
|
|
@ -17,6 +17,7 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
from datetime import datetime
|
||||||
|
|
||||||
from tools import trace, timer
|
from tools import trace, timer
|
||||||
|
|
||||||
|
|
@ -37,7 +38,7 @@ from PyQt5.QtWidgets import (
|
||||||
QFileDialog, QTableView, QAbstractItemView,
|
QFileDialog, QTableView, QAbstractItemView,
|
||||||
QUndoStack, QShortcut, QAction, QItemDelegate,
|
QUndoStack, QShortcut, QAction, QItemDelegate,
|
||||||
QComboBox, QVBoxLayout, QHeaderView, QTabWidget,
|
QComboBox, QVBoxLayout, QHeaderView, QTabWidget,
|
||||||
QSlider,
|
QSlider, QLabel,
|
||||||
)
|
)
|
||||||
|
|
||||||
from View.Plot.MplCanvas import MplCanvas
|
from View.Plot.MplCanvas import MplCanvas
|
||||||
|
|
@ -78,6 +79,7 @@ class ResultsWindow(ASubMainWindow, ListedSubWindow):
|
||||||
self.setup_table()
|
self.setup_table()
|
||||||
self.setup_graph()
|
self.setup_graph()
|
||||||
self.setup_slider()
|
self.setup_slider()
|
||||||
|
self.setup_statusbar()
|
||||||
self.setup_connections()
|
self.setup_connections()
|
||||||
|
|
||||||
self.ui.setWindowTitle(self._title)
|
self.ui.setWindowTitle(self._title)
|
||||||
|
|
@ -239,6 +241,27 @@ class ResultsWindow(ASubMainWindow, ListedSubWindow):
|
||||||
)
|
)
|
||||||
self.plot_sed_profile.draw()
|
self.plot_sed_profile.draw()
|
||||||
|
|
||||||
|
def _compute_status_label(self):
|
||||||
|
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"))
|
||||||
|
|
||||||
|
return (f"Timestamp : {fts} ({ts} sec)")
|
||||||
|
|
||||||
|
def setup_statusbar(self):
|
||||||
|
txt = self._compute_status_label()
|
||||||
|
self._status_label = QLabel(txt)
|
||||||
|
self.statusbar.addPermanentWidget(self._status_label)
|
||||||
|
|
||||||
|
def update_statusbar(self):
|
||||||
|
txt = self._compute_status_label()
|
||||||
|
self._status_label.setText(txt)
|
||||||
|
|
||||||
def setup_connections(self):
|
def setup_connections(self):
|
||||||
self.undo_sc.activated.connect(self.undo)
|
self.undo_sc.activated.connect(self.undo)
|
||||||
self.redo_sc.activated.connect(self.redo)
|
self.redo_sc.activated.connect(self.redo)
|
||||||
|
|
@ -286,7 +309,7 @@ class ResultsWindow(ASubMainWindow, ListedSubWindow):
|
||||||
self.plot_xy.set_timestamp(timestamp)
|
self.plot_xy.set_timestamp(timestamp)
|
||||||
self.plot_ac.set_timestamp(timestamp)
|
self.plot_ac.set_timestamp(timestamp)
|
||||||
self.plot_kpc.set_timestamp(timestamp)
|
self.plot_kpc.set_timestamp(timestamp)
|
||||||
self.plot_h.set_timestamp(timestamp)
|
# self.plot_h.set_timestamp(timestamp)
|
||||||
|
|
||||||
if self._study.river.has_sediment():
|
if self._study.river.has_sediment():
|
||||||
self.plot_sed_reach.set_timestamp(timestamp)
|
self.plot_sed_reach.set_timestamp(timestamp)
|
||||||
|
|
@ -301,6 +324,7 @@ class ResultsWindow(ASubMainWindow, ListedSubWindow):
|
||||||
self.plot_sed_reach.draw()
|
self.plot_sed_reach.draw()
|
||||||
self.plot_sed_profile.draw()
|
self.plot_sed_profile.draw()
|
||||||
|
|
||||||
|
self.update_statusbar()
|
||||||
|
|
||||||
def _set_current_reach(self):
|
def _set_current_reach(self):
|
||||||
table = self.find(QTableView, f"tableView_reach")
|
table = self.find(QTableView, f"tableView_reach")
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue