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

small ui improvements: added colour to buttons

parent 8b140465
No related branches found
No related tags found
1 merge request!8enhanced UI: improved styling for main window, tabs, and controls; updated...
from PyQt6.QtWidgets import (QWidget, QVBoxLayout, QHBoxLayout, from PyQt6.QtWidgets import (QWidget, QVBoxLayout, QHBoxLayout,
QGroupBox, QCheckBox, QMessageBox, QPushButton, QGroupBox, QCheckBox, QMessageBox, QPushButton,
QProgressBar) QProgressBar)
from PyQt6.QtCore import Qt, QThread, pyqtSignal from PyQt6.QtCore import Qt, QThread, pyqtSignal, QTimer
import os import os
import sys import sys
...@@ -149,7 +149,10 @@ class SimpleTab(QWidget): ...@@ -149,7 +149,10 @@ class SimpleTab(QWidget):
self.depth.hide() self.depth.hide()
self.material.hide() self.material.hide()
self.edge_net.hide() self.edge_net.hide()
self.file_selected = False
self.flash_timer = QTimer(self)
self.flash_timer.timeout.connect(self.toggle_flash)
self.setup_ui() self.setup_ui()
def setup_ui(self): def setup_ui(self):
...@@ -165,15 +168,18 @@ class SimpleTab(QWidget): ...@@ -165,15 +168,18 @@ class SimpleTab(QWidget):
("Status:", "Ready") ("Status:", "Ready")
] ]
self.info_group, self.info_labels = create_info_group("Information", info_rows) self.info_group, self.info_labels = create_info_group("Information", info_rows)
self.info_group.setStyleSheet("QGroupBox { font-weight: bold; }")
controls_layout.addWidget(self.info_group) controls_layout.addWidget(self.info_group)
# Options # Options
options_layout = QHBoxLayout() options_layout = QHBoxLayout()
self.include_top_check = QCheckBox("Include Top in Mesh") self.include_top_check = QCheckBox("Include Top in Mesh")
self.include_top_check.setStyleSheet("QCheckBox { margin: 5px; }")
options_layout.addWidget(self.include_top_check) options_layout.addWidget(self.include_top_check)
self.shift_image_check = QCheckBox("Shift Input Image") self.shift_image_check = QCheckBox("Shift Input Image")
self.shift_image_check.setStyleSheet("QCheckBox { margin: 5px; }")
options_layout.addWidget(self.shift_image_check) options_layout.addWidget(self.shift_image_check)
controls_layout.addLayout(options_layout) controls_layout.addLayout(options_layout)
...@@ -183,18 +189,44 @@ class SimpleTab(QWidget): ...@@ -183,18 +189,44 @@ class SimpleTab(QWidget):
self.progress_bar.setMinimum(0) self.progress_bar.setMinimum(0)
self.progress_bar.setMaximum(0) # Makes it an indefinite progress bar self.progress_bar.setMaximum(0) # Makes it an indefinite progress bar
self.progress_bar.hide() # Hidden by default self.progress_bar.hide() # Hidden by default
self.progress_bar.setStyleSheet("""
QProgressBar {
border: 2px solid grey;
border-radius: 5px;
text-align: center;
}
QProgressBar::chunk {
background-color: #05B8CC;
width: 20px;
}
""")
controls_layout.addWidget(self.progress_bar) controls_layout.addWidget(self.progress_bar)
# Buttons # Buttons
self.run_pipeline_btn = QPushButton("Run Pipeline") self.run_pipeline_btn = QPushButton("Run Pipeline")
self.run_pipeline_btn.clicked.connect(self.run_full_pipeline) self.run_pipeline_btn.clicked.connect(self.run_full_pipeline)
self.run_pipeline_btn.setEnabled(False) # Disabled by default self.run_pipeline_btn.setEnabled(False) # Disabled by default
self.run_pipeline_btn.setStyleSheet("""
QPushButton {
margin: 5px;
padding: 5px;
}
QPushButton:enabled {
background-color: green;
color: white;
}
QPushButton:disabled {
background-color: red;
color: white;
}
""")
buttons_layout = QHBoxLayout() buttons_layout = QHBoxLayout()
select_btn = QPushButton("Select Input Image") self.select_btn = QPushButton("Select Input Image")
select_btn.clicked.connect(self.handle_file_select) self.select_btn.clicked.connect(self.handle_file_select)
self.select_btn.setStyleSheet("QPushButton { margin: 5px; padding: 5px; }")
buttons_layout.addWidget(select_btn) buttons_layout.addWidget(self.select_btn)
buttons_layout.addWidget(self.run_pipeline_btn) buttons_layout.addWidget(self.run_pipeline_btn)
controls_layout.addLayout(buttons_layout) controls_layout.addLayout(buttons_layout)
...@@ -202,19 +234,56 @@ class SimpleTab(QWidget): ...@@ -202,19 +234,56 @@ class SimpleTab(QWidget):
# Status section # Status section
status_group, self.status_text = create_group_with_text("Pipeline Status", 150) status_group, self.status_text = create_group_with_text("Pipeline Status", 150)
status_group.setStyleSheet("""
QGroupBox {
font-weight: bold;
border: 2px solid grey;
border-radius: 5px;
margin-top: 10px;
}
QLabel {
margin: 5px;
}
""")
layout.addWidget(status_group) layout.addWidget(status_group)
# Preview section # Preview section
preview_group = QGroupBox("Preview") preview_group = QGroupBox("Preview")
preview_group.setStyleSheet("""
QGroupBox {
font-weight: bold;
border: 2px solid grey;
border-radius: 5px;
margin-top: 10px;
}
""")
preview_layout = QHBoxLayout(preview_group) preview_layout = QHBoxLayout(preview_group)
input_group, self.input_preview = create_preview_group("Input Image") input_group, self.input_preview = create_preview_group("Input Image")
output_group, self.output_preview = create_preview_group("Current Output") output_group, self.output_preview = create_preview_group("Current Output")
input_group.setStyleSheet("""
QGroupBox {
font-weight: bold;
border: 1px solid grey;
border-radius: 5px;
margin: 5px;
}
""")
output_group.setStyleSheet("""
QGroupBox {
font-weight: bold;
border: 1px solid grey;
border-radius: 5px;
margin: 5px;
}
""")
preview_layout.addWidget(input_group) preview_layout.addWidget(input_group)
preview_layout.addWidget(output_group) preview_layout.addWidget(output_group)
layout.addWidget(preview_group) layout.addWidget(preview_group)
# Start flashing if no file is selected
self.start_flashing()
def handle_file_select(self): def handle_file_select(self):
file_path = select_file( file_path = select_file(
...@@ -239,6 +308,21 @@ class SimpleTab(QWidget): ...@@ -239,6 +308,21 @@ class SimpleTab(QWidget):
self.depth.depth_input_path = file_path self.depth.depth_input_path = file_path
self.material.input_file_path = file_path self.material.input_file_path = file_path
# self.edge_net.input_path = file_path # edgenet have default input path # self.edge_net.input_path = file_path # edgenet have default input path
self.file_selected = True
self.flash_timer.stop()
self.select_btn.setStyleSheet("QPushButton { margin: 5px; padding: 5px; }")
def start_flashing(self):
if not self.file_selected:
self.flash_timer.start(1000) # Flash every 1000 milliseconds
def toggle_flash(self):
current_style = self.select_btn.styleSheet()
if "background-color: DarkOrange;" in current_style:
self.select_btn.setStyleSheet("QPushButton { margin: 5px; padding: 5px; }")
else:
self.select_btn.setStyleSheet("QPushButton { margin: 5px; padding: 5px; background-color: DarkOrange; }")
def run_full_pipeline(self): def run_full_pipeline(self):
if not self.input_path: if not self.input_path:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment