Create the home page with Admin, Employee, and Exit buttons.
(parent, on_admin_clicked, on_employee_clicked, on_exit_clicked)
| 400 | |
| 401 | |
| 402 | def create_home_page(parent, on_admin_clicked, on_employee_clicked, on_exit_clicked): |
| 403 | """Create the home page with Admin, Employee, and Exit buttons.""" |
| 404 | page, main_layout = create_page_with_header(parent, "Admin Menu") |
| 405 | |
| 406 | # Button frame |
| 407 | button_frame = create_styled_frame(page) |
| 408 | button_frame.setSizePolicy( |
| 409 | QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Expanding |
| 410 | ) |
| 411 | button_layout = QtWidgets.QVBoxLayout(button_frame) |
| 412 | |
| 413 | # Button container |
| 414 | button_container = create_styled_frame( |
| 415 | button_frame, |
| 416 | min_size=(300, 0), |
| 417 | style="background-color: #ffffff; border-radius: 15px; padding: 20px;", |
| 418 | ) |
| 419 | button_container_layout = QtWidgets.QVBoxLayout(button_container) |
| 420 | button_container_layout.setSpacing(15) |
| 421 | |
| 422 | # Buttons |
| 423 | admin_button = create_styled_button(button_container, "Admin") |
| 424 | employee_button = create_styled_button(button_container, "Employee") |
| 425 | exit_button = create_styled_button(button_container, "Exit") |
| 426 | exit_button.setStyleSheet(""" |
| 427 | QPushButton { |
| 428 | background-color: #e74c3c; |
| 429 | color: white; |
| 430 | font-family: 'Segoe UI'; |
| 431 | font-size: 16px; |
| 432 | font-weight: bold; |
| 433 | border-radius: 8px; |
| 434 | padding: 12px; |
| 435 | border: none; |
| 436 | } |
| 437 | QPushButton:hover { |
| 438 | background-color: #c0392b; |
| 439 | } |
| 440 | QPushButton:pressed { |
| 441 | background-color: #992d22; |
| 442 | } |
| 443 | """) |
| 444 | |
| 445 | button_container_layout.addWidget(admin_button) |
| 446 | button_container_layout.addWidget(employee_button) |
| 447 | button_container_layout.addWidget(exit_button) |
| 448 | |
| 449 | button_layout.addWidget( |
| 450 | button_container, 0, QtCore.Qt.AlignHCenter | QtCore.Qt.AlignVCenter |
| 451 | ) |
| 452 | main_layout.addWidget(button_frame) |
| 453 | |
| 454 | # Connect button signals |
| 455 | admin_button.clicked.connect(on_admin_clicked) |
| 456 | employee_button.clicked.connect(on_employee_clicked) |
| 457 | exit_button.clicked.connect(on_exit_clicked) |
| 458 | |
| 459 | return page |
no test coverage detected