fix: sync card_width between GameLibraryManager and MainWindow to prevent config overwrite
All checks were successful
Code check / Check code (push) Successful in 1m19s
All checks were successful
Code check / Check code (push) Successful in 1m19s
Signed-off-by: Boris Yumankulov <boria138@altlinux.org>
This commit is contained in:
@@ -33,6 +33,7 @@ class MainWindowProtocol(Protocol):
|
||||
# Required attributes
|
||||
searchEdit: CustomLineEdit
|
||||
_last_card_width: int
|
||||
card_width: int
|
||||
current_hovered_card: GameCard | None
|
||||
current_focused_card: GameCard | None
|
||||
gamesListWidget: QWidget | None
|
||||
@@ -128,6 +129,8 @@ class GameLibraryManager:
|
||||
self.card_width = self.sizeSlider.value()
|
||||
self.sizeSlider.setToolTip(f"{self.card_width} px")
|
||||
save_card_size(self.card_width)
|
||||
self.main_window.card_width = self.card_width
|
||||
self.main_window._last_card_width = self.card_width
|
||||
for card in self.game_card_cache.values():
|
||||
card.update_card_size(self.card_width)
|
||||
self.update_game_grid()
|
||||
|
@@ -3056,7 +3056,13 @@ class MainWindow(QMainWindow):
|
||||
"""Обработчик закрытия окна: проверяет настройку minimize_to_tray.
|
||||
Если True — сворачиваем в трей (по умолчанию). Иначе — полностью закрываем.
|
||||
"""
|
||||
minimize_to_tray = read_minimize_to_tray() # Импорт read_minimize_to_tray из config_utils
|
||||
minimize_to_tray = read_minimize_to_tray()
|
||||
save_card_size(self.card_width)
|
||||
save_auto_card_size(self.auto_card_width)
|
||||
# Сохраняем настройки окна
|
||||
if not read_fullscreen_config():
|
||||
logger.debug(f"Saving window geometry: {self.width()}x{self.height()}")
|
||||
save_window_geometry(self.width(), self.height())
|
||||
if hasattr(self, 'is_exiting') and self.is_exiting or not minimize_to_tray:
|
||||
# Принудительное закрытие: завершаем процессы и приложение
|
||||
for proc in self.game_processes:
|
||||
@@ -3097,13 +3103,6 @@ class MainWindow(QMainWindow):
|
||||
self.wine_monitor_timer.deleteLater()
|
||||
self.wine_monitor_timer = None
|
||||
|
||||
# Сохраняем настройки окна
|
||||
if not read_fullscreen_config():
|
||||
logger.debug(f"Saving window geometry: {self.width()}x{self.height()}")
|
||||
save_window_geometry(self.width(), self.height())
|
||||
save_card_size(self.card_width)
|
||||
save_auto_card_size(self.auto_card_width)
|
||||
|
||||
event.accept()
|
||||
else:
|
||||
# Сворачиваем в трей вместо закрытия
|
||||
|
Reference in New Issue
Block a user