From 133470edb805913c4471fffb5133e7be54168eca Mon Sep 17 00:00:00 2001 From: kienle <kienle@passcal.nmt.edu> Date: Mon, 11 Sep 2023 17:33:44 -0600 Subject: [PATCH] Fix minor QT warning --- sohstationviewer/model/data_loader.py | 19 +++++++++--- .../model/general_data/general_data.py | 3 ++ sohstationviewer/view/main_window.py | 31 +++++++------------ 3 files changed, 28 insertions(+), 25 deletions(-) diff --git a/sohstationviewer/model/data_loader.py b/sohstationviewer/model/data_loader.py index 7e8c600c3..f4d4275c2 100644 --- a/sohstationviewer/model/data_loader.py +++ b/sohstationviewer/model/data_loader.py @@ -31,11 +31,14 @@ class DataLoaderWorker(QtCore.QObject): is_multiplex: Optional[bool], list_of_dir: List[Path], list_of_rt130_paths: List[Path], req_wf_chans: Union[List[str], List[int]] = [], - req_soh_chans: List[str] = [], read_start: float = 0, - gap_minimum: Optional[float] = None, + req_soh_chans: List[str] = [], + read_start: float = 0, read_end: float = constants.HIGHEST_INT, + gap_minimum: Optional[float] = None, include_mp123: bool = False, include_mp456: bool = False, - rt130_waveform_data_req: bool = False, parent_thread=None): + rt130_waveform_data_req: bool = False, + rt130_log_files: List[Path] = [], + parent_thread=None): super().__init__() self.data_type = data_type self.tracking_box = tracking_box @@ -49,7 +52,8 @@ class DataLoaderWorker(QtCore.QObject): self.read_end = read_end self.include_mp123 = include_mp123 self.include_mp456 = include_mp456 - self. rt130_waveform_data_req = rt130_waveform_data_req + self.rt130_waveform_data_req = rt130_waveform_data_req + self.rt130_log_files = rt130_log_files self.parent_thread = parent_thread # display_tracking_info updates a QtWidget, which can only be done in # the read. Since self.run runs in a background thread, we need to use @@ -86,6 +90,7 @@ class DataLoaderWorker(QtCore.QObject): include_mp123zne=self.include_mp123, include_mp456uvw=self.include_mp456, rt130_waveform_data_req=self.rt130_waveform_data_req, + rt130_log_files=self.rt130_log_files, creator_thread=self.parent_thread, notification_signal=self.notification, pause_signal=self.button_dialog @@ -141,7 +146,8 @@ class DataLoader(QtCore.QObject): read_end: float = constants.HIGHEST_INT, include_mp123: bool = False, include_mp456: bool = False, - rt130_waveform_data_req: bool = False): + rt130_waveform_data_req: bool = False, + rt130_log_files: List[Path] = []): """ Initialize the data loader. Construct the thread and worker and connect them together. Separated from the actual loading of the data to allow @@ -158,6 +164,8 @@ class DataLoader(QtCore.QObject): :param read_end: the time after which no data is read :param include_mp123: if mass position channels 1,2,3 are requested :param include_mp456: if mass position channels 4,5,6 are requested + :param rt130_log_files: list of paths to RT130 log files selected by + the user """ if self.running: # TODO: implement showing an error window @@ -180,6 +188,7 @@ class DataLoader(QtCore.QObject): include_mp123=include_mp123, include_mp456=include_mp456, rt130_waveform_data_req=rt130_waveform_data_req, + rt130_log_files=rt130_log_files, parent_thread=self.thread ) diff --git a/sohstationviewer/model/general_data/general_data.py b/sohstationviewer/model/general_data/general_data.py index 36c33da88..99bae8127 100644 --- a/sohstationviewer/model/general_data/general_data.py +++ b/sohstationviewer/model/general_data/general_data.py @@ -50,6 +50,7 @@ class GeneralData(): include_mp123zne: bool = False, include_mp456uvw: bool = False, rt130_waveform_data_req: bool = False, + rt130_log_files: List[Path] = [], creator_thread: Optional[QtCore.QThread] = None, notification_signal: Optional[QtCore.Signal] = None, pause_signal: Optional[QtCore.Signal] = None, @@ -70,6 +71,7 @@ class GeneralData(): :param include_mp123zne: if mass position channels 1,2,3 are requested :param include_mp456uvw: if mass position channels 4,5,6 are requested :param rt130_waveform_data_req: flag for RT130 to read waveform data + :param rt130_log_files: list of paths to log files chosen by the user :param creator_thread: the thread the current DataTypeModel instance is being created in. If None, the DataTypeModel instance is being created in the main thread @@ -91,6 +93,7 @@ class GeneralData(): self.include_mp123zne = include_mp123zne self.include_mp456uvw = include_mp456uvw self.rt130_waveform_data_req = rt130_waveform_data_req + self.rt130_log_files = rt130_log_files self.on_unittest = on_unittest if creator_thread is None: err_msg = ( diff --git a/sohstationviewer/view/main_window.py b/sohstationviewer/view/main_window.py index 5b52a4d45..07ee57af9 100755 --- a/sohstationviewer/view/main_window.py +++ b/sohstationviewer/view/main_window.py @@ -85,6 +85,10 @@ class MainWindow(QtWidgets.QMainWindow, UIMainWindow): """ self.selected_rt130_paths: List[str] = [] """ + rt130_log_files: list of log files that are read + """ + self.rt130_log_files: List[Path] = [] + """ data_type: str - type of data set """ self.data_type: str = 'Unknown' @@ -492,7 +496,11 @@ class MainWindow(QtWidgets.QMainWindow, UIMainWindow): self.list_of_dir = [''] self.selected_rt130_paths = [] root_dir = Path(self.curr_dir_line_edit.text()) - if self.rt130_das_dict != {}: + if self.log_checkbox.isChecked(): + for item in self.open_files_list.selectedItems(): + self.rt130_log_files.append(Path(item.file_path)) + self.data_type = 'RT130' + elif self.rt130_das_dict != {}: # create selected_rt130_paths from the selected rt130 das names for item in self.open_files_list.selectedItems(): # each item.file_path is a rt130 das name for this case @@ -636,24 +644,6 @@ class MainWindow(QtWidgets.QMainWindow, UIMainWindow): self.cancel_loading() return - """ - temporary skip check_size for it take too long. - dir_size = sum(get_dir_size(str(dir))[0] for dir in self.dir_names) - if dir_size > constants.BIG_FILE_SIZE: - data_too_big_dialog = QMessageBox() - data_too_big_dialog.setText('Chosen data set is very big. It ' - 'might take a while to finish reading ' - 'and plotting everything.') - data_too_big_dialog.setInformativeText('Do you want to proceed?') - data_too_big_dialog.setStandardButtons(QMessageBox.Yes | - QMessageBox.Abort) - data_too_big_dialog.setDefaultButton(QMessageBox.Abort) - data_too_big_dialog.setIcon(QMessageBox.Question) - ret = data_too_big_dialog.exec() - if ret == QMessageBox.Abort: - self.cancel_loading() - return - """ self.req_soh_chans = self.get_requested_soh_chan() if self.req_soh_chans is None: self.cancel_loading() @@ -689,7 +679,8 @@ class MainWindow(QtWidgets.QMainWindow, UIMainWindow): read_end=self.end_tm, include_mp123=self.mass_pos_123zne_check_box.isChecked(), include_mp456=self.mass_pos_456uvw_check_box.isChecked(), - rt130_waveform_data_req=rt130_waveform_data_req + rt130_waveform_data_req=rt130_waveform_data_req, + rt130_log_files=self.rt130_log_files ) self.data_loader.worker.finished.connect(self.data_loaded) -- GitLab