From fd87b9f6cff8a5af119e606f070b09a37e4349bf Mon Sep 17 00:00:00 2001 From: mhby1g21 <mhby1g21@soton.ac.uk> Date: Wed, 30 Oct 2024 17:11:05 +0000 Subject: [PATCH] fixed progress bar on run all, init dir on select files, added monodepth rgb and shifted image to clean all, removed cancel operation button and functions as its hard to implement for wsl (not worth it) --- scripts/debug_tool/tabs/edge_net_tab.py | 38 ++++++++++++++++--------- 1 file changed, 24 insertions(+), 14 deletions(-) diff --git a/scripts/debug_tool/tabs/edge_net_tab.py b/scripts/debug_tool/tabs/edge_net_tab.py index 1a86c80..b626af8 100644 --- a/scripts/debug_tool/tabs/edge_net_tab.py +++ b/scripts/debug_tool/tabs/edge_net_tab.py @@ -86,6 +86,10 @@ class EdgeNetTab(QWidget): hlayout.addWidget(right_panel) layout.addLayout(hlayout) + # Initialize progress bar to stopped state + self.progress_bar.setMaximum(100) + self.progress_bar.setValue(0) + self.setLayout(layout) def create_left_panel(self): @@ -203,7 +207,7 @@ class EdgeNetTab(QWidget): def select_input_file(self, file_type): """Handle input file selection""" - file_path = select_file(self, "Select Input File", "Image Files (*.png)") + file_path = select_file(self, "Select Input File", "Image Files (*.png)", initial_dir=self.input_dir) if file_path: self.manual_inputs[file_type] = file_path label = getattr(self, f"{file_type.split('.')[0]}_label") @@ -246,6 +250,15 @@ class EdgeNetTab(QWidget): for directory in directories: clean_directory(directory, self.update_status) + # remove monodepth image copied in 360monodepth if exists + if os.path.exists(os.path.join(self.config_reader.directories['monoDepthDir'], 'rgb.jpg')): + monodepth_image = os.path.join(self.config_reader.directories['monoDepthDir'], 'rgb.jpg') + os.remove(monodepth_image) + # remove shifted image from shifter if exists + if os.path.exists(os.path.join(self.config_reader.directories['scriptDir'], 'shifted_t.png')): + shifted_image = os.path.join(self.config_reader.directories['scriptDir'], 'shifted_t.png') + os.remove(shifted_image) + update_status_indicator(self.edge_status, "Not started") update_status_indicator(self.split_status, "Not started") update_status_indicator(self.flip_status, "Not started") @@ -419,22 +432,15 @@ class EdgeNetTab(QWidget): if self.is_processing: QMessageBox.warning(self, "Warning", "A process is already running!") return - + + self.is_processing = True + self.progress_bar.setMaximum(0) # Set to indeterminate mode + self.current_thread = ProcessThread(self._run_all_steps_process) self.current_thread.finished.connect(self.on_all_steps_complete) self.current_thread.progress.connect(self.update_status) self.current_thread.start() - def cancel_operation(self): - if not self.is_processing: - return - - if show_confirmation_dialog(self, "Confirm Cancel", "Cancel current operation?"): - self.update_status("Cancelling operation...") - if self.current_thread: - self.current_thread.stop() - self.is_processing = False - def _run_all_steps_process(self): """Execute complete pipeline process""" try: @@ -466,11 +472,15 @@ class EdgeNetTab(QWidget): def on_all_steps_complete(self, success, error_message): """Handle complete pipeline completion""" - self.is_processing = False + self.is_processing = False self.progress_bar.setMaximum(100) - + self.progress_bar.setValue(0) + if success: self.update_status("Complete pipeline processing finished successfully!") + update_status_indicator(self.edge_status, "Complete") + update_status_indicator(self.split_status, "Complete") + update_status_indicator(self.flip_status, "Complete") QMessageBox.information(self, "Success", "All processing steps completed successfully!") else: -- GitLab