Login animation
This commit is contained in:
parent
b17f2e52fe
commit
77ffefc664
48
Launch.py
Normal file
48
Launch.py
Normal file
|
@ -0,0 +1,48 @@
|
||||||
|
from PyQt5.QtCore import QThread, pyqtSignal
|
||||||
|
from PyQt5.QtWidgets import QDialog, QLabel, QProgressBar, QVBoxLayout
|
||||||
|
from legendary.core import LegendaryCore
|
||||||
|
|
||||||
|
from Rare.utils.RareUtils import download_images
|
||||||
|
|
||||||
|
|
||||||
|
class LaunchThread(QThread):
|
||||||
|
download_progess = pyqtSignal(int)
|
||||||
|
action = pyqtSignal(str)
|
||||||
|
|
||||||
|
def __init__(self, parent=None):
|
||||||
|
super(LaunchThread, self).__init__(parent)
|
||||||
|
|
||||||
|
def run(self):
|
||||||
|
self.action.emit("Login")
|
||||||
|
self.action.emit("Downloading Images")
|
||||||
|
download_images(self.download_progess)
|
||||||
|
self.action.emit("finish")
|
||||||
|
|
||||||
|
|
||||||
|
class LaunchDialog(QDialog):
|
||||||
|
def __init__(self, core: LegendaryCore):
|
||||||
|
super(LaunchDialog, self).__init__()
|
||||||
|
|
||||||
|
self.title = QLabel("<h3>Launching Rare</h3>")
|
||||||
|
self.thread = LaunchThread(self)
|
||||||
|
self.thread.download_progess.connect(self.update_pb)
|
||||||
|
self.thread.action.connect(self.info)
|
||||||
|
self.info_pb = QProgressBar()
|
||||||
|
self.info_pb.setMaximum(len(core.get_game_list()))
|
||||||
|
self.info_text = QLabel("Logging in")
|
||||||
|
self.layout = QVBoxLayout()
|
||||||
|
|
||||||
|
self.layout.addWidget(self.title)
|
||||||
|
self.layout.addWidget(self.info_pb)
|
||||||
|
self.layout.addWidget(self.info_text)
|
||||||
|
|
||||||
|
self.setLayout(self.layout)
|
||||||
|
self.thread.start()
|
||||||
|
|
||||||
|
def update_pb(self, i: int):
|
||||||
|
self.info_pb.setValue(i)
|
||||||
|
|
||||||
|
def info(self, text: str):
|
||||||
|
if text == "finish":
|
||||||
|
self.close()
|
||||||
|
self.info_text.setText(text)
|
|
@ -53,6 +53,8 @@ class GameWidget(QWidget):
|
||||||
pixmap = QPixmap(f"../images/{game.app_name}/DieselGameBoxTall.png")
|
pixmap = QPixmap(f"../images/{game.app_name}/DieselGameBoxTall.png")
|
||||||
elif os.path.exists(f"../images/{game.app_name}/DieselGameBoxLogo.png"):
|
elif os.path.exists(f"../images/{game.app_name}/DieselGameBoxLogo.png"):
|
||||||
pixmap = QPixmap(f"../images/{game.app_name}/DieselGameBoxLogo.png")
|
pixmap = QPixmap(f"../images/{game.app_name}/DieselGameBoxLogo.png")
|
||||||
|
else:
|
||||||
|
logger.warning("No Image found")
|
||||||
pixmap = pixmap.scaled(180, 240)
|
pixmap = pixmap.scaled(180, 240)
|
||||||
self.image = QLabel()
|
self.image = QLabel()
|
||||||
self.image.setPixmap(pixmap)
|
self.image.setPixmap(pixmap)
|
||||||
|
|
|
@ -15,7 +15,7 @@ class LoginBrowser(QWebEngineView):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super(LoginBrowser, self).__init__()
|
super(LoginBrowser, self).__init__()
|
||||||
|
|
||||||
def createWindow(self, QWebEnginePage_WebWindowType):
|
def createWindow(self, webengine_window_type):
|
||||||
return self
|
return self
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@ import sys
|
||||||
from PyQt5.QtWidgets import QApplication
|
from PyQt5.QtWidgets import QApplication
|
||||||
from legendary.core import LegendaryCore
|
from legendary.core import LegendaryCore
|
||||||
|
|
||||||
|
from Launch import LaunchDialog
|
||||||
from Rare.Login import LoginWindow
|
from Rare.Login import LoginWindow
|
||||||
from Rare.MainWindow import MainWindow
|
from Rare.MainWindow import MainWindow
|
||||||
|
|
||||||
|
@ -15,6 +16,7 @@ logger = logging.getLogger("Rare")
|
||||||
core = LegendaryCore()
|
core = LegendaryCore()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
app = QApplication(sys.argv)
|
app = QApplication(sys.argv)
|
||||||
|
|
||||||
|
@ -29,9 +31,10 @@ def main():
|
||||||
login_window = LoginWindow(core)
|
login_window = LoginWindow(core)
|
||||||
if not login_window.login():
|
if not login_window.login():
|
||||||
return
|
return
|
||||||
|
launch_dialog = LaunchDialog(core)
|
||||||
|
launch_dialog.exec_()
|
||||||
mainwindow = MainWindow(core)
|
mainwindow = MainWindow(core)
|
||||||
sys.exit(app.exec_())
|
app.exec_()
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
|
@ -1,93 +0,0 @@
|
||||||
import logging
|
|
||||||
import sys
|
|
||||||
|
|
||||||
from PyQt5.QtCore import QThread, pyqtSignal
|
|
||||||
from PyQt5.QtWidgets import QTabWidget, QMainWindow, QWidget, QApplication, QDialog, QLabel, QProgressBar, QVBoxLayout
|
|
||||||
|
|
||||||
from Rare.Dialogs import LoginDialog
|
|
||||||
from Rare.TabWidgets import Settings, GameListInstalled, BrowserTab, GameListUninstalled, UpdateList
|
|
||||||
from Rare.utils import legendaryUtils
|
|
||||||
from Rare.utils.RareUtils import download_images
|
|
||||||
|
|
||||||
logging.basicConfig(
|
|
||||||
format='[%(name)s] %(levelname)s: %(message)s',
|
|
||||||
level=logging.INFO
|
|
||||||
)
|
|
||||||
logger = logging.getLogger("Rare")
|
|
||||||
|
|
||||||
|
|
||||||
class LaunchThread(QThread):
|
|
||||||
download_progess = pyqtSignal(int)
|
|
||||||
action = pyqtSignal(str)
|
|
||||||
|
|
||||||
def __init__(self, parent=None):
|
|
||||||
super(LaunchThread, self).__init__(parent)
|
|
||||||
|
|
||||||
def run(self):
|
|
||||||
self.action.emit("Login")
|
|
||||||
self.action.emit("Downloading Images")
|
|
||||||
download_images(self.download_progess)
|
|
||||||
self.action.emit("finish")
|
|
||||||
|
|
||||||
|
|
||||||
class LaunchDialog(QDialog):
|
|
||||||
def __init__(self):
|
|
||||||
super(LaunchDialog, self).__init__()
|
|
||||||
try:
|
|
||||||
if legendaryUtils.core.login():
|
|
||||||
self.title = QLabel("<h3>Launching Rare</h3>")
|
|
||||||
self.thread = LaunchThread(self)
|
|
||||||
self.thread.download_progess.connect(self.update_pb)
|
|
||||||
self.thread.action.connect(self.info)
|
|
||||||
self.info_pb = QProgressBar()
|
|
||||||
self.info_pb.setMaximum(len(legendaryUtils.get_games()))
|
|
||||||
self.info_text = QLabel("Logging in")
|
|
||||||
self.layout = QVBoxLayout()
|
|
||||||
|
|
||||||
self.layout.addWidget(self.title)
|
|
||||||
self.layout.addWidget(self.info_pb)
|
|
||||||
self.layout.addWidget(self.info_text)
|
|
||||||
|
|
||||||
self.setLayout(self.layout)
|
|
||||||
self.thread.start()
|
|
||||||
except:
|
|
||||||
logger.info("No login data found")
|
|
||||||
dia = LoginDialog()
|
|
||||||
code = dia.get_login()
|
|
||||||
if code == 1:
|
|
||||||
self.app.closeAllWindows()
|
|
||||||
logger.info("Exit login")
|
|
||||||
exit(0)
|
|
||||||
elif code == 0:
|
|
||||||
logger.info("Login successfully")
|
|
||||||
|
|
||||||
def update_pb(self, i: int):
|
|
||||||
self.info_pb.setValue(i)
|
|
||||||
|
|
||||||
def info(self, text: str):
|
|
||||||
if text == "finish":
|
|
||||||
self.close()
|
|
||||||
self.info_text.setText(text)
|
|
||||||
|
|
||||||
|
|
||||||
class Main():
|
|
||||||
def __init__(self):
|
|
||||||
self.app = QApplication(sys.argv)
|
|
||||||
|
|
||||||
self.launch_dia = LaunchDialog()
|
|
||||||
self.launch_dia.exec_()
|
|
||||||
|
|
||||||
|
|
||||||
self.window = MainWindow()
|
|
||||||
self.app.exec_()
|
|
||||||
|
|
||||||
def start(self):
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
|
||||||
Main()
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
main()
|
|
|
@ -15,6 +15,7 @@ logger = getLogger("TabWidgets")
|
||||||
|
|
||||||
|
|
||||||
class BrowserTab(QWebEngineView):
|
class BrowserTab(QWebEngineView):
|
||||||
|
# TODO Save login
|
||||||
def __init__(self, parent):
|
def __init__(self, parent):
|
||||||
super(BrowserTab, self).__init__(parent=parent)
|
super(BrowserTab, self).__init__(parent=parent)
|
||||||
|
|
||||||
|
|
|
@ -6,8 +6,8 @@ from getpass import getuser
|
||||||
from PyQt5.QtCore import QProcess, QProcessEnvironment
|
from PyQt5.QtCore import QProcess, QProcessEnvironment
|
||||||
from legendary.core import LegendaryCore
|
from legendary.core import LegendaryCore
|
||||||
|
|
||||||
|
logger = logging.getLogger("LGD")
|
||||||
core = LegendaryCore()
|
core = LegendaryCore()
|
||||||
logger = logging.getLogger("LegendaryUtils")
|
|
||||||
|
|
||||||
|
|
||||||
def get_installed():
|
def get_installed():
|
||||||
|
@ -98,7 +98,6 @@ def launch_game(app_name: str, offline: bool = False, skip_version_check: bool =
|
||||||
|
|
||||||
|
|
||||||
def auth_import(lutris: bool = False, wine_prefix: str = None) -> bool:
|
def auth_import(lutris: bool = False, wine_prefix: str = None) -> bool:
|
||||||
|
|
||||||
print(lutris, wine_prefix)
|
print(lutris, wine_prefix)
|
||||||
# Linux
|
# Linux
|
||||||
if not core.egl.appdata_path:
|
if not core.egl.appdata_path:
|
||||||
|
@ -167,8 +166,8 @@ def get_name():
|
||||||
|
|
||||||
|
|
||||||
def uninstall(app_name: str):
|
def uninstall(app_name: str):
|
||||||
return
|
|
||||||
core.uninstall_game(core.get_installed_game(app_name), True, True)
|
core.uninstall_game(core.get_installed_game(app_name))
|
||||||
# logger.info("Uninstalling " + app_name)
|
# logger.info("Uninstalling " + app_name)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
requests>=2.25.0
|
requests>=2.25.0
|
||||||
legendary_gl>=0.20.3
|
legendary-gl>=0.20.3
|
||||||
Pillow>=8.0.1
|
Pillow>=8.0.1
|
||||||
PyQt5>=5.15.2
|
PyQt5>=5.15.2
|
||||||
|
|
Loading…
Reference in a new issue