SwapStation_Dashboard/ui/styles.py

218 lines
9.5 KiB
Python

# --- Dynamic Theme Stylesheets ---
def get_light_theme_styles(scale=1.0):
log_font_size = max(10, int(11 * scale))
button_font_size = max(7, int(10 * scale))
return f"""
QMainWindow, QWidget {{
background-color: #f0f0f0;
color: #000;
}}
#LogPanel {{
font-family: "Courier New", Consolas, monospace;
font-size: {log_font_size}pt;
background-color: #212121;
color: #eceff1;
border: 1px solid #455a64;
}}
QGroupBox {{
font-family: Arial;
border: 1px solid #4a4a4a;
border-radius: {int(8 * scale)}px;
margin-top: {int(6 * scale)}px;
}}
QGroupBox::title {{
subcontrol-origin: margin;
subcontrol-position: top center;
padding: 0 {int(10 * scale)}px;
color: #000;
}}
QTabWidget::pane {{ border-top: 2px solid #c8c8c8; }}
QTabBar::tab {{
background: #e1e1e1; border: 1px solid #c8c8c8;
padding: {int(6 * scale)}px {int(15 * scale)}px;
border-top-left-radius: {int(4 * scale)}px; border-top-right-radius: {int(4 * scale)}px;
}}
QTabBar::tab:selected {{ background: #f0f0f0; border-bottom-color: #f0f0f0; }}
QFormLayout::label {{ color: #000; padding-top: {int(3 * scale)}px; }}
QLineEdit, QPlainTextEdit, QComboBox {{
background-color: #fff; border: 1px solid #c8c8c8;
border-radius: {int(4 * scale)}px; padding: {int(4 * scale)}px;
font-size: {max(7, int(9 * scale))}pt;
}}
QLineEdit:read-only {{ background-color: #e9e9e9; }}
QPushButton {{
background-color: #e1e1e1; border: 1px solid #c8c8c8;
padding: {int(5 * scale)}px {int(10 * scale)}px;
border-radius: {int(4 * scale)}px;
}}
QPushButton:hover {{ background-color: #dcdcdc; }}
QPushButton:pressed {{ background-color: #c8c8c8; }}
#RefreshButton, #ResetButton {{
padding: {int(6 * scale)}px {int(16 * scale)}px;
font-size: {button_font_size * 1.3}pt;
font-weight: bold;
border-radius: {int(4*scale)}px;
}}
#RefreshButton {{
background-color: #2e7d32; /* A slightly darker green */
}}
#ResetButton {{
background-color: #c62828; /* A slightly darker red */
}}
#ChamberOpenDoorButton, #ChamberChgOnButton, #ChamberChgOffButton {{
padding: {int(8 * scale)}px;
font-size: {button_font_size}pt;
font-weight: bold;
border-radius: {int(4*scale)}px;
}}
#ChamberOpenDoorButton {{ background-color: #E1E1E1; }}
#ChamberChgOnButton {{ background-color: #E1E1E1; }}
#ChamberChgOffButton {{ background-color: #E1E1E1; }}
#ChamberOpenDoorButton:hover {{ background-color: #3498DB; }}
#ChamberChgOnButton:hover {{ background-color: #229954; }}
#ChamberChgOffButton:hover {{ background-color: #c0392b; }}
QPushButton:disabled {{ background-color: #d3d3d3; color: #a0a0a0; }}
#ConnectButton, #DisconnectButton {{
padding: {int(6 * scale)}px {int(16 * scale)}px;
font-size: {button_font_size}pt;
font-weight: bold;
border-radius: {int(4 * scale)}px;
color: white;
}}
#ConnectButton {{ background-color: #27ae60; }} /* Green */
#DisconnectButton {{ background-color: #c0392b; }} /* Red */
#ConnectButton:hover {{ background-color: #52be80; }}
#DisconnectButton:hover {{ background-color: #cd6155; }}
#ConnectButton:pressed {{ background-color: #52be80; }}
#DisconnectButton:pressed {{ background-color: #cd6155; }}
#ConnectButton:disabled, #DisconnectButton:disabled {{
background-color: #546e7a;
color: #90a4ae;
}}
#RefreshButton, #StartSwapButton {{ background-color: #27ae60; color: white; border: none; }}
#RefreshButton:hover, #StartSwapButton:hover {{ background-color: #229954; }}
#ResetButton, #AbortSwapButton {{ background-color: #c0392b; color: white; border: none; }}
#ResetButton:hover, #AbortSwapButton:hover {{ background-color: #c0392b; }}
#SendAudioButton {{ background-color: #3498db; color: white; border: none; font-size: {max(10, int(14 * scale))}px; }}
#SendAudioButton:hover {{ background-color: #2980b9; }}
QLabel[status="present"] {{ background-color: #2ecc71; color: white; border-radius: {int(4*scale)}px; padding: {int(3*scale)}px; }}
QLabel[status="absent"] {{ background-color: #e74c3c; color: white; border-radius: {int(4*scale)}px; padding: {int(3*scale)}px; }}
QLabel[alarm="active"] {{ background-color: #e74c3c; color: white; font-weight: bold; border-radius: {int(4*scale)}px; padding: {int(2*scale)}px; }}
QLabel[alarm="inactive"] {{ background-color: transparent; color: black; }}
QGroupBox#ChamberWidget {{ border: 2px solid #3498db; }}
"""
def get_dark_theme_styles(scale=1.0):
log_font_size = max(10, int(11 * scale))
button_font_size = max(7, int(10 * scale))
return f"""
QMainWindow, QWidget {{ background-color: #2b2b2b; color: #f0f0f0; }}
#LogPanel {{
font-family: "Courier New", Consolas, monospace;
font-size: {log_font_size}pt;
background-color: #212121;
color: #eceff1;
border: 1px solid #455a64;
}}
QGroupBox {{
font-family: Arial; border: 1px solid #4a4a4a;
border-radius: {int(8 * scale)}px; margin-top: {int(6 * scale)}px;
}}
QGroupBox::title {{ subcontrol-origin: margin; subcontrol-position: top center; padding: 0 {int(10 * scale)}px; color: #f0f0f0; }}
QTabWidget::pane {{ border-top: 2px solid #4a4a4a; }}
QTabBar::tab {{
background: #3c3c3c; border: 1px solid #4a4a4a; color: #f0f0f0;
padding: {int(6 * scale)}px {int(15 * scale)}px;
border-top-left-radius: {int(4 * scale)}px; border-top-right-radius: {int(4 * scale)}px;
}}
QTabBar::tab:selected {{ background: #2b2b2b; border-bottom-color: #2b2b2b; }}
QFormLayout::label {{ color: #f0f0f0; padding-top: {int(3 * scale)}px; }}
QLineEdit, QPlainTextEdit, QComboBox {{
background-color: #3c3c3c; border: 1px solid #4a4a4a;
border-radius: {int(4 * scale)}px; padding: {int(4 * scale)}px; color: #f0f0f0;
font-size: {max(7, int(9 * scale))}pt;
}}
QLineEdit:read-only {{ background-color: #333333; }}
QPushButton {{
background-color: #555555; border: 1px solid #4a4a4a;
padding: {int(5 * scale)}px {int(10 * scale)}px;
border-radius: {int(4 * scale)}px; color: #f0f0f0;
}}
QPushButton:hover {{ background-color: #6a6a6a; }}
QPushButton:pressed {{ background-color: #4a4a4a; }}
QPushButton:disabled {{ background-color: #404040; color: #888888; }}
#RefreshButton, #ResetButton {{
padding: {int(6 * scale)}px {int(16 * scale)}px;
font-size: {button_font_size * 1.3}pt;
font-weight: bold;
border-radius: {int(4*scale)}px;
}}
#RefreshButton {{
background-color: #2e7d32; /* A slightly darker green */
}}
#ResetButton {{
background-color: #c62828; /* A slightly darker red */
}}
#ChamberOpenDoorButton, #ChamberChgOnButton, #ChamberChgOffButton {{
padding: {int(8 * scale)}px;
font-size: {button_font_size}pt;
font-weight: bold;
border-radius: {int(4*scale)}px;
}}
#ChamberOpenDoorButton {{ background-color: #3C3C3C; }}
#ChamberChgOnButton {{ background-color: #3C3C3C; }}
#ChamberChgOffButton {{ background-color: #3C3C3C; }}
#ChamberOpenDoorButton:hover {{ background-color: #607d8b; }}
#ChamberChgOnButton:hover {{ background-color: #52be80; }}
#ChamberChgOffButton:hover {{ background-color: #cd6155; }}
#ConnectButton, #DisconnectButton {{
padding: {int(6 * scale)}px {int(16 * scale)}px;
font-size: {button_font_size}pt;
font-weight: bold;
border-radius: {int(4*scale)}px;
color: white;
}}
#ConnectButton {{ background-color: #27ae60; }} /* Green */
#DisconnectButton {{ background-color: #c0392b; }} /* Red */
#ConnectButton:hover {{ background-color: #52be80; }}
#DisconnectButton:hover {{ background-color: #cd6155; }}
#ConnectButton:pressed {{ background-color: #52be80; }}
#DisconnectButton:pressed {{ background-color: #cd6155; }}
#ConnectButton:disabled, #DisconnectButton:disabled {{
background-color: #546e7a;
color: #90a4ae;
}}
#RefreshButton, #StartSwapButton {{ background-color: #27ae60; color: white; border: none; }}
#RefreshButton:hover, #StartSwapButton:hover {{ background-color: #52be80; }}
#ResetButton, #AbortSwapButton {{ background-color: #c0392b; color: white; border: none; }}
#ResetButton:hover, #AbortSwapButton:hover {{ background-color: #cd6155; }}
#SendAudioButton {{ background-color: #3498db; color: white; border: none; font-size: {max(10, int(14 * scale))}px; }}
#SendAudioButton:hover {{ background-color: #5dade2; }}
QLabel[status="present"] {{ background-color: #2ecc71; color: white; border-radius: {int(4*scale)}px; padding: {int(3*scale)}px; }}
QLabel[status="absent"] {{ background-color: #e74c3c; color: white; border-radius: {int(4*scale)}px; padding: {int(3*scale)}px; }}
QLabel[alarm="active"] {{ background-color: #e74c3c; color: white; font-weight: bold; border-radius: {int(4*scale)}px; padding: {int(2*scale)}px; }}
QLabel[alarm="inactive"] {{ background-color: transparent; color: #f0f0f0; }}
QGroupBox#ChamberWidget {{ border: 2px solid #3498db; }}
"""