diff --git a/View/acoustic_data_tab.py b/View/acoustic_data_tab.py index fa33cd6..4fb8a23 100644 --- a/View/acoustic_data_tab.py +++ b/View/acoustic_data_tab.py @@ -1518,27 +1518,14 @@ class AcousticDataTab(QWidget): self.slider.setMaximum(10) def clear_files_from_ListWidget(self): + self.fileListWidget.blockSignals(True) - list_to_clear = [ - "stg.acoustic_data", "stg.date", "stg.hour", - "stg.freq", "stg.freq_text", - "stg.nb_profiles", "stg.nb_profiles_per_sec", - "stg.nb_cells", "stg.cell_size", - "stg.pulse_length", "stg.nb_pings_per_sec", - "stg.nb_pings_averaged_per_profile", - "stg.kt_read", "stg.kt_corrected", "stg.gain_rx", "stg.gain_tx", - "stg.filename_BS_raw_data", "stg.path_BS_raw_data", - "stg.BS_raw_data", "stg.time", "stg.depth", - "stg.BS_raw_data_reshape", "stg.time_reshape", "stg.depth_reshape", - "stg.rmin", "stg.rmax", "stg.tmin", "stg.tmax", - "stg.time_cross_section", "stg.depth_cross_section", - "stg.BS_cross_section", "stg.BS_stream_bed" - ] + self.clear_files_data() + self.clear_files_from_ListWidget_reset() - for k in list_to_clear: - if isinstance(eval(k), list): - exec(k + ".clear()") + self.fileListWidget.blockSignals(False) + def clear_files_from_ListWidget_reset(self): self.fileListWidget.clear() # self.fileListWidget.takeItem(0) @@ -1615,6 +1602,27 @@ class AcousticDataTab(QWidget): self.slider.setValue(0) self.slider.setMaximum(10) + def clear_files_data(self): + list_to_clear = [ + stg.acoustic_data, stg.date, stg.hour, + stg.freq, stg.freq_text, + stg.nb_profiles, stg.nb_profiles_per_sec, + stg.nb_cells, stg.cell_size, + stg.pulse_length, stg.nb_pings_per_sec, + stg.nb_pings_averaged_per_profile, + stg.kt_read, stg.kt_corrected, stg.gain_rx, stg.gain_tx, + stg.filename_BS_raw_data, stg.path_BS_raw_data, + stg.BS_raw_data, stg.time, stg.depth, + stg.BS_raw_data_reshape, stg.time_reshape, stg.depth_reshape, + stg.rmin, stg.rmax, stg.tmin, stg.tmax, + stg.time_cross_section, stg.depth_cross_section, + stg.BS_cross_section, stg.BS_stream_bed + ] + + for k in list_to_clear: + if isinstance(k, list): + k.clear() + def load_BS_acoustic_raw_data(self): if self.fileListWidget.count() == 0: for p, f in zip(stg.path_BS_raw_data, @@ -2001,7 +2009,7 @@ class AcousticDataTab(QWidget): 14, 1, 1, 1, Qt.AlignLeft ) - if self.checkbox_kt.isChecked(): + if self.checkbox_kt.isChecked() and len(stg.kt_corrected) > freq_id: if self.combobox_frequency_information.count() > 0: self.lineEdit_kt.setText( str("%.4f" % stg.kt_corrected[freq_id])