From b8a68835ee780cf0ddf37b58b5561438e5aaf2f9 Mon Sep 17 00:00:00 2001 From: mhby1g21 <mhby1g21@soton.ac.uk> Date: Wed, 4 Dec 2024 13:01:39 +0000 Subject: [PATCH] commenting out interactable pic section that cause gui freeze --- scripts/simple_tab.py | 138 +++++++++++++++++++++--------------------- 1 file changed, 69 insertions(+), 69 deletions(-) diff --git a/scripts/simple_tab.py b/scripts/simple_tab.py index 0f383df..7bf295a 100644 --- a/scripts/simple_tab.py +++ b/scripts/simple_tab.py @@ -342,66 +342,66 @@ class SimpleTab(QWidget): layout.addWidget(controls_group) - # Image Distance section - self.image_distance_group = QGroupBox("Image Distance") - distance_layout = QVBoxLayout(self.image_distance_group) - info_label = QLabel("Please select two point on the image and input the distance from the camera to that point.") - self.counter_label = QLabel("(0/2)") - self.distance_preview = ClickableLabel() - self.distance_preview.setAlignment(Qt.AlignmentFlag.AlignCenter) - self.counter_label.setAlignment(Qt.AlignmentFlag.AlignBottom | Qt.AlignmentFlag.AlignCenter) - self.points_info_label = QLabel() # Label to display points and distances - self.points_info_label.setAlignment(Qt.AlignmentFlag.AlignTop | Qt.AlignmentFlag.AlignCenter) - self.image_distance_group.setStyleSheet(""" - QGroupBox { - font-weight: bold; - border: 2px solid grey; - border-radius: 20px; - margin-top: 10px; - background-color: #3e3e3e; - padding: 20px; - } - QGroupBox::title { - margin: 10px; - background-color: transparent; - color: white; - } - QLabel { - margin: 5px; - background-color: #3e3e3e; - color: white; - } - """) - # Center the ClickableLabel within its parent layout - distance_preview_layout = QHBoxLayout() - distance_preview_layout.addStretch() - distance_preview_layout.addWidget(self.distance_preview) - distance_preview_layout.addStretch() - - self.distance_reset_btn = QPushButton("Reset Points") - self.distance_reset_btn.clicked.connect(self.distance_preview.clear_points) - self.distance_reset_btn.setFixedSize(150, 40) - self.distance_reset_btn.setStyleSheet(""" - QPushButton { - margin: 5px; - padding: 5px; - border-radius: 10px; - } - """) - distance_btn_layout = QHBoxLayout() - distance_btn_layout.addStretch() - distance_btn_layout.addWidget(self.distance_reset_btn) - distance_btn_layout.addStretch() - - distance_layout.addWidget(info_label) - distance_layout.addLayout(distance_preview_layout) - distance_layout.addWidget(self.points_info_label) - distance_layout.addWidget(self.counter_label) - distance_layout.addWidget(self.distance_reset_btn) - self.image_distance_group.hide() - layout.addWidget(self.image_distance_group) - - self.distance_preview.point_added.connect(self.update_counter_Label) + ## Image Distance section + #self.image_distance_group = QGroupBox("Image Distance") + #distance_layout = QVBoxLayout(self.image_distance_group) + #info_label = QLabel("Please select two point on the image and input the distance from the camera to that point.") + #self.counter_label = QLabel("(0/2)") + #self.distance_preview = ClickableLabel() + #self.distance_preview.setAlignment(Qt.AlignmentFlag.AlignCenter) + #self.counter_label.setAlignment(Qt.AlignmentFlag.AlignBottom | Qt.AlignmentFlag.AlignCenter) + #self.points_info_label = QLabel() # Label to display points and distances + #self.points_info_label.setAlignment(Qt.AlignmentFlag.AlignTop | Qt.AlignmentFlag.AlignCenter) + #self.image_distance_group.setStyleSheet(""" + # QGroupBox { + # font-weight: bold; + # border: 2px solid grey; + # border-radius: 20px; + # margin-top: 10px; + # background-color: #3e3e3e; + # padding: 20px; + # } + # QGroupBox::title { + # margin: 10px; + # background-color: transparent; + # color: white; + # } + # QLabel { + # margin: 5px; + # background-color: #3e3e3e; + # color: white; + # } + #""") + ## Center the ClickableLabel within its parent layout + #distance_preview_layout = QHBoxLayout() + #distance_preview_layout.addStretch() + #distance_preview_layout.addWidget(self.distance_preview) + #distance_preview_layout.addStretch() +# + #self.distance_reset_btn = QPushButton("Reset Points") + #self.distance_reset_btn.clicked.connect(self.distance_preview.clear_points) + #self.distance_reset_btn.setFixedSize(150, 40) + #self.distance_reset_btn.setStyleSheet(""" + # QPushButton { + # margin: 5px; + # padding: 5px; + # border-radius: 10px; + # } + #""") + #distance_btn_layout = QHBoxLayout() + #distance_btn_layout.addStretch() + #distance_btn_layout.addWidget(self.distance_reset_btn) + #distance_btn_layout.addStretch() +# + #distance_layout.addWidget(info_label) + #distance_layout.addLayout(distance_preview_layout) + #distance_layout.addWidget(self.points_info_label) + #distance_layout.addWidget(self.counter_label) + #distance_layout.addWidget(self.distance_reset_btn) + #self.image_distance_group.hide() + #layout.addWidget(self.image_distance_group) +# + #self.distance_preview.point_added.connect(self.update_counter_Label) # Status section status_group, self.status_text = create_group_with_text("Pipeline Status", 300) @@ -518,15 +518,15 @@ class SimpleTab(QWidget): self.update_status(f"Selected input file: {file_path}") update_preview(self.input_preview, file_path, error_callback=self.update_status) - update_preview(self.distance_preview,file_path,max_size=1500) - pixmap = load_and_resize_image(file_path, 1500) - pixmap = convert_cv_to_pixmap(pixmap) - self.distance_preview.setFixedSize(pixmap.size()) - self.image_distance_group.show() - self.update_status("Waiting for distance points...") - self.info_labels["Status:"].setText("Waiting for distance points...") + #update_preview(self.distance_preview,file_path,max_size=1500) + #pixmap = load_and_resize_image(file_path, 1500) + #pixmap = convert_cv_to_pixmap(pixmap) + #self.distance_preview.setFixedSize(pixmap.size()) + #self.image_distance_group.show() + #self.update_status("Waiting for distance points...") + #self.info_labels["Status:"].setText("Waiting for distance points...") # Enable the run pipeline button - #self.run_pipeline_btn.setEnabled(True) + self.run_pipeline_btn.setEnabled(True) # Provide input path to all modules self.shifter.input_file_path = file_path @@ -595,7 +595,7 @@ class SimpleTab(QWidget): #TODO: Add distance points to the pipeline for depth estimation # Get the distance points - self.distance_points = self.distance_preview.get_points() + #self.distance_points = self.distance_preview.get_points() # Start the pipeline self.pipeline_thread.start() -- GitLab