"""
Game Proton Warning Dialog
Shown to recommend a Proton version for the modlist's game type, mirroring
enb_proton_dialog.py's structure and behavior.
"""
import logging
from pathlib import Path
from PySide6.QtWidgets import (
QDialog, QVBoxLayout, QHBoxLayout, QLabel, QPushButton,
QSizePolicy, QFrame
)
from PySide6.QtCore import Qt, QTimer
from PySide6.QtGui import QIcon
logger = logging.getLogger(__name__)
class GameProtonWarningDialog(QDialog):
"""Dialog recommending a Proton version for the modlist's game."""
def __init__(self, modlist_name: str, warning: dict, game_label: str, parent=None):
super().__init__(parent)
self.modlist_name = modlist_name
self.setWindowTitle("Recommended Proton Version")
self.setWindowModality(Qt.ApplicationModal)
self.setFixedSize(600, 420)
self.setStyleSheet("QDialog { background: #181818; color: #fff; border-radius: 12px; }")
layout = QVBoxLayout(self)
layout.setSpacing(0)
layout.setContentsMargins(30, 30, 30, 30)
card = QFrame(self)
card.setObjectName("gameProtonCard")
card.setFrameShape(QFrame.StyledPanel)
card.setFrameShadow(QFrame.Raised)
card.setFixedWidth(540)
card.setMinimumHeight(280)
card.setMaximumHeight(16777215)
card_layout = QVBoxLayout(card)
card_layout.setSpacing(16)
card_layout.setContentsMargins(28, 28, 28, 28)
card.setStyleSheet(
"QFrame#gameProtonCard { "
" background: #23272e; "
" border-radius: 12px; "
" border: 2px solid #3fb7d6;"
"}"
)
card.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.MinimumExpanding)
title_label = QLabel("Recommended Proton Version")
title_label.setAlignment(Qt.AlignCenter)
title_label.setStyleSheet(
"QLabel { font-size: 24px; font-weight: 700; color: #3fb7d6; margin-bottom: 4px; }"
)
card_layout.addWidget(title_label)
warning_label = QLabel(
f"The following Proton versions are recommended for {game_label}:"
)
warning_label.setAlignment(Qt.AlignCenter)
warning_label.setWordWrap(True)
warning_label.setStyleSheet(
"QLabel { font-size: 14px; color: #e0e0e0; line-height: 1.5; margin-bottom: 12px; padding: 8px; }"
)
card_layout.addWidget(warning_label)
recommended = warning.get("recommended", [])
recommended_html = "
".join(f"- {v}" for v in recommended)
details_text = (
"