1
0
Fork 0
mirror of synced 2024-05-18 19:42:54 +12:00

fix settings

This commit is contained in:
Dummerle 2021-02-22 19:02:49 +01:00
parent f0ff1524e5
commit 5059c10681
14 changed files with 15 additions and 7 deletions

View file

@ -6,8 +6,10 @@ from legendary.core import LegendaryCore
from Rare.Components.Dialogs.Login.LoginDialog import LoginDialog
from Rare.utils.utils import download_images
logger = getLogger("Login")
class LaunchThread(QThread):
download_progess = pyqtSignal(int)
action = pyqtSignal(str)
@ -22,8 +24,11 @@ class LaunchThread(QThread):
download_images(self.download_progess, self.core)
self.action.emit("finish")
class LoginThread(QThread):
login = pyqtSignal()
start_app = pyqtSignal(LegendaryCore)
def __init__(self, core: LegendaryCore):
super(LoginThread, self).__init__()
self.core = core
@ -33,6 +38,7 @@ class LoginThread(QThread):
try:
if self.core.login():
logger.info("You are logged in")
self.start_app.emit(self.core)
else:
self.run()
except ValueError:
@ -46,10 +52,10 @@ class LaunchDialog(QDialog):
self.core = core
self.login_thread = LoginThread(core)
self.login_thread.login.connect(self.login)
self.login_thread.finished.connect(self.launch)
self.login_thread.start_app.connect(self.launch)
self.login_thread.start()
self.title = QLabel("<h3>"+self.tr("Launching Rare")+"</h3>")
self.title = QLabel("<h3>" + self.tr("Launching Rare") + "</h3>")
self.info_pb = QProgressBar()
self.info_text = QLabel(self.tr("Logging in"))
self.layout = QVBoxLayout()
@ -64,9 +70,8 @@ class LaunchDialog(QDialog):
if not LoginDialog(core=self.core).login():
exit(0)
def launch(self):
def launch(self, core: LegendaryCore):
self.core = core
self.info_pb.setMaximum(len(self.core.get_game_list()))
self.info_text.setText("Downloading Images")
self.thread = LaunchThread(self.core, self)

View file

@ -11,7 +11,7 @@ class MiniWidget(QWidget):
self.layout = QVBoxLayout()
self.core = core
self.layout.addWidget(QLabel("Account"))
self.layout.addWidget(QLabel("Logged in as " + self.core.lgd.userdata.get("display_name")))
self.layout.addWidget(QLabel("Logged in as " + str(self.core.lgd.userdata.get("display_name"))))
self.open_browser = QPushButton("Account settings")
self.open_browser.clicked.connect(self.open_account)

View file

@ -2,7 +2,7 @@ import logging
import os
import sys
from PyQt5.QtCore import QTranslator, QSettings
from PyQt5.QtCore import QTranslator, QSettings, QCoreApplication
from PyQt5.QtWidgets import QApplication
from legendary.core import LegendaryCore
@ -21,6 +21,9 @@ core = LegendaryCore()
def main():
app = QApplication(sys.argv)
#app2 = QCoreApplication()
app.setApplicationName("Rare")
app.setOrganizationName("Rare")
settings = QSettings()
# Translator
translator = QTranslator()