forked from Support/sp-hydra-veil-gui
Restyle the error prompts to a goth punk look, while still feeling corporate
This commit is contained in:
parent
8b1265d0d9
commit
fa50ea2e79
2 changed files with 89 additions and 25 deletions
|
|
@ -1,6 +1,11 @@
|
||||||
from typing import Optional, Callable, Any
|
from gui.v2.ui.styles.css.error_css import GOTHIC_DARK_THEME, CORPORATE_PUNK_DYING_ROT, get_message_style
|
||||||
from PyQt6.QtWidgets import QDialog, QVBoxLayout, QHBoxLayout, QLabel, QPushButton, QApplication
|
|
||||||
|
from PyQt6.QtWidgets import (
|
||||||
|
QDialog, QVBoxLayout, QHBoxLayout, QLabel,
|
||||||
|
QPushButton, QScrollArea, QWidget, QApplication, QFrame
|
||||||
|
)
|
||||||
from PyQt6.QtCore import Qt
|
from PyQt6.QtCore import Qt
|
||||||
|
from typing import Optional, Callable, Any
|
||||||
|
|
||||||
class ErrorPopup(QDialog):
|
class ErrorPopup(QDialog):
|
||||||
def __init__(
|
def __init__(
|
||||||
|
|
@ -26,26 +31,8 @@ class ErrorPopup(QDialog):
|
||||||
self.setFixedSize(400, 300)
|
self.setFixedSize(400, 300)
|
||||||
self.setModal(True)
|
self.setModal(True)
|
||||||
|
|
||||||
# Dark Theme Styling
|
# Gothic Dark Theme Styling (Applied once here, covers all children)
|
||||||
self.setStyleSheet("""
|
self.setStyleSheet(GOTHIC_DARK_THEME)
|
||||||
QDialog {
|
|
||||||
background-color: #1a1a1a;
|
|
||||||
border-radius: 20px;
|
|
||||||
}
|
|
||||||
QLabel {
|
|
||||||
color: #33ff33;
|
|
||||||
font-size: 24px;
|
|
||||||
background: transparent;
|
|
||||||
border: none;
|
|
||||||
}
|
|
||||||
QPushButton {
|
|
||||||
color: white;
|
|
||||||
font-size: 20px;
|
|
||||||
border-radius: 10px;
|
|
||||||
padding: 10px;
|
|
||||||
min-height: 50px;
|
|
||||||
}
|
|
||||||
""")
|
|
||||||
|
|
||||||
# Layout setup
|
# Layout setup
|
||||||
main_layout = QVBoxLayout()
|
main_layout = QVBoxLayout()
|
||||||
|
|
@ -56,7 +43,16 @@ class ErrorPopup(QDialog):
|
||||||
self.message_label = QLabel(message)
|
self.message_label = QLabel(message)
|
||||||
self.message_label.setAlignment(Qt.AlignmentFlag.AlignCenter)
|
self.message_label.setAlignment(Qt.AlignmentFlag.AlignCenter)
|
||||||
self.message_label.setWordWrap(True)
|
self.message_label.setWordWrap(True)
|
||||||
main_layout.addWidget(self.message_label)
|
|
||||||
|
# Blindly apply the CSS returned by the helper
|
||||||
|
self.message_label.setStyleSheet(get_message_style(message))
|
||||||
|
|
||||||
|
# SCROLL AREA
|
||||||
|
scroll = QScrollArea()
|
||||||
|
scroll.setWidgetResizable(True)
|
||||||
|
scroll.setWidget(self.message_label)
|
||||||
|
|
||||||
|
main_layout.addWidget(scroll)
|
||||||
|
|
||||||
if choice:
|
if choice:
|
||||||
# BUTTON LAYOUT for Yes/No
|
# BUTTON LAYOUT for Yes/No
|
||||||
|
|
@ -76,8 +72,9 @@ class ErrorPopup(QDialog):
|
||||||
main_layout.addLayout(button_layout)
|
main_layout.addLayout(button_layout)
|
||||||
else:
|
else:
|
||||||
# OK button
|
# OK button
|
||||||
ok_btn = QPushButton("OK")
|
ok_btn = QPushButton("✓ OK")
|
||||||
ok_btn.setStyleSheet("background-color: #1b4d1b;")
|
ok_btn.setStyleSheet(CORPORATE_PUNK_DYING_ROT)
|
||||||
|
|
||||||
ok_btn.clicked.connect(self.accept) # Closes the dialog
|
ok_btn.clicked.connect(self.accept) # Closes the dialog
|
||||||
main_layout.addWidget(ok_btn)
|
main_layout.addWidget(ok_btn)
|
||||||
|
|
||||||
|
|
|
||||||
67
gui/v2/ui/styles/css/error_css.py
Normal file
67
gui/v2/ui/styles/css/error_css.py
Normal file
|
|
@ -0,0 +1,67 @@
|
||||||
|
|
||||||
|
|
||||||
|
def get_message_style(message: str):
|
||||||
|
"""Returns the Gothic Dark CSS for the label based on text length."""
|
||||||
|
# Determine font size: 24px for short messages, 16px for long ones
|
||||||
|
font_size = 24 if len(message) < 150 else 16
|
||||||
|
|
||||||
|
return f"""
|
||||||
|
QLabel {{
|
||||||
|
color: #33ff33;
|
||||||
|
font-size: {font_size}px;
|
||||||
|
background: transparent;
|
||||||
|
border: none;
|
||||||
|
font-family: 'Georgia', serif;
|
||||||
|
}}
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
GOTHIC_DARK_THEME = """
|
||||||
|
QDialog {
|
||||||
|
background-color: #000000;
|
||||||
|
border-radius: 20px;
|
||||||
|
}
|
||||||
|
QScrollArea {
|
||||||
|
background-color: #000000;
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
QLabel {
|
||||||
|
color: #33ff33;
|
||||||
|
font-size: 16px;
|
||||||
|
background: transparent;
|
||||||
|
border: none;
|
||||||
|
font-family: 'Georgia', serif;
|
||||||
|
}
|
||||||
|
QPushButton {
|
||||||
|
color: white;
|
||||||
|
font-size: 20px;
|
||||||
|
border-radius: 10px;
|
||||||
|
padding: 10px;
|
||||||
|
min-height: 50px;
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
CORPORATE_PUNK_DYING_ROT = """
|
||||||
|
QPushButton {
|
||||||
|
background-color: #0a0d0a; /* Deep, muddy 'decayed earth' black */
|
||||||
|
color: #33ff33; /* The forced, sterile corporate neon */
|
||||||
|
border: 2px solid #1a331a; /* Dull, corroded green border */
|
||||||
|
border-radius: 4px; /* Sharper edges feel more industrial/corporate */
|
||||||
|
font-family: 'Georgia', serif;
|
||||||
|
font-weight: bold;
|
||||||
|
font-size: 18px;
|
||||||
|
padding: 10px 20px;
|
||||||
|
min-height: 50px;
|
||||||
|
}
|
||||||
|
QPushButton:hover {
|
||||||
|
background-color: #151a15; /* Slightly lighter, like a failing light */
|
||||||
|
color: #ffffff; /* Clinical, sterile white */
|
||||||
|
border: 2px solid #33ff33; /* The neon 'activates' - forced corporate perfection */
|
||||||
|
}
|
||||||
|
QPushButton:pressed {
|
||||||
|
background-color: #050705; /* Sinks back into the void */
|
||||||
|
color: #1a331a; /* Text fades into the rot */
|
||||||
|
border: 2px solid #000000; /* Border vanishes into the dark */
|
||||||
|
}
|
||||||
|
"""
|
||||||
Loading…
Reference in a new issue