Skip to content
Snippets Groups Projects
Commit b92a25e5 authored by mhz1g21's avatar mhz1g21
Browse files

Disabled shift image checkbox, enabling this casues pipeline to crash; user...

Disabled shift image checkbox, enabling this casues pipeline to crash; user can now scroll during pipeline execution
parent b8a68835
No related branches found
No related tags found
1 merge request!10fixed gui freezes
......@@ -244,6 +244,9 @@ class SimpleTab(QWidget):
self.shift_image_check.setStyleSheet("QCheckBox { margin: 5px; background-color: #3e3e3e;}")
options_layout.addWidget(self.shift_image_check)
#TODO: FIX THIS, BREAKS THE APP WHEN ENABLED AND PIPELINE IS RUN
self.shift_image_check.setEnabled(False)
# SSC Model selection
ssc_model_layout = QHBoxLayout()
ssc_model_label = QLabel("SSC Model:")
......@@ -343,65 +346,65 @@ 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)
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,13 +521,13 @@ 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)
......@@ -586,7 +589,8 @@ class SimpleTab(QWidget):
self.pipeline_thread.finished.connect(self.pipeline_completed)
# Disable controls while running
self.setEnabled(False)
#self.setEnabled(False)
self.disable_buttons_while_running()
self.progress_bar.setEnabled(True) # Keep progress bar enabled
#TODO: Add model selection for EdgeNet or MDBNet
......@@ -595,7 +599,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()
......@@ -616,4 +620,13 @@ class SimpleTab(QWidget):
self.info_labels["Status:"].setText(message.split("...")[-1] if "..." in message else message)
# Scroll to bottom
scrollbar = self.status_text.verticalScrollBar()
scrollbar.setValue(scrollbar.maximum())
\ No newline at end of file
scrollbar.setValue(scrollbar.maximum())
def disable_buttons_while_running(self):
self.select_btn.setEnabled(False)
self.run_pipeline_btn.setEnabled(False)
self.include_top_check.setEnabled(False)
self.shift_image_check.setEnabled(False)
self.ssc_model_combo.setEnabled(False)
self.distance_reset_btn.setEnabled(False)
self.distance_preview.setEnabled(False)
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment