feat: hide the games from EGS until after the workout
Signed-off-by: Boris Yumankulov <boria138@altlinux.org>
This commit is contained in:
@ -260,25 +260,19 @@ class MainWindow(QMainWindow):
|
|||||||
self.update_status_message.emit
|
self.update_status_message.emit
|
||||||
)
|
)
|
||||||
elif display_filter == "favorites":
|
elif display_filter == "favorites":
|
||||||
def on_all_games(portproton_games, steam_games, epic_games):
|
def on_all_games(portproton_games, steam_games):
|
||||||
games = [game for game in portproton_games + steam_games + epic_games if game[0] in favorites]
|
games = [game for game in portproton_games + steam_games if game[0] in favorites]
|
||||||
self.games_loaded.emit(games)
|
self.games_loaded.emit(games)
|
||||||
self._load_portproton_games_async(
|
self._load_portproton_games_async(
|
||||||
lambda pg: self._load_steam_games_async(
|
lambda pg: self._load_steam_games_async(
|
||||||
lambda sg: load_egs_games_async(
|
lambda sg: on_all_games(pg, sg)
|
||||||
self.legendary_path,
|
|
||||||
lambda eg: on_all_games(pg, sg, eg),
|
|
||||||
self.downloader,
|
|
||||||
self.update_progress.emit,
|
|
||||||
self.update_status_message.emit
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
def on_all_games(portproton_games, steam_games, epic_games):
|
def on_all_games(portproton_games, steam_games):
|
||||||
seen = set()
|
seen = set()
|
||||||
games = []
|
games = []
|
||||||
for game in portproton_games + steam_games + epic_games:
|
for game in portproton_games + steam_games:
|
||||||
name = game[0]
|
name = game[0]
|
||||||
if name not in seen:
|
if name not in seen:
|
||||||
seen.add(name)
|
seen.add(name)
|
||||||
@ -286,13 +280,7 @@ class MainWindow(QMainWindow):
|
|||||||
self.games_loaded.emit(games)
|
self.games_loaded.emit(games)
|
||||||
self._load_portproton_games_async(
|
self._load_portproton_games_async(
|
||||||
lambda pg: self._load_steam_games_async(
|
lambda pg: self._load_steam_games_async(
|
||||||
lambda sg: load_egs_games_async(
|
lambda sg: on_all_games(pg, sg)
|
||||||
self.legendary_path,
|
|
||||||
lambda eg: on_all_games(pg, sg, eg),
|
|
||||||
self.downloader,
|
|
||||||
self.update_progress.emit,
|
|
||||||
self.update_status_message.emit
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
return []
|
return []
|
||||||
@ -915,7 +903,7 @@ class MainWindow(QMainWindow):
|
|||||||
|
|
||||||
# 3. Games display_filter
|
# 3. Games display_filter
|
||||||
self.filter_keys = ["all", "steam", "portproton", "favorites", "epic"]
|
self.filter_keys = ["all", "steam", "portproton", "favorites", "epic"]
|
||||||
self.filter_labels = [_("all"), "steam", "portproton", _("favorites"), "epic games store"]
|
self.filter_labels = [_("all"), "steam", "portproton", _("favorites")]
|
||||||
self.gamesDisplayCombo = QComboBox()
|
self.gamesDisplayCombo = QComboBox()
|
||||||
self.gamesDisplayCombo.addItems(self.filter_labels)
|
self.gamesDisplayCombo.addItems(self.filter_labels)
|
||||||
self.gamesDisplayCombo.setStyleSheet(self.theme.SETTINGS_COMBO_STYLE)
|
self.gamesDisplayCombo.setStyleSheet(self.theme.SETTINGS_COMBO_STYLE)
|
||||||
@ -984,37 +972,6 @@ class MainWindow(QMainWindow):
|
|||||||
self.autoFullscreenGamepadCheckBox.setChecked(current_auto_fullscreen)
|
self.autoFullscreenGamepadCheckBox.setChecked(current_auto_fullscreen)
|
||||||
formLayout.addRow(self.autoFullscreenGamepadTitle, self.autoFullscreenGamepadCheckBox)
|
formLayout.addRow(self.autoFullscreenGamepadTitle, self.autoFullscreenGamepadCheckBox)
|
||||||
|
|
||||||
# 7. Legendary Authentication
|
|
||||||
self.legendaryAuthButton = AutoSizeButton(
|
|
||||||
_("Open Legendary Login"),
|
|
||||||
icon=self.theme_manager.get_icon("login")
|
|
||||||
)
|
|
||||||
self.legendaryAuthButton.setStyleSheet(self.theme.ACTION_BUTTON_STYLE)
|
|
||||||
self.legendaryAuthButton.setFocusPolicy(Qt.FocusPolicy.StrongFocus)
|
|
||||||
self.legendaryAuthButton.clicked.connect(self.openLegendaryLogin)
|
|
||||||
self.legendaryAuthTitle = QLabel(_("Legendary Authentication:"))
|
|
||||||
self.legendaryAuthTitle.setStyleSheet(self.theme.PARAMS_TITLE_STYLE)
|
|
||||||
self.legendaryAuthTitle.setFocusPolicy(Qt.FocusPolicy.NoFocus)
|
|
||||||
formLayout.addRow(self.legendaryAuthTitle, self.legendaryAuthButton)
|
|
||||||
|
|
||||||
self.legendaryCodeEdit = QLineEdit()
|
|
||||||
self.legendaryCodeEdit.setPlaceholderText(_("Enter Legendary Authorization Code"))
|
|
||||||
self.legendaryCodeEdit.setStyleSheet(self.theme.PROXY_INPUT_STYLE)
|
|
||||||
self.legendaryCodeEdit.setFocusPolicy(Qt.FocusPolicy.StrongFocus)
|
|
||||||
self.legendaryCodeTitle = QLabel(_("Authorization Code:"))
|
|
||||||
self.legendaryCodeTitle.setStyleSheet(self.theme.PARAMS_TITLE_STYLE)
|
|
||||||
self.legendaryCodeTitle.setFocusPolicy(Qt.FocusPolicy.NoFocus)
|
|
||||||
formLayout.addRow(self.legendaryCodeTitle, self.legendaryCodeEdit)
|
|
||||||
|
|
||||||
self.submitCodeButton = AutoSizeButton(
|
|
||||||
_("Submit Code"),
|
|
||||||
icon=self.theme_manager.get_icon("save")
|
|
||||||
)
|
|
||||||
self.submitCodeButton.setStyleSheet(self.theme.ACTION_BUTTON_STYLE)
|
|
||||||
self.submitCodeButton.setFocusPolicy(Qt.FocusPolicy.StrongFocus)
|
|
||||||
self.submitCodeButton.clicked.connect(self.submitLegendaryCode)
|
|
||||||
formLayout.addRow(QLabel(""), self.submitCodeButton)
|
|
||||||
|
|
||||||
layout.addLayout(formLayout)
|
layout.addLayout(formLayout)
|
||||||
|
|
||||||
# Кнопки
|
# Кнопки
|
||||||
@ -1065,37 +1022,6 @@ class MainWindow(QMainWindow):
|
|||||||
logger.error(f"Failed to open Legendary login page: {e}")
|
logger.error(f"Failed to open Legendary login page: {e}")
|
||||||
self.statusBar().showMessage(_("Failed to open Legendary login page"), 3000)
|
self.statusBar().showMessage(_("Failed to open Legendary login page"), 3000)
|
||||||
|
|
||||||
def submitLegendaryCode(self):
|
|
||||||
"""Submits the Legendary authorization code using the legendary CLI."""
|
|
||||||
auth_code = self.legendaryCodeEdit.text().strip()
|
|
||||||
if not auth_code:
|
|
||||||
QMessageBox.warning(self, _("Error"), _("Please enter an authorization code"))
|
|
||||||
return
|
|
||||||
|
|
||||||
try:
|
|
||||||
# Execute legendary auth command
|
|
||||||
result = subprocess.run(
|
|
||||||
[self.legendary_path, "auth", "--code", auth_code],
|
|
||||||
capture_output=True,
|
|
||||||
text=True,
|
|
||||||
check=True
|
|
||||||
)
|
|
||||||
logger.info("Legendary authentication successful: %s", result.stdout)
|
|
||||||
self.statusBar().showMessage(_("Successfully authenticated with Legendary"), 3000)
|
|
||||||
self.legendaryCodeEdit.clear()
|
|
||||||
# Reload Epic Games Store games after successful authentication
|
|
||||||
self.games = self.loadGames()
|
|
||||||
self.updateGameGrid()
|
|
||||||
except subprocess.CalledProcessError as e:
|
|
||||||
logger.error("Legendary authentication failed: %s", e.stderr)
|
|
||||||
self.statusBar().showMessage(_("Legendary authentication failed: {0}").format(e.stderr), 5000)
|
|
||||||
except FileNotFoundError:
|
|
||||||
logger.error("Legendary executable not found at %s", self.legendary_path)
|
|
||||||
self.statusBar().showMessage(_("Legendary executable not found"), 5000)
|
|
||||||
except Exception as e:
|
|
||||||
logger.error("Unexpected error during Legendary authentication: %s", str(e))
|
|
||||||
self.statusBar().showMessage(_("Unexpected error during authentication"), 5000)
|
|
||||||
|
|
||||||
def resetSettings(self):
|
def resetSettings(self):
|
||||||
"""Сбрасывает настройки и перезапускает приложение."""
|
"""Сбрасывает настройки и перезапускает приложение."""
|
||||||
reply = QMessageBox.question(
|
reply = QMessageBox.question(
|
||||||
|
Reference in New Issue
Block a user