forked from masonhuang/KNEO-Academy
93 lines
3.1 KiB
Python
93 lines
3.1 KiB
Python
from PyQt5.QtWidgets import QWidget, QVBoxLayout, QHBoxLayout, QPushButton, QLabel
|
|
from PyQt5.QtCore import Qt, pyqtSignal
|
|
from PyQt5.QtGui import QPixmap, QFont
|
|
import os
|
|
from src.config import UXUI_ASSETS, WINDOW_SIZE, BACKGROUND_COLOR
|
|
|
|
class SelectionScreen(QWidget):
|
|
# Signals for navigation
|
|
open_utilities = pyqtSignal()
|
|
open_demo_app = pyqtSignal()
|
|
|
|
def __init__(self, parent=None):
|
|
super().__init__(parent)
|
|
self.init_ui()
|
|
|
|
def init_ui(self):
|
|
# Basic window setup
|
|
self.setGeometry(100, 100, *WINDOW_SIZE)
|
|
self.setStyleSheet(f"background-color: {BACKGROUND_COLOR};")
|
|
|
|
# Main layout
|
|
layout = QVBoxLayout(self)
|
|
|
|
# Logo
|
|
logo_label = QLabel(self)
|
|
logo_path = os.path.join(UXUI_ASSETS, "Assets_png/kneron_logo.png")
|
|
if os.path.exists(logo_path):
|
|
logo_pixmap = QPixmap(logo_path)
|
|
logo_label.setPixmap(logo_pixmap)
|
|
logo_label.setAlignment(Qt.AlignCenter)
|
|
layout.addWidget(logo_label)
|
|
|
|
# Title
|
|
title_label = QLabel("Kneron Academy", self)
|
|
title_label.setAlignment(Qt.AlignCenter)
|
|
title_label.setFont(QFont("Arial", 24, QFont.Bold))
|
|
layout.addWidget(title_label)
|
|
|
|
# Subtitle
|
|
subtitle_label = QLabel("Please select an option to continue", self)
|
|
subtitle_label.setAlignment(Qt.AlignCenter)
|
|
subtitle_label.setFont(QFont("Arial", 14))
|
|
layout.addWidget(subtitle_label)
|
|
|
|
# Add some space
|
|
layout.addSpacing(40)
|
|
|
|
# Button container
|
|
button_container = QWidget(self)
|
|
button_layout = QHBoxLayout(button_container)
|
|
button_layout.setContentsMargins(50, 0, 50, 0)
|
|
|
|
# Utilities button
|
|
utilities_button = QPushButton("Utilities", self)
|
|
utilities_button.setMinimumHeight(80)
|
|
utilities_button.setFont(QFont("Arial", 14))
|
|
utilities_button.setStyleSheet("""
|
|
QPushButton {
|
|
background-color: #1E88E5;
|
|
color: white;
|
|
border-radius: 8px;
|
|
padding: 10px;
|
|
}
|
|
QPushButton:hover {
|
|
background-color: #1976D2;
|
|
}
|
|
""")
|
|
utilities_button.clicked.connect(self.open_utilities.emit)
|
|
|
|
# Demo App button
|
|
demo_button = QPushButton("Demo App", self)
|
|
demo_button.setMinimumHeight(80)
|
|
demo_button.setFont(QFont("Arial", 14))
|
|
demo_button.setStyleSheet("""
|
|
QPushButton {
|
|
background-color: #43A047;
|
|
color: white;
|
|
border-radius: 8px;
|
|
padding: 10px;
|
|
}
|
|
QPushButton:hover {
|
|
background-color: #388E3C;
|
|
}
|
|
""")
|
|
demo_button.clicked.connect(self.open_demo_app.emit)
|
|
|
|
# Add buttons to layout
|
|
button_layout.addWidget(utilities_button)
|
|
button_layout.addWidget(demo_button)
|
|
|
|
layout.addWidget(button_container)
|
|
layout.addStretch(1) # Push everything up
|