|
| 1 | +import sys |
| 2 | +import shutil |
| 3 | +from PySide6.QtWidgets import QApplication, QMessageBox |
| 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 - Console-like with larger fonts */ |
| 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: 16px; |
| 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: 12px; |
| 24 | + padding: 15px 20px; |
| 25 | + font-weight: bold; |
| 26 | + font-size: 18px; |
| 27 | +} |
| 28 | +QPushButton:hover { |
| 29 | + background: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #6a0dad, stop:1 #8b0ece); |
| 30 | + border-color: #00d4ff; |
| 31 | +} |
| 32 | +QPushButton:pressed { |
| 33 | + background: #3a0062; |
| 34 | +} |
| 35 | +QTableWidget { |
| 36 | + background: #2a2a2a; |
| 37 | + border: 2px solid #00b7eb; |
| 38 | + border-radius: 12px; |
| 39 | + color: #ffffff; |
| 40 | + gridline-color: #00b7eb; |
| 41 | + font-size: 18px; |
| 42 | +} |
| 43 | +QTableWidget::item { |
| 44 | + padding: 12px; |
| 45 | +} |
| 46 | +QTableWidget::item:selected { |
| 47 | + background: #4b0082; |
| 48 | + color: #ffffff; |
| 49 | +} |
| 50 | +QHeaderView::section { |
| 51 | + background: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #4b0082, stop:1 #6a0dad); |
| 52 | + color: #ffffff; |
| 53 | + padding: 12px; |
| 54 | + border: 1px solid #00b7eb; |
| 55 | + font-size: 18px; |
| 56 | +} |
| 57 | +QComboBox { |
| 58 | + background: #2a2a2a; |
| 59 | + border: 2px solid #00b7eb; |
| 60 | + color: #ffffff; |
| 61 | + padding: 12px; |
| 62 | + border-radius: 12px; |
| 63 | + font-size: 18px; |
| 64 | +} |
| 65 | +QComboBox::drop-down { |
| 66 | + border: none; |
| 67 | +} |
| 68 | +QComboBox QAbstractItemView { |
| 69 | + background: #2a2a2a; |
| 70 | + color: #ffffff; |
| 71 | + selection-background-color: #4b0082; |
| 72 | + border: 2px solid #00b7eb; |
| 73 | + font-size: 18px; |
| 74 | +} |
| 75 | +QLineEdit { |
| 76 | + background: #2a2a2a; |
| 77 | + border: 2px solid #00b7eb; |
| 78 | + color: #ffffff; |
| 79 | + padding: 12px; |
| 80 | + border-radius: 12px; |
| 81 | + font-size: 18px; |
| 82 | +} |
| 83 | +QLineEdit:focus { |
| 84 | + border-color: #00d4ff; |
| 85 | +} |
| 86 | +QLabel { |
| 87 | + color: #ffffff; |
| 88 | + font-weight: bold; |
| 89 | + font-size: 18px; |
| 90 | +} |
| 91 | +QTabWidget::pane { |
| 92 | + border: 2px solid #00b7eb; |
| 93 | + background: #2a2a2a; |
| 94 | + border-radius: 12px; |
| 95 | +} |
| 96 | +QTabBar::tab { |
| 97 | + background: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #4b0082, stop:1 #6a0dad); |
| 98 | + color: #ffffff; |
| 99 | + padding: 18px 32px; |
| 100 | + margin: 6px; |
| 101 | + border-radius: 12px; |
| 102 | + border: 1px solid #00b7eb; |
| 103 | + font-size: 20px; |
| 104 | +} |
| 105 | +QTabBar::tab:selected { |
| 106 | + background: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #00b7eb, stop:1 #00d4ff); |
| 107 | + color: #1a1a1a; |
| 108 | + font-weight: bold; |
| 109 | +} |
| 110 | +QTabBar::tab:hover { |
| 111 | + background: #8b0ece; |
| 112 | +} |
| 113 | +QToolTip { |
| 114 | + background: #2a2a2a; |
| 115 | + color: #ffffff; |
| 116 | + border: 1px solid #00b7eb; |
| 117 | + font-size: 16px; |
| 118 | +} |
| 119 | +QProgressDialog { |
| 120 | + background: #1a1a1a; |
| 121 | + color: #ffffff; |
| 122 | + font-size: 18px; |
| 123 | +} |
| 124 | +QProgressBar { |
| 125 | + background: #2a2a2a; |
| 126 | + border: 2px solid #00b7eb; |
| 127 | + border-radius: 12px; |
| 128 | + text-align: center; |
| 129 | + color: #ffffff; |
| 130 | + font-size: 18px; |
| 131 | +} |
| 132 | +QProgressBar::chunk { |
| 133 | + background: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #4b0082, stop:1 #6a0dad); |
| 134 | +} |
| 135 | +QCheckBox { |
| 136 | + font-size: 18px; |
| 137 | +} |
| 138 | +QTextEdit { |
| 139 | + font-size: 18px; |
| 140 | +} |
| 141 | +QMenu { |
| 142 | + background: #2a2a2a; |
| 143 | + color: #ffffff; |
| 144 | + border: 2px solid #00b7eb; |
| 145 | + font-size: 18px; |
| 146 | +} |
| 147 | +QMenu::item { |
| 148 | + padding: 12px 24px; |
| 149 | +} |
| 150 | +QMenu::item:selected { |
| 151 | + background: #4b0082; |
| 152 | + color: #ffffff; |
| 153 | +} |
| 154 | +""" |
| 155 | + |
| 156 | +if __name__ == '__main__': |
| 157 | + try: |
| 158 | + gamescope = '--gamescope' in sys.argv |
| 159 | + if gamescope and not shutil.which('gamescope'): |
| 160 | + app = QApplication(sys.argv) |
| 161 | + QMessageBox.critical(None, 'Error', "Gamescope is not installed. Please install it via your package manager (e.g., apt, dnf, pacman).") |
| 162 | + sys.exit(1) |
| 163 | + app = QApplication(sys.argv) |
| 164 | + app.setStyleSheet(STYLESHEET) |
| 165 | + window = MainWindow() |
| 166 | + window.show() |
| 167 | + sys.exit(app.exec()) |
| 168 | + except Exception as e: |
| 169 | + logging.error(f"Application error: {e}") |
| 170 | + QMessageBox.critical(None, 'Error', str(e)) |
| 171 | + sys.exit(1) |
0 commit comments