diff --git a/pyqt/mainwindow.ui b/pyqt/mainwindow.ui index dabf59cd50207ac7058bdc0ab18c7f466c90a02b..07e9834314e8e127320f3539cd2d1b7608724fa0 100644 --- a/pyqt/mainwindow.ui +++ b/pyqt/mainwindow.ui @@ -34,9 +34,9 @@ <property name="geometry"> <rect> <x>20</x> - <y>260</y> + <y>300</y> <width>1321</width> - <height>651</height> + <height>611</height> </rect> </property> </widget> @@ -46,7 +46,7 @@ <x>20</x> <y>50</y> <width>921</width> - <height>201</height> + <height>241</height> </rect> </property> <property name="selectionBehavior"> @@ -245,6 +245,22 @@ <string>Stabilization analysis</string> </property> </widget> + <widget class="QLabel" name="explo_label_timeshift"> + <property name="geometry"> + <rect> + <x>960</x> + <y>270</y> + <width>161</width> + <height>16</height> + </rect> + </property> + <property name="toolTip"> + <string><html><head/><body><p>Time shift between the yellow vertical line (left click on graph to generate or move) and the current cursor position (dotted white vertical line).</p></body></html></string> + </property> + <property name="text"> + <string>Time shift:</string> + </property> + </widget> </widget> <widget class="QWidget" name="tab_conductcalib"> <attribute name="title"> @@ -521,7 +537,7 @@ <x>0</x> <y>0</y> <width>1355</width> - <height>26</height> + <height>21</height> </rect> </property> <widget class="QMenu" name="menuInstrument"> diff --git a/src/gui/uimainwindow.py b/src/gui/uimainwindow.py index 716cad3584c93511bd8f8f05ce756c6f346c588b..a4b4a05d8784fbe3c584b290c43a53a8370fd037 100644 --- a/src/gui/uimainwindow.py +++ b/src/gui/uimainwindow.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -# Form implementation generated from reading ui file '../pyqt/mainwindow.ui' +# Form implementation generated from reading ui file '..\pyqt\mainwindow.ui' # # Created by: PyQt5 UI code generator 5.11.3 # @@ -20,10 +20,10 @@ class Ui_MainWindow(object): self.tab_explo = QtWidgets.QWidget() self.tab_explo.setObjectName("tab_explo") self.explo_graphicsview_top = PlotWidget(self.tab_explo) - self.explo_graphicsview_top.setGeometry(QtCore.QRect(20, 260, 1321, 651)) + self.explo_graphicsview_top.setGeometry(QtCore.QRect(20, 300, 1321, 611)) self.explo_graphicsview_top.setObjectName("explo_graphicsview_top") self.explo_tablewidget_variables = QtWidgets.QTableWidget(self.tab_explo) - self.explo_tablewidget_variables.setGeometry(QtCore.QRect(20, 50, 921, 201)) + self.explo_tablewidget_variables.setGeometry(QtCore.QRect(20, 50, 921, 241)) self.explo_tablewidget_variables.setSelectionBehavior(QtWidgets.QAbstractItemView.SelectColumns) self.explo_tablewidget_variables.setObjectName("explo_tablewidget_variables") self.explo_tablewidget_variables.setColumnCount(9) @@ -101,6 +101,9 @@ class Ui_MainWindow(object): self.explo_pushbutton_stab = QtWidgets.QPushButton(self.tab_explo) self.explo_pushbutton_stab.setGeometry(QtCore.QRect(400, 10, 161, 30)) self.explo_pushbutton_stab.setObjectName("explo_pushbutton_stab") + self.explo_label_timeshift = QtWidgets.QLabel(self.tab_explo) + self.explo_label_timeshift.setGeometry(QtCore.QRect(960, 270, 161, 16)) + self.explo_label_timeshift.setObjectName("explo_label_timeshift") self.tabWidget.addTab(self.tab_explo, "") self.tab_conductcalib = QtWidgets.QWidget() self.tab_conductcalib.setObjectName("tab_conductcalib") @@ -195,7 +198,7 @@ class Ui_MainWindow(object): self.tabWidget.addTab(self.tab_pumpcalib, "") MainWindow.setCentralWidget(self.centralwidget) self.menubar = QtWidgets.QMenuBar(MainWindow) - self.menubar.setGeometry(QtCore.QRect(0, 0, 1355, 26)) + self.menubar.setGeometry(QtCore.QRect(0, 0, 1355, 21)) self.menubar.setObjectName("menubar") self.menuInstrument = QtWidgets.QMenu(self.menubar) self.menuInstrument.setObjectName("menuInstrument") @@ -257,6 +260,8 @@ class Ui_MainWindow(object): self.explo_pushbutton_setup_save.setText(_translate("MainWindow", "Save current setup")) self.explo_pushbutton_setup_load.setText(_translate("MainWindow", "Load selected")) self.explo_pushbutton_stab.setText(_translate("MainWindow", "Stabilization analysis")) + self.explo_label_timeshift.setToolTip(_translate("MainWindow", "<html><head/><body><p>Time shift between the yellow vertical line (left click on graph to generate or move) and the current cursor position (dotted white vertical line).</p></body></html>")) + self.explo_label_timeshift.setText(_translate("MainWindow", "Time shift:")) self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_explo), _translate("MainWindow", "Data exploration")) item = self.conduct_tablewidget_set.horizontalHeaderItem(0) item.setText(_translate("MainWindow", "Date")) diff --git a/src/gui/uistabwindow.py b/src/gui/uistabwindow.py index 99144acc7aa6f2de5b10651466d84f48d4019c7c..7592df0fc84a1aa86a80fcba586bf67078174c58 100644 --- a/src/gui/uistabwindow.py +++ b/src/gui/uistabwindow.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -# Form implementation generated from reading ui file '../pyqt/stabwindow.ui' +# Form implementation generated from reading ui file '..\pyqt\stabwindow.ui' # # Created by: PyQt5 UI code generator 5.11.3 # diff --git a/src/uim/explouim.py b/src/uim/explouim.py index 4c78f1008244ca2347f04b2541d8c66007c64158..f323bee6b15fa9cde2de9a3409d51d8dd259c99c 100644 --- a/src/uim/explouim.py +++ b/src/uim/explouim.py @@ -391,16 +391,19 @@ class ExploUim: def __mouse_moved__(self, pos: QPointF) -> None: """Function triggered when the user's mouse cursor hovers over the plot. Display a vertical line where the - cursor is. + cursor is, and update time shift with click-fixed line, if any. Parameters ---------- pos: PyQt5.QtCore.QPointF """ - # if self.step_curves[0].sceneBoundingRect().contains(pos): mouse_point = self.step_curves[0].getViewBox().mapSceneToView(pos) self.cursor_vline.setPos(mouse_point.x()) + if self.measure_vline.getPos() != [0, 0]: + timeshift_s = abs(self.measure_vline.getPos()[0] - self.cursor_vline.getPos()[0]) + self.main_ui.explo_label_timeshift.setText("Time shift: " + "{:.2f}".format(timeshift_s) + "s") + def __get_timeseries_x_values__(self, timeseries: pd.DataFrame, timeshift_sec: float = 0) -> list: # As it is a _step_ curve, add a last datetime point to determine the end of the last step. This is the datetime # of the last available data of the dataset, plus one second.