chore: hide legendary login

Signed-off-by: Boris Yumankulov <boria138@altlinux.org>
This commit is contained in:
2025-09-23 10:51:33 +05:00
parent 98f07a9792
commit 1ad19bff6a

View File

@@ -1341,36 +1341,36 @@ class MainWindow(QMainWindow):
self.gamepadRumbleCheckBox.setChecked(current_rumble_state) self.gamepadRumbleCheckBox.setChecked(current_rumble_state)
formLayout.addRow(self.gamepadRumbleTitle, self.gamepadRumbleCheckBox) formLayout.addRow(self.gamepadRumbleTitle, self.gamepadRumbleCheckBox)
# 8. Legendary Authentication # # 8. Legendary Authentication
self.legendaryAuthButton = AutoSizeButton( # self.legendaryAuthButton = AutoSizeButton(
_("Open Legendary Login"), # _("Open Legendary Login"),
icon=self.theme_manager.get_icon("login") # icon=self.theme_manager.get_icon("login")
) # )
self.legendaryAuthButton.setStyleSheet(self.theme.ACTION_BUTTON_STYLE) # self.legendaryAuthButton.setStyleSheet(self.theme.ACTION_BUTTON_STYLE)
self.legendaryAuthButton.setFocusPolicy(Qt.FocusPolicy.StrongFocus) # self.legendaryAuthButton.setFocusPolicy(Qt.FocusPolicy.StrongFocus)
self.legendaryAuthButton.clicked.connect(self.openLegendaryLogin) # self.legendaryAuthButton.clicked.connect(self.openLegendaryLogin)
self.legendaryAuthTitle = QLabel(_("Legendary Authentication:")) # self.legendaryAuthTitle = QLabel(_("Legendary Authentication:"))
self.legendaryAuthTitle.setStyleSheet(self.theme.PARAMS_TITLE_STYLE) # self.legendaryAuthTitle.setStyleSheet(self.theme.PARAMS_TITLE_STYLE)
self.legendaryAuthTitle.setFocusPolicy(Qt.FocusPolicy.NoFocus) # self.legendaryAuthTitle.setFocusPolicy(Qt.FocusPolicy.NoFocus)
formLayout.addRow(self.legendaryAuthTitle, self.legendaryAuthButton) # formLayout.addRow(self.legendaryAuthTitle, self.legendaryAuthButton)
#
self.legendaryCodeEdit = CustomLineEdit(self, theme=self.theme) # self.legendaryCodeEdit = CustomLineEdit(self, theme=self.theme)
self.legendaryCodeEdit.setPlaceholderText(_("Enter Legendary Authorization Code")) # self.legendaryCodeEdit.setPlaceholderText(_("Enter Legendary Authorization Code"))
self.legendaryCodeEdit.setStyleSheet(self.theme.PROXY_INPUT_STYLE) # self.legendaryCodeEdit.setStyleSheet(self.theme.PROXY_INPUT_STYLE)
self.legendaryCodeEdit.setFocusPolicy(Qt.FocusPolicy.StrongFocus) # self.legendaryCodeEdit.setFocusPolicy(Qt.FocusPolicy.StrongFocus)
self.legendaryCodeTitle = QLabel(_("Authorization Code:")) # self.legendaryCodeTitle = QLabel(_("Authorization Code:"))
self.legendaryCodeTitle.setStyleSheet(self.theme.PARAMS_TITLE_STYLE) # self.legendaryCodeTitle.setStyleSheet(self.theme.PARAMS_TITLE_STYLE)
self.legendaryCodeTitle.setFocusPolicy(Qt.FocusPolicy.NoFocus) # self.legendaryCodeTitle.setFocusPolicy(Qt.FocusPolicy.NoFocus)
formLayout.addRow(self.legendaryCodeTitle, self.legendaryCodeEdit) # formLayout.addRow(self.legendaryCodeTitle, self.legendaryCodeEdit)
#
self.submitCodeButton = AutoSizeButton( # self.submitCodeButton = AutoSizeButton(
_("Submit Code"), # _("Submit Code"),
icon=self.theme_manager.get_icon("save") # icon=self.theme_manager.get_icon("save")
) # )
self.submitCodeButton.setStyleSheet(self.theme.ACTION_BUTTON_STYLE) # self.submitCodeButton.setStyleSheet(self.theme.ACTION_BUTTON_STYLE)
self.submitCodeButton.setFocusPolicy(Qt.FocusPolicy.StrongFocus) # self.submitCodeButton.setFocusPolicy(Qt.FocusPolicy.StrongFocus)
self.submitCodeButton.clicked.connect(self.submitLegendaryCode) # self.submitCodeButton.clicked.connect(self.submitLegendaryCode)
formLayout.addRow(QLabel(""), self.submitCodeButton) # formLayout.addRow(QLabel(""), self.submitCodeButton)
layout.addLayout(formLayout) layout.addLayout(formLayout)
@@ -1412,46 +1412,46 @@ class MainWindow(QMainWindow):
layout.addStretch(1) layout.addStretch(1)
self.stackedWidget.addWidget(self.portProtonWidget) self.stackedWidget.addWidget(self.portProtonWidget)
def openLegendaryLogin(self): # def openLegendaryLogin(self):
"""Opens the Legendary login page in the default web browser.""" # """Opens the Legendary login page in the default web browser."""
login_url = "https://legendary.gl/epiclogin" # login_url = "https://legendary.gl/epiclogin"
try: # try:
QDesktopServices.openUrl(QUrl(login_url)) # QDesktopServices.openUrl(QUrl(login_url))
self.statusBar().showMessage(_("Opened Legendary login page in browser"), 3000) # self.statusBar().showMessage(_("Opened Legendary login page in browser"), 3000)
except Exception as e: # except Exception as e:
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): # def submitLegendaryCode(self):
"""Submits the Legendary authorization code using the legendary CLI.""" # """Submits the Legendary authorization code using the legendary CLI."""
auth_code = self.legendaryCodeEdit.text().strip() # auth_code = self.legendaryCodeEdit.text().strip()
if not auth_code: # if not auth_code:
QMessageBox.warning(self, _("Error"), _("Please enter an authorization code")) # QMessageBox.warning(self, _("Error"), _("Please enter an authorization code"))
return # return
#
try: # try:
# Execute legendary auth command # # Execute legendary auth command
result = subprocess.run( # result = subprocess.run(
[self.legendary_path, "auth", "--code", auth_code], # [self.legendary_path, "auth", "--code", auth_code],
capture_output=True, # capture_output=True,
text=True, # text=True,
check=True # check=True
) # )
logger.info("Legendary authentication successful: %s", result.stdout) # logger.info("Legendary authentication successful: %s", result.stdout)
self.statusBar().showMessage(_("Successfully authenticated with Legendary"), 3000) # self.statusBar().showMessage(_("Successfully authenticated with Legendary"), 3000)
self.legendaryCodeEdit.clear() # self.legendaryCodeEdit.clear()
# Reload Epic Games Store games after successful authentication # # Reload Epic Games Store games after successful authentication
self.games = self.loadGames() # self.games = self.loadGames()
self.updateGameGrid() # self.updateGameGrid()
except subprocess.CalledProcessError as e: # except subprocess.CalledProcessError as e:
logger.error("Legendary authentication failed: %s", e.stderr) # logger.error("Legendary authentication failed: %s", e.stderr)
self.statusBar().showMessage(_("Legendary authentication failed: {0}").format(e.stderr), 5000) # self.statusBar().showMessage(_("Legendary authentication failed: {0}").format(e.stderr), 5000)
except FileNotFoundError: # except FileNotFoundError:
logger.error("Legendary executable not found at %s", self.legendary_path) # logger.error("Legendary executable not found at %s", self.legendary_path)
self.statusBar().showMessage(_("Legendary executable not found"), 5000) # self.statusBar().showMessage(_("Legendary executable not found"), 5000)
except Exception as e: # except Exception as e:
logger.error("Unexpected error during Legendary authentication: %s", str(e)) # logger.error("Unexpected error during Legendary authentication: %s", str(e))
self.statusBar().showMessage(_("Unexpected error during authentication"), 5000) # self.statusBar().showMessage(_("Unexpected error during authentication"), 5000)
def resetSettings(self): def resetSettings(self):
"""Сбрасывает настройки и перезапускает приложение.""" """Сбрасывает настройки и перезапускает приложение."""