reworked styles to look the same in normal use and gamescope session
All checks were successful
Code and build check / Check code (pull_request) Successful in 1m44s
Code and build check / Build with uv (pull_request) Successful in 59s
Code and build check / Check code (push) Successful in 1m28s
Code and build check / Build with uv (push) Successful in 1m0s

This commit is contained in:
2025-06-21 22:33:03 +07:00
parent 37b108f689
commit fea07e19fe
2 changed files with 88 additions and 46 deletions

View File

@ -53,7 +53,40 @@ class MainWindow(QMainWindow):
def __init__(self):
super().__init__()
# Создаём менеджер тем и читаем, какая тема выбрана
self.theme_manager = ThemeManager()
selected_theme = read_theme_from_config()
self.current_theme_name = selected_theme
try:
self.theme = self.theme_manager.apply_theme(selected_theme)
except FileNotFoundError:
logger.warning(f"Тема '{selected_theme}' не найдена, применяется стандартная тема 'standart'")
self.theme = self.theme_manager.apply_theme("standart")
self.current_theme_name = "standart"
save_theme_to_config("standart")
if not self.theme:
self.theme = default_styles
self.card_width = read_card_size()
self.setWindowTitle("PortProtonQt")
self.setMinimumSize(800, 600)
self.games = []
self.filtered_games = self.games
self.game_processes = []
self.target_exe = None
self.current_running_button = None
self.portproton_location = get_portproton_location()
self.context_menu_manager = ContextMenuManager(
self,
self.portproton_location,
self.theme,
self.loadGames,
self.updateGameGrid
)
QApplication.setStyle("Fusion")
self.setStyleSheet(self.theme.MAIN_WINDOW_STYLE)
self.setAcceptDrops(True)
self.current_exec_line = None
self.currentDetailPage = None
@ -88,41 +121,11 @@ class MainWindow(QMainWindow):
self.legendary_path = os.path.join(self.legendary_config_path, "legendary")
self.downloader = Downloader(max_workers=4)
# Создаём менеджер тем и читаем, какая тема выбрана
self.theme_manager = ThemeManager()
selected_theme = read_theme_from_config()
self.current_theme_name = selected_theme
try:
self.theme = self.theme_manager.apply_theme(selected_theme)
except FileNotFoundError:
logger.warning(f"Тема '{selected_theme}' не найдена, применяется стандартная тема 'standart'")
self.theme = self.theme_manager.apply_theme("standart")
self.current_theme_name = "standart"
save_theme_to_config("standart")
if not self.theme:
self.theme = default_styles
self.card_width = read_card_size()
self.setWindowTitle("PortProtonQt")
self.setMinimumSize(800, 600)
self.games = []
self.filtered_games = self.games
self.game_processes = []
self.target_exe = None
self.current_running_button = None
self.portproton_location = get_portproton_location()
self.context_menu_manager = ContextMenuManager(
self,
self.portproton_location,
self.theme,
self.loadGames,
self.updateGameGrid
)
# Статус-бар
self.setStatusBar(QStatusBar(self))
self.statusBar().setStyleSheet(self.theme.STATUS_BAR_STYLE)
self.progress_bar = QProgressBar()
self.progress_bar.setStyleSheet(self.theme.PROGRESS_BAR_STYLE)
self.progress_bar.setMaximumWidth(200)
self.progress_bar.setTextVisible(True)
self.progress_bar.setVisible(False)
@ -203,8 +206,6 @@ class MainWindow(QMainWindow):
self.restore_state()
self.setStyleSheet(self.theme.MAIN_WINDOW_STYLE)
self.setStyleSheet(self.theme.MESSAGE_BOX_STYLE)
self.input_manager = InputManager(self)
QTimer.singleShot(0, self.loadGames)

View File

@ -108,6 +108,55 @@ CONTEXT_MENU_STYLE = """
}
"""
# ГЛОБАЛЬНЫЙ СТИЛЬ ДЛЯ ОКНА (ФОН), ЛЭЙБЛОВ, КНОПОК
MAIN_WINDOW_STYLE = """
QWidget {
background: #282a33;
}
QLabel {
color: #ffffff;
}
QPushButton {
background: #3f424d;
border: 2px solid rgba(255, 255, 255, 0.01);
border-radius: 10px;
color: #ffffff;
font-size: 16px;
font-family: 'Play';
padding: 8px 16px;
}
QPushButton:hover {
background: #409EFF;
border: 2px solid #409EFF;
}
QPushButton:pressed {
background: #282a33;
}
QPushButton:focus {
border: 2px solid #409EFF;
background-color: #409EFF;
}
"""
# СТИЛЬ ПРОГРЕСС-БАРА
PROGRESS_BAR_STYLE = """
QProgressBar {
color: #ffffff;
background-color: #3f424d;
text-align: center;
}
QProgressBar::chunk {
background-color: #409EFF;
}
"""
# СТИЛЬ СТАТУС-БАРА
STATUS_BAR_STYLE = """
QStatusBar {
color: #ffffff;
}
"""
# СТИЛЬ ШАПКИ ГЛАВНОГО ОКНА
MAIN_WINDOW_HEADER_STYLE = """
QFrame {
@ -133,7 +182,7 @@ TITLE_LABEL_STYLE = """
# СТИЛЬ ОБЛАСТИ НАВИГАЦИИ (КНОПКИ ВКЛАДОК)
NAV_WIDGET_STYLE = """
QWidget {
background: #282a33;
background: transparent;
border: 0px solid;
}
"""
@ -164,16 +213,6 @@ NAV_BUTTON_STYLE = """
}
"""
# ГЛОБАЛЬНЫЙ СТИЛЬ ДЛЯ ОКНА (ФОН) И QLabel
MAIN_WINDOW_STYLE = """
QMainWindow {
background: none;
}
QLabel {
color: #232627;
}
"""
# СТИЛЬ ПОЛЯ ПОИСКА
SEARCH_EDIT_STYLE = """
QLineEdit {
@ -767,8 +806,10 @@ SETTINGS_COMBO_STYLE = f"""
SETTINGS_CHECKBOX_STYLE = f"""
QCheckBox {{
height: 34px;
color: #ffffff;
font-family: 'Play';
font-size: 16px;
}}
QCheckBox::indicator {{
width: 24px;
height: 24px;