From 99ff7c5fed45bfd29313f0606f376a8edcfa227c Mon Sep 17 00:00:00 2001 From: Pierre-Antoine Rouby Date: Wed, 19 Mar 2025 14:12:35 +0100 Subject: [PATCH] Acoused: Use a specific logger. --- Model/create_table_for_save_as.py | 2 +- Model/read_table_for_open.py | 2 +- View/acoustic_data_tab.py | 2 +- View/sample_data_tab.py | 2 +- View/sediment_calibration_tab.py | 3 +-- View/signal_processing_tab.py | 25 +++++++++++++++---------- main.py | 8 ++++---- 7 files changed, 24 insertions(+), 20 deletions(-) diff --git a/Model/create_table_for_save_as.py b/Model/create_table_for_save_as.py index e7e8168..55866a9 100644 --- a/Model/create_table_for_save_as.py +++ b/Model/create_table_for_save_as.py @@ -32,7 +32,7 @@ from PyQt5.QtWidgets import QFileDialog, QApplication, QMessageBox import settings as stg from settings import ABS_name -logger = logging.getLogger() +logger = logging.getLogger("acoused") class CreateTableForSaveAs: diff --git a/Model/read_table_for_open.py b/Model/read_table_for_open.py index c064244..a6ca72d 100644 --- a/Model/read_table_for_open.py +++ b/Model/read_table_for_open.py @@ -34,7 +34,7 @@ from settings import BS_raw_data, acoustic_data from View.acoustic_data_tab import AcousticDataTab -logger = logging.getLogger() +logger = logging.getLogger("acoused") class ReadTableForOpen: diff --git a/View/acoustic_data_tab.py b/View/acoustic_data_tab.py index cecf112..e54046f 100644 --- a/View/acoustic_data_tab.py +++ b/View/acoustic_data_tab.py @@ -64,7 +64,7 @@ locale.setlocale(locale.LC_ALL, '') _translate = QCoreApplication.translate -logger = logging.getLogger() +logger = logging.getLogger("acoused") class AcousticDataTab(QWidget): COMPTEUR = 1 diff --git a/View/sample_data_tab.py b/View/sample_data_tab.py index 8e42dd0..85cb76f 100644 --- a/View/sample_data_tab.py +++ b/View/sample_data_tab.py @@ -50,7 +50,7 @@ import settings as stg _translate = QCoreApplication.translate -logger = logging.getLogger() +logger = logging.getLogger("acoused") class SampleDataTab(QWidget): diff --git a/View/sediment_calibration_tab.py b/View/sediment_calibration_tab.py index 838dea4..add79f0 100644 --- a/View/sediment_calibration_tab.py +++ b/View/sediment_calibration_tab.py @@ -48,7 +48,7 @@ import settings as stg from View.checkable_combobox import CheckableComboBox from Model.acoustic_inversion_method_high_concentration import AcousticInversionMethodHighConcentration -logger = logging.getLogger() +logger = logging.getLogger("acoused") class SedimentCalibrationTab(QWidget): @@ -2762,4 +2762,3 @@ class SedimentCalibrationTab(QWidget): self.lineEdit_slider_FCB.setText( str(stg.time[self.combobox_acoustic_data_choice.currentIndex()][ self.combobox_frequency_FCB.currentIndex(), self.slider_FCB.value()-1])) - diff --git a/View/signal_processing_tab.py b/View/signal_processing_tab.py index 1cff142..4ad4677 100644 --- a/View/signal_processing_tab.py +++ b/View/signal_processing_tab.py @@ -20,6 +20,8 @@ # -*- coding: utf-8 -*- +import logging + from cProfile import label from PyQt5.QtWidgets import ( @@ -55,6 +57,8 @@ import settings as stg _translate = QCoreApplication.translate +logger = logging.getLogger("acoused") + class SignalProcessingTab(QWidget): @@ -502,40 +506,41 @@ class SignalProcessingTab(QWidget): of data to be processed is updated, - the user change the limits of one or all the records in the first tab (Acoustic data) """ if len(stg.filename_BS_raw_data) == 0: - msgBox = QMessageBox() msgBox.setWindowTitle("Compute noise from profile tail error") msgBox.setIcon(QMessageBox.Warning) msgBox.setText("Download acoustic data in previous tab before updating data") msgBox.setStandardButtons(QMessageBox.Ok) msgBox.exec() - else: + data_id = self.combobox_acoustic_data_choice.currentIndex() + self.combobox_acoustic_data_choice.blockSignals(True) + logger.debug("Update the Signal preprocessing tab...") + self.combobox_acoustic_data_choice.clear() self.combobox_acoustic_data_choice.addItems(stg.filename_BS_raw_data) - if stg.noise_method[self.combobox_acoustic_data_choice.currentIndex()] == 0: - + if stg.noise_method[data_id] == 0: self.groupbox_download_noise_file.setChecked(True) self.groupbox_compute_noise_from_profile_tail.setChecked(False) self.groupbox_download_noise_file_toggle() - - elif stg.noise_method[self.combobox_acoustic_data_choice.currentIndex()] == 1: - + elif stg.noise_method[data_id] == 1: self.groupbox_download_noise_file.setChecked(False) self.groupbox_compute_noise_from_profile_tail.setChecked(True) self.groupbox_option_profile_tail_toggle() self.combobox_freq_noise_from_profile_tail.clear() - self.combobox_freq_noise_from_profile_tail.addItems(stg.freq_text[self.combobox_acoustic_data_choice.currentIndex()]) - - self.combobox_acoustic_data_choice.currentIndexChanged.connect(self.combobox_acoustic_data_choice_change_index) + self.combobox_freq_noise_from_profile_tail.addItems( + stg.freq_text[data_id] + ) self.compute_average_profile_tail() self.plot_averaged_profile_tail() + logger.debug("Update the Signal preprocessing tab... Done") + self.combobox_acoustic_data_choice.blockSignals(False) def activate_list_of_pre_processed_data(self): diff --git a/main.py b/main.py index caca3fb..8e83357 100644 --- a/main.py +++ b/main.py @@ -28,13 +28,13 @@ PERCENT_SCREEN_SIZE = 0.85 _translate = QCoreApplication.translate logging.basicConfig( - level=logging.DEBUG, + level=logging.INFO, format=('[AcouSed][%(levelname)s] %(message)s') ) -logger = logging.getLogger() -# logger.setLevel(logging.DEBUG) -logger.setLevel(logging.INFO) +logger = logging.getLogger("acoused") +logger.setLevel(logging.DEBUG) +#logger.setLevel(logging.INFO) class MainApplication(QMainWindow):