diff --git a/pyqt/mainwindow.ui b/pyqt/mainwindow.ui index 90c01aaf485fdacbd6b211a552693b9c112e6ba7..298f90ddb11c8ef218c16d1ec91b2ab1672761bf 100644 --- a/pyqt/mainwindow.ui +++ b/pyqt/mainwindow.ui @@ -84,20 +84,54 @@ <rect> <x>450</x> <y>140</y> - <width>211</width> - <height>31</height> + <width>201</width> + <height>32</height> </rect> </property> <layout class="QHBoxLayout" name="horizontalLayout"> + <property name="sizeConstraint"> + <enum>QLayout::SetDefaultConstraint</enum> + </property> <item> <widget class="QLabel" name="conduct_label_channel"> + <property name="minimumSize"> + <size> + <width>90</width> + <height>0</height> + </size> + </property> <property name="text"> <string>Display channel:</string> </property> </widget> </item> + <item> + <widget class="QPushButton" name="conduct_pushbutton_channel_prev"> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="maximumSize"> + <size> + <width>20</width> + <height>16777215</height> + </size> + </property> + <property name="text"> + <string><</string> + </property> + </widget> + </item> <item> <widget class="QComboBox" name="conduct_combobox_channel"> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="maximumSize"> + <size> + <width>40</width> + <height>16777215</height> + </size> + </property> <item> <property name="text"> <string>1</string> @@ -125,6 +159,22 @@ </item> </widget> </item> + <item> + <widget class="QPushButton" name="conduct_pushbutton_channel_next"> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="maximumSize"> + <size> + <width>20</width> + <height>16777215</height> + </size> + </property> + <property name="text"> + <string>></string> + </property> + </widget> + </item> </layout> </widget> <widget class="QTableWidget" name="conduct_tablewidget_run"> @@ -173,6 +223,9 @@ </column> </widget> <widget class="QPushButton" name="conduct_pushbutton_save_csv"> + <property name="enabled"> + <bool>false</bool> + </property> <property name="geometry"> <rect> <x>450</x> diff --git a/src/gui/uimainwindow.py b/src/gui/uimainwindow.py index 5adace155e653723048157c3d6505482d035d08b..faef9a6938bf46f60026b9cdd00617e6789b9c17 100644 --- a/src/gui/uimainwindow.py +++ b/src/gui/uimainwindow.py @@ -37,15 +37,24 @@ class Ui_MainWindow(object): item = QtWidgets.QTableWidgetItem() self.conduct_tablewidget_set.setHorizontalHeaderItem(3, item) self.horizontalLayoutWidget = QtWidgets.QWidget(self.conduct_groupbox) - self.horizontalLayoutWidget.setGeometry(QtCore.QRect(450, 140, 211, 31)) + self.horizontalLayoutWidget.setGeometry(QtCore.QRect(450, 140, 201, 32)) self.horizontalLayoutWidget.setObjectName("horizontalLayoutWidget") self.horizontalLayout = QtWidgets.QHBoxLayout(self.horizontalLayoutWidget) + self.horizontalLayout.setSizeConstraint(QtWidgets.QLayout.SetDefaultConstraint) self.horizontalLayout.setContentsMargins(0, 0, 0, 0) self.horizontalLayout.setObjectName("horizontalLayout") self.conduct_label_channel = QtWidgets.QLabel(self.horizontalLayoutWidget) + self.conduct_label_channel.setMinimumSize(QtCore.QSize(90, 0)) self.conduct_label_channel.setObjectName("conduct_label_channel") self.horizontalLayout.addWidget(self.conduct_label_channel) + self.conduct_pushbutton_channel_prev = QtWidgets.QPushButton(self.horizontalLayoutWidget) + self.conduct_pushbutton_channel_prev.setEnabled(False) + self.conduct_pushbutton_channel_prev.setMaximumSize(QtCore.QSize(20, 16777215)) + self.conduct_pushbutton_channel_prev.setObjectName("conduct_pushbutton_channel_prev") + self.horizontalLayout.addWidget(self.conduct_pushbutton_channel_prev) self.conduct_combobox_channel = QtWidgets.QComboBox(self.horizontalLayoutWidget) + self.conduct_combobox_channel.setEnabled(False) + self.conduct_combobox_channel.setMaximumSize(QtCore.QSize(40, 16777215)) self.conduct_combobox_channel.setObjectName("conduct_combobox_channel") self.conduct_combobox_channel.addItem("") self.conduct_combobox_channel.addItem("") @@ -53,6 +62,11 @@ class Ui_MainWindow(object): self.conduct_combobox_channel.addItem("") self.conduct_combobox_channel.addItem("") self.horizontalLayout.addWidget(self.conduct_combobox_channel) + self.conduct_pushbutton_channel_next = QtWidgets.QPushButton(self.horizontalLayoutWidget) + self.conduct_pushbutton_channel_next.setEnabled(False) + self.conduct_pushbutton_channel_next.setMaximumSize(QtCore.QSize(20, 16777215)) + self.conduct_pushbutton_channel_next.setObjectName("conduct_pushbutton_channel_next") + self.horizontalLayout.addWidget(self.conduct_pushbutton_channel_next) self.conduct_tablewidget_run = QtWidgets.QTableWidget(self.conduct_groupbox) self.conduct_tablewidget_run.setGeometry(QtCore.QRect(930, 180, 391, 521)) self.conduct_tablewidget_run.setObjectName("conduct_tablewidget_run") @@ -73,6 +87,7 @@ class Ui_MainWindow(object): item = QtWidgets.QTableWidgetItem() self.conduct_tablewidget_run.setHorizontalHeaderItem(6, item) self.conduct_pushbutton_save_csv = QtWidgets.QPushButton(self.conduct_groupbox) + self.conduct_pushbutton_save_csv.setEnabled(False) self.conduct_pushbutton_save_csv.setGeometry(QtCore.QRect(450, 70, 101, 30)) self.conduct_pushbutton_save_csv.setObjectName("conduct_pushbutton_save_csv") MainWindow.setCentralWidget(self.centralwidget) @@ -123,11 +138,13 @@ class Ui_MainWindow(object): item = self.conduct_tablewidget_set.horizontalHeaderItem(3) item.setText(_translate("MainWindow", "Steps")) self.conduct_label_channel.setText(_translate("MainWindow", "Display channel:")) + self.conduct_pushbutton_channel_prev.setText(_translate("MainWindow", "<")) self.conduct_combobox_channel.setItemText(0, _translate("MainWindow", "1")) self.conduct_combobox_channel.setItemText(1, _translate("MainWindow", "2")) self.conduct_combobox_channel.setItemText(2, _translate("MainWindow", "3")) self.conduct_combobox_channel.setItemText(3, _translate("MainWindow", "4")) self.conduct_combobox_channel.setItemText(4, _translate("MainWindow", "5")) + self.conduct_pushbutton_channel_next.setText(_translate("MainWindow", ">")) item = self.conduct_tablewidget_run.horizontalHeaderItem(0) item.setText(_translate("MainWindow", "Mean")) item = self.conduct_tablewidget_run.horizontalHeaderItem(1) diff --git a/src/uim/conductcalibuim.py b/src/uim/conductcalibuim.py index 208e808cf68c86c9173af38fcfe71f21d516d11c..e620168bca720e31fa247090ff6dddd829f39c6a 100644 --- a/src/uim/conductcalibuim.py +++ b/src/uim/conductcalibuim.py @@ -41,7 +41,11 @@ class ConductCalibUim: self.main_ui.conduct_pushbutton_save_csv.clicked.connect(self.save_as_csv) self.main_ui.conduct_tablewidget_set.cellClicked.connect(self.change_selected_run) + + # Channel selectors self.main_ui.conduct_combobox_channel.currentTextChanged.connect(self.change_selected_channel) + self.main_ui.conduct_pushbutton_channel_next.clicked.connect(self.display_next_channel) + self.main_ui.conduct_pushbutton_channel_prev.clicked.connect(self.display_prev_channel) self.main_ui.conduct_tablewidget_run.cellClicked.connect(self.highlight_step) @@ -68,6 +72,10 @@ class ConductCalibUim: self.__update_run_plot__(calib_run, self.current_channel) self.__update_run_table__(calib_run, self.current_channel) + self.main_ui.conduct_pushbutton_channel_next.setEnabled(True) + self.main_ui.conduct_combobox_channel.setEnabled(True) + self.main_ui.conduct_pushbutton_save_csv.setEnabled(True) + def save_as_csv(self): filename = QFileDialog.getSaveFileName(caption="Save Calibration set as CSV...", filter="*.csv") if filename[0] != '': @@ -135,8 +143,26 @@ class ConductCalibUim: def change_selected_channel(self, channel: str): self.current_channel = int(channel) + self.main_ui.conduct_combobox_channel.setCurrentText(channel) # In case the current selected channel was not changed by acting directly on the combobox self.__update_run_plot__(self.current_calib_run, int(channel)) self.__update_run_table__(self.current_calib_run, int(channel)) + if self.current_channel == 1: + self.main_ui.conduct_pushbutton_channel_prev.setEnabled(False) + else: + self.main_ui.conduct_pushbutton_channel_prev.setEnabled(True) + if self.current_channel == 5: + self.main_ui.conduct_pushbutton_channel_next.setEnabled(False) + else: + self.main_ui.conduct_pushbutton_channel_next.setEnabled(True) + + def display_next_channel(self): + next_channel = self.current_channel + 1 + self.change_selected_channel(str(next_channel)) + + def display_prev_channel(self): + prev_channel = self.current_channel - 1 + self.change_selected_channel(str(prev_channel)) + #################################################################### # "Run" table @@ -152,8 +178,8 @@ class ConductCalibUim: self.main_ui.conduct_tablewidget_run.setColumnWidth(self.FREQ_COL, 40) self.main_ui.conduct_tablewidget_run.setColumnWidth(self.HEADGAIN_COL, 40) self.main_ui.conduct_tablewidget_run.setColumnWidth(self.EXCITE_COL, 40) - self.main_ui.conduct_tablewidget_run.setColumnWidth(self.VALIDAUTO_COL, 50) - self.main_ui.conduct_tablewidget_run.setColumnWidth(self.VALIDMANUAL_COL, 50) + self.main_ui.conduct_tablewidget_run.setColumnWidth(self.VALIDAUTO_COL, 55) + self.main_ui.conduct_tablewidget_run.setColumnWidth(self.VALIDMANUAL_COL, 55) def __update_run_table__(self, calib_run: CalibRun, channel: int): # Clear table