|
2 | 2 | import shutil |
3 | 3 | from PySide6.QtWidgets import QApplication, QMessageBox |
4 | 4 | from main_window import MainWindow |
| 5 | +import logging |
| 6 | + |
| 7 | +# Define the stylesheet as a string |
| 8 | +STYLESHEET = """ |
| 9 | +/* Hacker Launcher Styles - Black, White, Purple, Blue */ |
| 10 | +QWidget { |
| 11 | + background: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #1a1a1a, stop:1 #2a2a2a); |
| 12 | + color: #ffffff; |
| 13 | + font-family: "Courier New", monospace; |
| 14 | + font-size: 12px; |
| 15 | +} |
| 16 | +QMainWindow, QDialog, QProgressDialog { |
| 17 | + background: #1a1a1a; |
| 18 | +} |
| 19 | +QPushButton { |
| 20 | + background: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #4b0082, stop:1 #6a0dad); |
| 21 | + color: #ffffff; |
| 22 | + border: 2px solid #00b7eb; |
| 23 | + border-radius: 8px; |
| 24 | + padding: 10px 15px; |
| 25 | + font-weight: bold; |
| 26 | +} |
| 27 | +QPushButton:hover { |
| 28 | + background: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #6a0dad, stop:1 #8b0ece); |
| 29 | + border-color: #00d4ff; |
| 30 | +} |
| 31 | +QPushButton:pressed { |
| 32 | + background: #3a0062; |
| 33 | +} |
| 34 | +QTableWidget { |
| 35 | + background: #2a2a2a; |
| 36 | + border: 2px solid #00b7eb; |
| 37 | + border-radius: 8px; |
| 38 | + color: #ffffff; |
| 39 | + gridline-color: #00b7eb; |
| 40 | +} |
| 41 | +QTableWidget::item { |
| 42 | + padding: 8px; |
| 43 | +} |
| 44 | +QTableWidget::item:selected { |
| 45 | + background: #4b0082; |
| 46 | + color: #ffffff; |
| 47 | +} |
| 48 | +QHeaderView::section { |
| 49 | + background: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #4b0082, stop:1 #6a0dad); |
| 50 | + color: #ffffff; |
| 51 | + padding: 8px; |
| 52 | + border: 1px solid #00b7eb; |
| 53 | +} |
| 54 | +QComboBox { |
| 55 | + background: #2a2a2a; |
| 56 | + border: 2px solid #00b7eb; |
| 57 | + color: #ffffff; |
| 58 | + padding: 8px; |
| 59 | + border-radius: 8px; |
| 60 | +} |
| 61 | +QComboBox::drop-down { |
| 62 | + border: none; |
| 63 | +} |
| 64 | +QComboBox QAbstractItemView { |
| 65 | + background: #2a2a2a; |
| 66 | + color: #ffffff; |
| 67 | + selection-background-color: #4b0082; |
| 68 | + border: 2px solid #00b7eb; |
| 69 | +} |
| 70 | +QLineEdit { |
| 71 | + background: #2a2a2a; |
| 72 | + border: 2px solid #00b7eb; |
| 73 | + color: #ffffff; |
| 74 | + padding: 8px; |
| 75 | + border-radius: 8px; |
| 76 | +} |
| 77 | +QLineEdit:focus { |
| 78 | + border-color: #00d4ff; |
| 79 | +} |
| 80 | +QLabel { |
| 81 | + color: #ffffff; |
| 82 | + font-weight: bold; |
| 83 | +} |
| 84 | +QTabWidget::pane { |
| 85 | + border: 2px solid #00b7eb; |
| 86 | + background: #2a2a2a; |
| 87 | + border-radius: 8px; |
| 88 | +} |
| 89 | +QTabBar::tab { |
| 90 | + background: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #4b0082, stop:1 #6a0dad); |
| 91 | + color: #ffffff; |
| 92 | + padding: 12px 24px; |
| 93 | + margin: 4px; |
| 94 | + border-radius: 8px; |
| 95 | + border: 1px solid #00b7eb; |
| 96 | +} |
| 97 | +QTabBar::tab:selected { |
| 98 | + background: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #00b7eb, stop:1 #00d4ff); |
| 99 | + color: #1a1a1a; |
| 100 | + font-weight: bold; |
| 101 | +} |
| 102 | +QTabBar::tab:hover { |
| 103 | + background: #8b0ece; |
| 104 | +} |
| 105 | +QToolTip { |
| 106 | + background: #2a2a2a; |
| 107 | + color: #ffffff; |
| 108 | + border: 1px solid #00b7eb; |
| 109 | +} |
| 110 | +QProgressDialog { |
| 111 | + background: #1a1a1a; |
| 112 | + color: #ffffff; |
| 113 | +} |
| 114 | +QProgressBar { |
| 115 | + background: #2a2a2a; |
| 116 | + border: 2px solid #00b7eb; |
| 117 | + border-radius: 8px; |
| 118 | + text-align: center; |
| 119 | + color: #ffffff; |
| 120 | +} |
| 121 | +QProgressBar::chunk { |
| 122 | + background: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #4b0082, stop:1 #6a0dad); |
| 123 | +} |
| 124 | +""" |
| 125 | + |
5 | 126 | if __name__ == '__main__': |
6 | | - gamescope = '--gamescope' in sys.argv |
7 | | - if gamescope and not shutil.which('gamescope'): |
| 127 | + try: |
| 128 | + gamescope = '--gamescope' in sys.argv |
| 129 | + if gamescope and not shutil.which('gamescope'): |
| 130 | + app = QApplication(sys.argv) |
| 131 | + QMessageBox.critical(None, 'Error', "Gamescope is not installed. Please install it via your package manager (e.g., apt, dnf, pacman).") |
| 132 | + sys.exit(1) |
8 | 133 | app = QApplication(sys.argv) |
9 | | - QMessageBox.critical(None, 'Error', "Gamescope is not installed. Please install it using 'sudo apt install gamescope'.") |
| 134 | + app.setStyleSheet(STYLESHEET) |
| 135 | + window = MainWindow() |
| 136 | + window.show() |
| 137 | + sys.exit(app.exec()) |
| 138 | + except Exception as e: |
| 139 | + logging.error(f"Application error: {e}") |
| 140 | + QMessageBox.critical(None, 'Error', str(e)) |
10 | 141 | sys.exit(1) |
11 | | - app = QApplication(sys.argv) |
12 | | - with open('styles.qss', 'r') as f: |
13 | | - app.setStyleSheet(f.read()) |
14 | | - window = MainWindow() |
15 | | - window.show() |
16 | | - sys.exit(app.exec()) |
|
0 commit comments