diff --git a/scripts/debug_tool/tabs/edge_net_tab.py b/scripts/debug_tool/tabs/edge_net_tab.py index 1a86c80ebc88b463f2221c912c69f1a2438d1ee7..b626af893633a2d6634ed6fc183bd442d4b95802 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: