Acoustic data: Refactorise 'remove_file_from_ListWidget' method.
parent
b9ca307c59
commit
b9669d9cbf
|
|
@ -1388,7 +1388,6 @@ class AcousticDataTab(QWidget):
|
||||||
self.fileListWidget.blockSignals(False)
|
self.fileListWidget.blockSignals(False)
|
||||||
|
|
||||||
def rename_file_in_ListWidget(self, event):
|
def rename_file_in_ListWidget(self, event):
|
||||||
|
|
||||||
if event == QEvent.MouseButtonPress:
|
if event == QEvent.MouseButtonPress:
|
||||||
print("c'est bon")
|
print("c'est bon")
|
||||||
if event.button == Qt.RightButton:
|
if event.button == Qt.RightButton:
|
||||||
|
|
@ -1401,124 +1400,59 @@ class AcousticDataTab(QWidget):
|
||||||
menu.addAction('Rename')
|
menu.addAction('Rename')
|
||||||
|
|
||||||
def remove_file_from_ListWidget(self):
|
def remove_file_from_ListWidget(self):
|
||||||
if self.fileListWidget.count() > 0:
|
if self.fileListWidget.count() <= 0:
|
||||||
|
return
|
||||||
|
|
||||||
# --- Clear files included in list Widget ---
|
self.fileListWidget.blockSignals(True)
|
||||||
current_row = self.fileListWidget.currentRow()
|
|
||||||
if current_row >= 0:
|
|
||||||
current_item = self.fileListWidget.takeItem(current_row)
|
|
||||||
del current_item
|
|
||||||
|
|
||||||
# --- Clear variables ---
|
# --- Clear files included in list Widget ---
|
||||||
list_to_pop1 = [
|
current_row = self.fileListWidget.currentRow()
|
||||||
stg.acoustic_data, stg.date, stg.hour,
|
if current_row >= 0:
|
||||||
stg.freq, stg.freq_text,
|
current_item = self.fileListWidget.takeItem(current_row)
|
||||||
stg.nb_profiles, stg.nb_profiles_per_sec,
|
del current_item
|
||||||
stg.nb_cells, stg.cell_size,
|
|
||||||
stg.pulse_length, stg.nb_pings_per_sec,
|
# --- Clear variables ---
|
||||||
stg.nb_pings_averaged_per_profile,
|
list_to_pop1 = [
|
||||||
stg.kt_read, stg.kt_corrected, stg.gain_rx, stg.gain_tx,
|
stg.acoustic_data, stg.date, stg.hour,
|
||||||
stg.filename_BS_raw_data, stg.path_BS_raw_data,
|
stg.freq, stg.freq_text,
|
||||||
stg.BS_raw_data, stg.time, stg.depth,
|
stg.nb_profiles, stg.nb_profiles_per_sec,
|
||||||
stg.BS_raw_data_reshape, stg.time_reshape, stg.depth_reshape
|
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
|
||||||
|
]
|
||||||
|
|
||||||
|
for p in list_to_pop1:
|
||||||
|
if isinstance(p, list):
|
||||||
|
p.pop(current_row)
|
||||||
|
|
||||||
|
if stg.BS_cross_section:
|
||||||
|
list_to_pop2 = [
|
||||||
|
stg.rmin, stg.rmax, stg.tmin, stg.tmax,
|
||||||
|
stg.time_cross_section, stg.depth_cross_section,
|
||||||
|
stg.BS_cross_section
|
||||||
]
|
]
|
||||||
|
|
||||||
for p in list_to_pop1:
|
for k in list_to_pop2:
|
||||||
if isinstance(p, list):
|
k.pop(current_row)
|
||||||
p.pop(current_row)
|
|
||||||
|
|
||||||
if stg.BS_cross_section:
|
if stg.BS_stream_bed:
|
||||||
list_to_pop2 = [
|
list_to_pop3 = [
|
||||||
stg.rmin, stg.rmax, stg.tmin, stg.tmax,
|
stg.BS_stream_bed, stg.depth_bottom,
|
||||||
stg.time_cross_section, stg.depth_cross_section,
|
stg.val_bottom, stg.ind_bottom,
|
||||||
stg.BS_cross_section
|
stg.freq_bottom_detection
|
||||||
]
|
]
|
||||||
|
|
||||||
for k in list_to_pop2:
|
for s in list_to_pop3:
|
||||||
k.pop(current_row)
|
s.pop(current_row)
|
||||||
|
|
||||||
if stg.BS_stream_bed:
|
if self.fileListWidget.count() == 0:
|
||||||
list_to_pop3 = [
|
self.clear_files_from_ListWidget_reset()
|
||||||
stg.BS_stream_bed, stg.depth_bottom,
|
|
||||||
stg.val_bottom, stg.ind_bottom,
|
|
||||||
stg.freq_bottom_detection
|
|
||||||
]
|
|
||||||
|
|
||||||
for s in list_to_pop3:
|
self.fileListWidget.blockSignals(False)
|
||||||
s.pop(current_row)
|
|
||||||
|
|
||||||
if self.fileListWidget.count() == 0:
|
|
||||||
# --- Clear measurements information ---
|
|
||||||
self.label_date_acoustic_file.clear()
|
|
||||||
self.label_date_acoustic_file.setText("Date: ")
|
|
||||||
self.label_hour_acoustic_file.clear()
|
|
||||||
self.label_hour_acoustic_file.setText("Hour: ")
|
|
||||||
self.lineEdit_sound_attenuation.setText("0.00")
|
|
||||||
self.combobox_frequency_information.clear()
|
|
||||||
self.label_profiles_value.clear()
|
|
||||||
self.label_profiles_per_sec_value.clear()
|
|
||||||
self.label_cells_value.clear()
|
|
||||||
self.label_cell_size_value.clear()
|
|
||||||
self.label_pulse_length_value.clear()
|
|
||||||
self.label_pings_per_sec_value.clear()
|
|
||||||
self.label_pings_per_profile_value.clear()
|
|
||||||
self.lineEdit_kt.setText("0.00")
|
|
||||||
self.lineEdit_rx.setText("0.00")
|
|
||||||
self.lineEdit_tx.setText("0.00")
|
|
||||||
|
|
||||||
# --- Clear display options ---
|
|
||||||
|
|
||||||
self.label_time_min.setText("0.00")
|
|
||||||
self.lineEdit_time_min_limits.setText("0.00")
|
|
||||||
self.lineEdit_time_max_limits.setText("0.00")
|
|
||||||
self.label_time_max.setText("0.00")
|
|
||||||
|
|
||||||
self.label_depth_min.setText("0.00")
|
|
||||||
self.lineEdit_depth_min_limits.setText("0.00")
|
|
||||||
self.lineEdit_depth_max_limits.setText("0.00")
|
|
||||||
self.label_depth_max.setText("0.00")
|
|
||||||
|
|
||||||
self.label_distance_from_bank_min.setText("0.00")
|
|
||||||
self.lineEdit_distance_from_bank_min_limits.setText("0.00")
|
|
||||||
self.lineEdit_distance_from_bank_max_limits.setText("0.00")
|
|
||||||
self.label_distance_from_bank_max.setText("0.00")
|
|
||||||
|
|
||||||
self.combobox_frequency_bathymetry.clear()
|
|
||||||
self.lineEdit_depth_min_bathy.setText("0.00")
|
|
||||||
self.lineEdit_depth_max_bathy.setText("0.00")
|
|
||||||
self.lineEdit_next_cell_bathy.setText("0.00")
|
|
||||||
|
|
||||||
# --- Clear table of values ---
|
|
||||||
self.tableView.reset()
|
|
||||||
data = pd.DataFrame(np.zeros((10, 10)))
|
|
||||||
self.tableModel = TableModel(data)
|
|
||||||
self.tableView.setModel(self.tableModel)
|
|
||||||
|
|
||||||
# --- Clear figure : 2D plot of the acoustic recording ---
|
|
||||||
self.verticalLayout_groupbox_transect_2Dplot_raw_BS_data.removeWidget(self.scroll_BS)
|
|
||||||
self.verticalLayout_groupbox_transect_2Dplot_raw_BS_data.removeWidget(self.toolbar_BS)
|
|
||||||
|
|
||||||
self.canvas_BS = FigureCanvas()
|
|
||||||
self.toolbar_BS = NavigationToolBar(self.canvas_BS, self)
|
|
||||||
self.scroll_BS.setWidget(self.canvas_BS)
|
|
||||||
|
|
||||||
self.verticalLayout_groupbox_transect_2Dplot_raw_BS_data.addWidget(self.toolbar_BS)
|
|
||||||
self.verticalLayout_groupbox_transect_2Dplot_raw_BS_data.addWidget(self.scroll_BS)
|
|
||||||
|
|
||||||
# --- Clear figure : profile ---
|
|
||||||
self.combobox_frequency_profile.clear()
|
|
||||||
|
|
||||||
self.verticalLayout_groupbox_plot_profile.removeWidget(self.canvas_plot_profile)
|
|
||||||
self.verticalLayout_groupbox_plot_profile.removeWidget(self.toolbar_profile)
|
|
||||||
|
|
||||||
self.canvas_plot_profile = FigureCanvas()
|
|
||||||
self.toolbar_profile = NavigationToolBar(self.canvas_plot_profile, self)
|
|
||||||
|
|
||||||
self.verticalLayout_groupbox_plot_profile.addWidget(self.toolbar_profile)
|
|
||||||
self.verticalLayout_groupbox_plot_profile.addWidget(self.canvas_plot_profile)
|
|
||||||
|
|
||||||
self.slider.setValue(0)
|
|
||||||
self.slider.setMaximum(10)
|
|
||||||
|
|
||||||
def clear_files_from_ListWidget(self):
|
def clear_files_from_ListWidget(self):
|
||||||
self.fileListWidget.blockSignals(True)
|
self.fileListWidget.blockSignals(True)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue