QScrollArea is included in the two QGroupbox of plotting transect (Backscatter data and SNR data). I need to fix size of QscrollArea when I push button plot BS transect

dev-brahim
brahim 2023-08-01 10:06:37 +02:00
parent 6817ffe4d8
commit 0682bfd817
1 changed files with 17 additions and 62 deletions

View File

@ -446,6 +446,8 @@ class AcousticDataTab(QWidget):
# ++++++++++++++++++++++++++************++++++++++++++
self.verticalLayout_groupbox_transect_2Dplot_raw_BS_data = QVBoxLayout(self.groupbox_transect_2Dplot_raw_BS_data)
# self.verticalLayout_groupbox_transect_2Dplot_raw_BS_data.setContentsMargins(0, 0, 0, 0)
# self.verticalLayout_groupbox_transect_2Dplot_raw_BS_data.setSpacing(0)
self.canvas_BS = None
@ -770,64 +772,6 @@ class AcousticDataTab(QWidget):
# self.groupbox_xaxis_time.setDisabled(False)
# self.groupbox_xaxis_space.setDisabled(True)
# def fill_lineEdit(self, dir_name, name):
# if self.pushbutton_acousticfile.isChecked():
# self.lineEdit_acousticfile.setText(name)
# self.lineEdit_acousticfile.setToolTip(dir_name)
# self.fill_label_acoustic_file()
# self.fill_measurements_information_groupbox()
# self.pushbutton_acousticfile.setChecked(False)
# elif self.pushButton_noisefile.isChecked():
# self.lineEdit_noisefile.setText(name)
# self.lineEdit_noisefile.setToolTip(dir_name)
# self.fill_label_noise_file()
# self.pushButton_noisefile.setChecked(False)
# elif self.pushButton_gpsfile.isChecked():
# self.lineEdit_gpsfile.setText(name)
# self.lineEdit_gpsfile.setToolTip(dir_name)
# self.fill_label_gps_file()
# self.pushButton_gpsfile.setChecked(False)
#
# def fill_label_acoustic_file(self):
# self.label_date_acousticfile.setText(
# _translate("CONSTANT_STRING", cs.DATE) + ": " + str(self._model.data.date.date()))
# self.label_hour_acousticfile.setText(
# _translate("CONSTANT_STRING", cs.HOUR) + ": " + str(self._model.data.date.time()))
#
# def fill_label_noise_file(self):
# self.label_date_noise_file.setText(
# _translate("CONSTANT_STRING", cs.DATE) + ": " + str(self._model.data.date.date()))
# self.label_hour_noise_file.setText(
# _translate("CONSTANT_STRING", cs.HOUR) + ": " + str(self._model.data.date.time()))
#
# def fill_label_gps_file(self):
# pass
# # self.label_date_gps_file.setText(
# # _translate("CONSTANT_STRING", cs.DATE) + ": " + str(self._model.gps_load_date_hour.date()))
# # self.label_hour_gps_file.setText(
# # _translate("CONSTANT_STRING", cs.HOUR) + ": " + str(self._model.gps_load_date_hour.time()))
# def fill_table(self):
# print("it's clicked")
# print(AcousticData.concatenate_data(self))
# # if event.type() == QEvent.MouseButtonPress:
# # print("Fill table")
# # print("event = ", event)
# # print("QEvent.MouseButtonPress ", QEvent.MouseButtonPress)
# # super(AcousticDataTab, self).mousePressEvent(event)
# # print("1 : connect widget to controller - fill table")
# # self._controller.update_table_data()
# # data = self._model.acoustic_data_table
# # tableModel = TableModel(data)
# # self.tableView.setModel(tableModel)
# # print("open dialog box ", self.open_dialog_box())
#
# def on_BS_data_updated(self, value):
# pass
def plot_transect_with_BS_raw_data(self):
if self.tableModel.rowCount(1) > 11:
acoustic_data = self.load_BS_acoustic_raw_data()
@ -840,10 +784,15 @@ class AcousticDataTab(QWidget):
# print("tmax index ", np.where(np.round(acoustic_data._time, 2) == self.spinbox_tmax.value())[0][0])
self.fig_BS, self.axis_BS = plt.subplots(nrows=acoustic_data._freq.shape[0], ncols=1, sharex=True, sharey=False, layout="constrained")
self.canvas_BS = FigureCanvas(self.fig_BS)
self.verticalLayout_groupbox_transect_2Dplot_raw_BS_data.addWidget(self.canvas_BS)
# self.verticalLayout_groupbox_transect_2Dplot_raw_BS_data.addWidget(self.canvas_BS)
# self.scroll_BS = QScrollArea()
# self.scroll_BS.setWidget(self.canvas_BS)
self.scroll_BS = QScrollArea()
self.scroll_BS.setWidget(self.canvas_BS)
self.scroll_BS.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
self.scroll_BS.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOn)
# self.scroll_BS.setWidgetResizable(True)
self.scroll_BS.setAlignment(Qt.AlignCenter)
self.verticalLayout_groupbox_transect_2Dplot_raw_BS_data.addWidget(self.scroll_BS)
self.spinbox_tmin.setValue(np.min(acoustic_data._time))
self.spinbox_tmax.setValue(np.round(np.max(acoustic_data._time), 2))
@ -919,6 +868,12 @@ class AcousticDataTab(QWidget):
self.canvas_SNR = FigureCanvas(self.fig_SNR)
self.verticalLayout_groupbox_transect_2Dplot_snr_data.addWidget(self.canvas_SNR)
self.scroll_SNR = QScrollArea()
self.scroll_SNR.setWidget(self.canvas_SNR)
self.scroll_SNR.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
self.scroll_SNR.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOn)
self.verticalLayout_groupbox_transect_2Dplot_snr_data.addWidget(self.scroll_SNR)
# self.spinbox_tmin.setValue(np.min(noise_data._time_snr))
# self.spinbox_tmax.setValue(np.round(np.max(noise_data._time_snr), 2))
@ -1132,7 +1087,7 @@ class AcousticDataTab(QWidget):
+ np.min(r_bottom[np.where(np.round(acoustic_data._time, 2) == self.spinbox_tmin.value())[0][0]:
np.where(np.round(acoustic_data._time, 2) == self.spinbox_tmax.value())[0][0]]),
# np.max(self._model.r_bottom_cross_section) - self._model.r_bottom_cross_section + np.min(self._model.r_bottom_cross_section),
color='black', linewidth=1, linestyle="--")
color='black', linewidth=1, linestyle="solid")
# self.axis_BS[f].text(1, .70, acoustic_data._freq_text[f],
# fontsize=14, fontweight='bold', fontname="Ubuntu", c="black", alpha=0.5,