From 7dbe414b8751dcb3007b5e3846972007c3f73094 Mon Sep 17 00:00:00 2001 From: loathingKernel <142770+loathingKernel@users.noreply.github.com> Date: Thu, 23 Jun 2022 18:05:04 +0300 Subject: [PATCH] Pass edited files through black --- rare/components/dialogs/login/__init__.py | 14 +++------ .../components/dialogs/login/browser_login.py | 24 ++++++-------- rare/components/dialogs/login/import_login.py | 31 +++++-------------- 3 files changed, 22 insertions(+), 47 deletions(-) diff --git a/rare/components/dialogs/login/__init__.py b/rare/components/dialogs/login/__init__.py index d96c2820..ce35ed47 100644 --- a/rare/components/dialogs/login/__init__.py +++ b/rare/components/dialogs/login/__init__.py @@ -6,8 +6,8 @@ from PyQt5.QtWidgets import QLayout, QDialog, QMessageBox, QFrame from legendary.core import LegendaryCore from rare.shared import ArgumentsSingleton -from rare.ui.components.dialogs.login.login_dialog import Ui_LoginDialog from rare.ui.components.dialogs.login.landing_page import Ui_LandingPage +from rare.ui.components.dialogs.login.login_dialog import Ui_LoginDialog from rare.widgets.sliding_stack import SlidingStackedWidget from .browser_login import BrowserLogin from .import_login import ImportLogin @@ -61,19 +61,13 @@ class LoginDialog(QDialog): self.import_page = ImportLogin(self.core, self.login_stack) self.login_stack.insertWidget(self.pages.import_egl, self.import_page) self.import_page.success.connect(self.login_successful) - self.import_page.changed.connect( - lambda: self.ui.next_button.setEnabled(self.import_page.is_valid()) - ) + self.import_page.changed.connect(lambda: self.ui.next_button.setEnabled(self.import_page.is_valid())) self.ui.next_button.setEnabled(False) self.ui.back_button.setEnabled(False) - self.landing_page.ui.login_browser_radio.clicked.connect( - lambda: self.ui.next_button.setEnabled(True) - ) - self.landing_page.ui.login_import_radio.clicked.connect( - lambda: self.ui.next_button.setEnabled(True) - ) + self.landing_page.ui.login_browser_radio.clicked.connect(lambda: self.ui.next_button.setEnabled(True)) + self.landing_page.ui.login_import_radio.clicked.connect(lambda: self.ui.next_button.setEnabled(True)) self.ui.exit_button.clicked.connect(self.close) self.ui.back_button.clicked.connect(self.back_clicked) self.ui.next_button.clicked.connect(self.next_clicked) diff --git a/rare/components/dialogs/login/browser_login.py b/rare/components/dialogs/login/browser_login.py index 34b592af..bb497aee 100644 --- a/rare/components/dialogs/login/browser_login.py +++ b/rare/components/dialogs/login/browser_login.py @@ -5,9 +5,9 @@ from typing import Tuple from PyQt5.QtCore import pyqtSignal, QUrl from PyQt5.QtGui import QDesktopServices from PyQt5.QtWidgets import QFrame, qApp - -from legendary.utils import webview_login from legendary.core import LegendaryCore +from legendary.utils import webview_login + from rare.ui.components.dialogs.login.browser_login import Ui_BrowserLogin from rare.utils.extra_widgets import IndicatorLineEdit from rare.utils.utils import icon @@ -18,7 +18,9 @@ logger = getLogger("BrowserLogin") class BrowserLogin(QFrame): success = pyqtSignal() changed = pyqtSignal() - login_url = "https://www.epicgames.com/id/login?redirectUrl=https%3A%2F%2Fwww.epicgames.com%2Fid%2Fapi%2Fredirect" + login_url = ( + "https://www.epicgames.com/id/login?redirectUrl=https%3A%2F%2Fwww.epicgames.com%2Fid%2Fapi%2Fredirect" + ) def __init__(self, core: LegendaryCore, parent=None): super(BrowserLogin, self).__init__(parent=parent) @@ -69,9 +71,7 @@ class BrowserLogin(QFrame): try: token = self.core.auth_sid(sid) if self.core.auth_code(token): - logger.info( - f"Successfully logged in as {self.core.lgd.userdata['displayName']}" - ) + logger.info(f"Successfully logged in as {self.core.lgd.userdata['displayName']}") self.success.emit() else: self.ui.status_label.setText(self.tr("Login failed.")) @@ -81,17 +81,13 @@ class BrowserLogin(QFrame): def open_browser(self): if webview_login.webview_available is False: - logger.warning("You don't have webengine installed, " - "you will need to manually copy the SID.") + logger.warning("You don't have webengine installed, " "you will need to manually copy the SID.") QDesktopServices.openUrl(QUrl(self.login_url)) else: if webview_login.do_webview_login( - callback_sid=self.core.auth_sid, - callback_code=self.core.auth_code): - logger.info( - "Successfully logged in as " - f"{self.core.lgd.userdata['displayName']}" - ) + callback_sid=self.core.auth_sid, callback_code=self.core.auth_code + ): + logger.info("Successfully logged in as " f"{self.core.lgd.userdata['displayName']}") self.success.emit() else: logger.warning("Failed to login through browser.") diff --git a/rare/components/dialogs/login/import_login.py b/rare/components/dialogs/login/import_login.py index 912debf9..b891e685 100644 --- a/rare/components/dialogs/login/import_login.py +++ b/rare/components/dialogs/login/import_login.py @@ -4,8 +4,8 @@ from logging import getLogger from PyQt5.QtCore import pyqtSignal from PyQt5.QtWidgets import QFrame, QFileDialog - from legendary.core import LegendaryCore + from rare.ui.components.dialogs.login.import_login import Ui_ImportLogin logger = getLogger("ImportLogin") @@ -17,9 +17,7 @@ class ImportLogin(QFrame): if os.name == "nt": localappdata = os.path.expandvars("%LOCALAPPDATA%") else: - localappdata = os.path.join( - "drive_c/users", getuser(), "Local Settings/Application Data" - ) + localappdata = os.path.join("drive_c/users", getuser(), "Local Settings/Application Data") appdata_path = os.path.join(localappdata, "EpicGamesLauncher/Saved/Config/Windows") found = False @@ -31,9 +29,7 @@ class ImportLogin(QFrame): self.core = core - self.text_egl_found = self.tr( - "Found EGL Program Data. Click 'Next' to import them." - ) + self.text_egl_found = self.tr("Found EGL Program Data. Click 'Next' to import them.") self.text_egl_notfound = self.tr("Could not find EGL Program Data. ") if os.name == "nt": @@ -46,18 +42,13 @@ class ImportLogin(QFrame): self.found = True else: self.ui.info_label.setText( - self.tr( - "Please select the Wine prefix" - " where Epic Games Launcher is installed. " - ) + self.tr("Please select the Wine prefix" " where Epic Games Launcher is installed. ") + self.ui.info_label.text() ) prefixes = self.get_wine_prefixes() if len(prefixes): self.ui.prefix_combo.addItems(prefixes) - self.ui.status_label.setText( - self.tr("Select the Wine prefix you want to import.") - ) + self.ui.status_label.setText(self.tr("Select the Wine prefix you want to import.")) else: self.ui.status_label.setText(self.text_egl_notfound) @@ -76,9 +67,7 @@ class ImportLogin(QFrame): return prefixes def prefix_path(self): - prefix_dialog = QFileDialog( - self, self.tr("Choose path"), os.path.expanduser("~/") - ) + prefix_dialog = QFileDialog(self, self.tr("Choose path"), os.path.expanduser("~/")) prefix_dialog.setFileMode(QFileDialog.DirectoryOnly) if prefix_dialog.exec_(): names = prefix_dialog.selectedFiles() @@ -88,18 +77,14 @@ class ImportLogin(QFrame): if os.name == "nt": return self.found else: - return os.path.exists( - os.path.join(self.ui.prefix_combo.currentText(), self.appdata_path) - ) + return os.path.exists(os.path.join(self.ui.prefix_combo.currentText(), self.appdata_path)) def do_login(self): self.ui.status_label.setText(self.tr("Loading...")) if os.name == "nt": pass else: - self.core.egl.appdata_path = os.path.join( - self.ui.prefix_combo.currentText(), self.appdata_path - ) + self.core.egl.appdata_path = os.path.join(self.ui.prefix_combo.currentText(), self.appdata_path) try: if self.core.auth_import(): logger.info(f"Logged in as {self.core.lgd.userdata['displayName']}")