diff --git a/Rare/utils/Dialogs/InstallDialog.py b/Rare/Components/Dialogs/InstallDialog.py similarity index 100% rename from Rare/utils/Dialogs/InstallDialog.py rename to Rare/Components/Dialogs/InstallDialog.py diff --git a/Rare/utils/Dialogs/Login/BrowserLogin.py b/Rare/Components/Dialogs/Login/BrowserLogin.py similarity index 81% rename from Rare/utils/Dialogs/Login/BrowserLogin.py rename to Rare/Components/Dialogs/Login/BrowserLogin.py index ee1f140d..88a80b0b 100644 --- a/Rare/utils/Dialogs/Login/BrowserLogin.py +++ b/Rare/Components/Dialogs/Login/BrowserLogin.py @@ -1,5 +1,4 @@ import json -import webbrowser from logging import getLogger from PyQt5.QtCore import pyqtSignal @@ -7,20 +6,22 @@ from PyQt5.QtWidgets import QWidget, QVBoxLayout, QPushButton, QLabel, QLineEdit from legendary.core import LegendaryCore logger = getLogger("BrowserLogin") -class BrowserLogin(QWidget): + +class BrowserLogin(QWidget): success = pyqtSignal() url: str = "https://www.epicgames.com/id/login?redirectUrl=https%3A%2F%2Fwww.epicgames.com%2Fid%2Fapi%2Fredirect" + def __init__(self, core: LegendaryCore): super(BrowserLogin, self).__init__() self.layout = QVBoxLayout() self.core = core - self.back = QPushButton("Back") # TODO Icon - self.back.clicked.connect(lambda: self.success.emit("back")) + self.back = QPushButton("Back") # TODO Icon self.layout.addWidget(self.back) - self.info_text = QLabel(f"Opens a browser. You login and copy the json code in the field below. Click here to open Browser") + self.info_text = QLabel( + f"Opens a browser. You login and copy the json code in the field below. Click here to open Browser") self.info_text.setWordWrap(True) self.info_text.setOpenExternalLinks(True) self.layout.addWidget(self.info_text) @@ -37,7 +38,6 @@ class BrowserLogin(QWidget): self.setLayout(self.layout) - def login(self): self.mini_info.setText("Loading...") sid = self.input_field.text() @@ -49,4 +49,4 @@ class BrowserLogin(QWidget): logger.info(f"Successfully logged in as {self.core.lgd.userdata['displayName']}") self.success.emit() else: - self.mini_info.setText("Login failed") \ No newline at end of file + self.mini_info.setText("Login failed") diff --git a/Rare/Components/Dialogs/Login/ImportWidget.py b/Rare/Components/Dialogs/Login/ImportWidget.py new file mode 100644 index 00000000..d2ca611f --- /dev/null +++ b/Rare/Components/Dialogs/Login/ImportWidget.py @@ -0,0 +1,15 @@ +from PyQt5.QtCore import pyqtSignal +from PyQt5.QtWidgets import QWidget, QVBoxLayout, QPushButton +from legendary.core import LegendaryCore + + +class ImportWidget(QWidget): + success = pyqtSignal(str) + + def __init__(self, core: LegendaryCore): + super(ImportWidget, self).__init__() + self.layout = QVBoxLayout() + self.core = core + + self.back = QPushButton("Back") + self.layout.addWidget(self.back) \ No newline at end of file diff --git a/Rare/utils/Dialogs/Login/LoginDialog.py b/Rare/Components/Dialogs/Login/LoginDialog.py similarity index 91% rename from Rare/utils/Dialogs/Login/LoginDialog.py rename to Rare/Components/Dialogs/Login/LoginDialog.py index 98eb3b60..5803bc04 100644 --- a/Rare/utils/Dialogs/Login/LoginDialog.py +++ b/Rare/Components/Dialogs/Login/LoginDialog.py @@ -1,10 +1,8 @@ -import time - from PyQt5.QtWidgets import QDialog, QVBoxLayout, QLabel, QStackedLayout, QWidget, QPushButton from legendary.core import LegendaryCore -from Rare.utils.Dialogs.Login.BrowserLogin import BrowserLogin -from Rare.utils.Dialogs.Login.ImportWidget import ImportWidget +from Rare.Components.Dialogs.Login import BrowserLogin +from Rare.Components.Dialogs.Login import ImportWidget # Login Opportunities: Browser, Import @@ -33,6 +31,7 @@ class LoginDialog(QDialog): self.landing_layout.addWidget(self.info_text) self.browser_login = OptionWidget("Use Browser", "This opens your default webbrowser. Login and copy the text") + self.landing_layout.addWidget(self.browser_login) self.browser_login.button.clicked.connect(lambda: self.layout.setCurrentIndex(1)) @@ -49,11 +48,11 @@ class LoginDialog(QDialog): self.layout.addWidget(self.landing_widget) self.browser_widget = BrowserLogin(self.core) - self.browser_widget.success.connect(lambda: self.layout.setCurrentIndex(0)) self.browser_widget.success.connect(self.success) + self.browser_widget.back.clicked.connect(lambda: self.layout.setCurrentIndex(0)) self.layout.addWidget(self.browser_widget) - self.import_widget = ImportWidget() + self.import_widget = ImportWidget(self.core) self.layout.addWidget(self.import_widget) self.layout.addWidget(LoginSuccessfulWidget()) @@ -68,7 +67,7 @@ class LoginDialog(QDialog): if self.core.login(): self.logged_in = True self.layout.setCurrentIndex(3) - time.sleep(1) + # time.sleep(1) self.close() diff --git a/Rare/utils/Dialogs/Login/__init__.py b/Rare/Components/Dialogs/Login/__init__.py similarity index 100% rename from Rare/utils/Dialogs/Login/__init__.py rename to Rare/Components/Dialogs/Login/__init__.py diff --git a/Rare/Components/Dialogs/__init__.py b/Rare/Components/Dialogs/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/Rare/Components/Launch/LaunchDialog.py b/Rare/Components/Launch/LaunchDialog.py index 77185594..423af227 100644 --- a/Rare/Components/Launch/LaunchDialog.py +++ b/Rare/Components/Launch/LaunchDialog.py @@ -4,7 +4,7 @@ from PyQt5.QtCore import QThread, pyqtSignal from PyQt5.QtWidgets import QDialog, QLabel, QProgressBar, QVBoxLayout from legendary.core import LegendaryCore -from Rare.utils.Dialogs.Login.LoginDialog import LoginDialog +from Rare.Components.Dialogs.Login import LoginDialog from Rare.utils.utils import download_images logger = getLogger("Login") @@ -62,7 +62,7 @@ class LaunchDialog(QDialog): def login(self): if not LoginDialog(core=self.core).login(): - self.close() + exit(0) diff --git a/Rare/Components/Tabs/Downloads/DownloadTab.py b/Rare/Components/Tabs/Downloads/DownloadTab.py index f1860d2a..94595900 100644 --- a/Rare/Components/Tabs/Downloads/DownloadTab.py +++ b/Rare/Components/Tabs/Downloads/DownloadTab.py @@ -7,7 +7,7 @@ from PyQt5.QtCore import QThread, pyqtSignal from PyQt5.QtWidgets import QWidget, QMessageBox, QVBoxLayout, QLabel, QGridLayout, QProgressBar from legendary.core import LegendaryCore -from Rare.utils.Dialogs.InstallDialog import InstallInfoDialog +from Rare.Components.Dialogs.InstallDialog import InstallInfoDialog logger = getLogger("Download") diff --git a/Rare/Components/Tabs/Games/GameWidgetUninstalled.py b/Rare/Components/Tabs/Games/GameWidgetUninstalled.py index ef5fe6a4..57ca057b 100644 --- a/Rare/Components/Tabs/Games/GameWidgetUninstalled.py +++ b/Rare/Components/Tabs/Games/GameWidgetUninstalled.py @@ -1,6 +1,5 @@ import os from logging import getLogger -from multiprocessing import Queue as MPQueue from PyQt5.QtCore import pyqtSignal from PyQt5.QtGui import QPixmap @@ -8,7 +7,7 @@ from PyQt5.QtWidgets import QWidget, QVBoxLayout, QLabel from legendary.core import LegendaryCore from legendary.models.game import Game -from Rare.utils.Dialogs.InstallDialog import InstallDialog +from Rare.Components.Dialogs.InstallDialog import InstallDialog from Rare.utils.QtExtensions import ClickableLabel from Rare.utils.RareConfig import IMAGE_DIR from Rare.utils.utils import download_image diff --git a/Rare/utils/Dialogs/Login/ImportWidget.py b/Rare/utils/Dialogs/Login/ImportWidget.py deleted file mode 100644 index 86f4719b..00000000 --- a/Rare/utils/Dialogs/Login/ImportWidget.py +++ /dev/null @@ -1,6 +0,0 @@ -from PyQt5.QtWidgets import QWidget - - -class ImportWidget(QWidget): - def __init__(self): - super(ImportWidget, self).__init__() \ No newline at end of file