finally made the logo work!
This commit is contained in:
100
mucapy/main.py
100
mucapy/main.py
@@ -6,7 +6,7 @@ from PyQt5.QtWidgets import (QApplication, QMainWindow, QVBoxLayout, QHBoxLayout
|
||||
QWidget, QLabel, QPushButton, QComboBox, QSpinBox,
|
||||
QFileDialog, QMessageBox, QMenu, QAction, QMenuBar,
|
||||
QActionGroup, QSizePolicy, QGridLayout, QGroupBox,
|
||||
QDockWidget, QScrollArea, QToolButton)
|
||||
QDockWidget, QScrollArea, QToolButton, QDialog)
|
||||
from PyQt5.QtCore import Qt, QTimer, QDir, QSize
|
||||
from PyQt5.QtGui import QImage, QPixmap, QIcon, QColor
|
||||
|
||||
@@ -333,6 +333,89 @@ class CollapsibleDock(QDockWidget):
|
||||
self.toggle_button.setIcon(QIcon.fromTheme("arrow-left"))
|
||||
self.collapsed = False
|
||||
|
||||
class AboutWindow(QDialog):
|
||||
def __init__(self, parent=None): # Add parent parameter with default None
|
||||
super().__init__(parent) # Pass parent to QDialog
|
||||
self.setWindowTitle("About Multi-Camera YOLO Detection")
|
||||
self.setWindowIcon(QIcon.fromTheme("help-about"))
|
||||
self.resize(400, 300)
|
||||
|
||||
# Make it modal and stay on top
|
||||
self.setWindowModality(Qt.ApplicationModal)
|
||||
self.setWindowFlags(self.windowFlags() & ~Qt.WindowContextHelpButtonHint)
|
||||
|
||||
layout = QVBoxLayout()
|
||||
layout.setAlignment(Qt.AlignCenter)
|
||||
layout.setSpacing(20)
|
||||
|
||||
# Application icon/logo (placeholder)
|
||||
icon_label = QLabel()
|
||||
icon_label.setPixmap(QIcon.fromTheme("camera-web").pixmap(64, 64))
|
||||
icon_label.setAlignment(Qt.AlignCenter)
|
||||
layout.addWidget(icon_label)
|
||||
|
||||
# Application title
|
||||
title_label = QLabel("MuCaPy - 1")
|
||||
title_label.setStyleSheet("font-size: 18px; font-weight: bold;")
|
||||
title_label.setAlignment(Qt.AlignCenter)
|
||||
layout.addWidget(title_label)
|
||||
|
||||
# Version information
|
||||
version_label = QLabel("Version 1.0")
|
||||
version_label.setAlignment(Qt.AlignCenter)
|
||||
layout.addWidget(version_label)
|
||||
|
||||
# Description
|
||||
desc_label = QLabel(
|
||||
"MuCaPy\n"
|
||||
"Multiple Camera Python\n"
|
||||
"Using CV2"
|
||||
)
|
||||
desc_label.setAlignment(Qt.AlignCenter)
|
||||
desc_label.setWordWrap(True)
|
||||
layout.addWidget(desc_label)
|
||||
|
||||
# Close Button
|
||||
close_btn = QPushButton("Close")
|
||||
close_btn.clicked.connect(self.accept)
|
||||
close_btn.setFixedWidth(100)
|
||||
layout.addWidget(close_btn, alignment=Qt.AlignCenter)
|
||||
|
||||
self.setStyleSheet("""
|
||||
QDialog {
|
||||
background-color: #2D2D2D;
|
||||
color: #DDD;
|
||||
}
|
||||
QLabel {
|
||||
color: #DDD;
|
||||
}
|
||||
QGroupBox {
|
||||
border: 1px solid #555;
|
||||
border-radius: 4px;
|
||||
margin-top: 10px;
|
||||
padding-top: 15px;
|
||||
background-color: #252525;
|
||||
}
|
||||
QGroupBox::title {
|
||||
subcontrol-origin: margin;
|
||||
left: 10px;
|
||||
padding: 0 3px;
|
||||
color: #DDD;
|
||||
}
|
||||
QPushButton {
|
||||
background-color: #3A3A3A;
|
||||
color: #DDD;
|
||||
border: 1px solid #555;
|
||||
border-radius: 4px;
|
||||
padding: 5px;
|
||||
min-width: 80px;
|
||||
}
|
||||
QPushButton:hover {
|
||||
background-color: #4A4A4A;
|
||||
}
|
||||
""")
|
||||
|
||||
self.setLayout(layout)
|
||||
class MainWindow(QMainWindow):
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
@@ -443,15 +526,19 @@ class MainWindow(QMainWindow):
|
||||
self.create_menus()
|
||||
self.init_ui()
|
||||
self.init_timer()
|
||||
|
||||
def show_menu(self):
|
||||
about = AboutWindow(self) # Pass self as parent
|
||||
about.exec_() # Use exec_() for modal dialog
|
||||
|
||||
def create_menus(self):
|
||||
"""Create the menu bar with model and camera menus"""
|
||||
menubar = self.menuBar()
|
||||
|
||||
# File Menu - Continue l8tr
|
||||
# File Menu
|
||||
file_menu = menubar.addMenu('File')
|
||||
|
||||
|
||||
about_action = QAction("About", self)
|
||||
about_action.triggered.connect(self.show_menu)
|
||||
file_menu.addAction(about_action)
|
||||
|
||||
# Model menu
|
||||
model_menu = menubar.addMenu('Model')
|
||||
@@ -470,7 +557,8 @@ class MainWindow(QMainWindow):
|
||||
self.camera_action_group = QActionGroup(self)
|
||||
self.camera_action_group.setExclusive(False)
|
||||
self.populate_camera_menu()
|
||||
|
||||
|
||||
|
||||
def populate_camera_menu(self):
|
||||
"""Populate the camera menu with available cameras"""
|
||||
# Clear existing camera actions (except refresh)
|
||||
|
||||
Reference in New Issue
Block a user