install ui
Not able to install
This commit is contained in:
parent
7dc9aa53ec
commit
135e686962
|
@ -1,23 +1,81 @@
|
|||
from PyQt5.QtWidgets import QDialog, QVBoxLayout, QHBoxLayout, QPushButton, QLabel
|
||||
import os
|
||||
|
||||
from PyQt5.QtWidgets import QDialog, QVBoxLayout, QHBoxLayout, QPushButton, QLabel, QLineEdit
|
||||
from Rare.utils import legendaryUtils
|
||||
|
||||
class InstallDialog(QDialog):
|
||||
def __init__(self, game):
|
||||
super(InstallDialog, self).__init__()
|
||||
self.setWindowTitle("Install Game")
|
||||
self.layout = QVBoxLayout()
|
||||
|
||||
|
||||
self.yes = False
|
||||
self.install_path = QLineEdit(f"{os.path.expanduser('~')}/legendary")
|
||||
self.options = QLabel("Verschiedene Optionene")
|
||||
self.layout.addWidget(self.options)
|
||||
|
||||
|
||||
self.layout.addStretch(1)
|
||||
self.yes_button = QPushButton("Install")
|
||||
self.yes_button.clicked.connect(self.close)
|
||||
self.cancel_button = QPushButton("cancel")
|
||||
|
||||
self.layout.addWidget(self.options)
|
||||
self.layout.addWidget(self.install_path)
|
||||
|
||||
self.button_layout = QHBoxLayout()
|
||||
self.button_layout.addWidget(self.yes_button)
|
||||
self.button_layout.addWidget(self.cancel_button)
|
||||
self.cancel_button.clicked.connect(self.exit)
|
||||
self.yes_button.clicked.connect(self.accept)
|
||||
self.cancel_button.clicked.connect(self.cancel)
|
||||
self.layout.addLayout(self.button_layout)
|
||||
self.setLayout(self.layout)
|
||||
|
||||
def get_data(self) -> dict:
|
||||
self.exec_()
|
||||
return {
|
||||
"install_path": self.install_path.text()
|
||||
} if self.yes else 0
|
||||
|
||||
def accept(self):
|
||||
self.yes = True
|
||||
self.close()
|
||||
|
||||
def cancel(self):
|
||||
self.yes = False
|
||||
self.close()
|
||||
|
||||
|
||||
class LoginDialog(QDialog):
|
||||
def __init__(self):
|
||||
super(LoginDialog, self).__init__()
|
||||
self.open_browser_button = QPushButton("Open Browser to get sid")
|
||||
self.open_browser_button.clicked.connect(self.open_browser)
|
||||
self.sid_field = QLineEdit()
|
||||
self.sid_field.setPlaceholderText("Enter sid from the Browser")
|
||||
self.login_button = QPushButton("Login")
|
||||
self.login_button.clicked.connect(self.login)
|
||||
self.import_button = QPushButton("Or Import Login from EGL")
|
||||
self.import_button.clicked.connect(self.import_key)
|
||||
|
||||
self.layout = QVBoxLayout()
|
||||
self.layout.addWidget(self.open_browser_button)
|
||||
self.layout.addWidget(self.sid_field)
|
||||
self.layout.addWidget(self.login_button)
|
||||
self.layout.addWidget(self.import_button)
|
||||
self.setLayout(self.layout)
|
||||
|
||||
def open_browser(self):
|
||||
pass
|
||||
|
||||
def login(self):
|
||||
legendaryUtils.auth(self.sid_field.text())
|
||||
|
||||
def import_key(self):
|
||||
if legendaryUtils.auth_import():
|
||||
self.close()
|
||||
else:
|
||||
self.import_button.setText("Das hat nicht funktioniert")
|
||||
|
||||
|
||||
class GameSettingsDialog(QDialog):
|
||||
def __init__(self):
|
||||
super(GameSettingsDialog, self).__init__()
|
|
@ -66,7 +66,6 @@ class UninstalledGameWidget(QWidget):
|
|||
self.layout = QHBoxLayout()
|
||||
self.game = game
|
||||
|
||||
self.visible = True
|
||||
pixmap = QPixmap(f"../images/{game.app_name}/UninstalledArt.png")
|
||||
pixmap = pixmap.scaled(240, 320)
|
||||
self.image = QLabel()
|
||||
|
@ -89,5 +88,10 @@ class UninstalledGameWidget(QWidget):
|
|||
|
||||
def install(self):
|
||||
print("install " + self.title)
|
||||
#TODO
|
||||
# dialog = InstallDialog(self.game)
|
||||
dia = InstallDialog(self.game)
|
||||
data = dia.get_data()
|
||||
if data != 0:
|
||||
path = data.get("install_path")
|
||||
print(path)
|
||||
# TODO
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@ import sys
|
|||
|
||||
from PyQt5.QtWidgets import QTabWidget, QMainWindow, QWidget, QApplication
|
||||
|
||||
from Rare.Dialogs import LoginDialog
|
||||
from Rare.TabWidgets import Settings, GameListInstalled, BrowserTab, GameListUninstalled, UpdateList
|
||||
|
||||
|
||||
|
@ -49,6 +50,7 @@ def main():
|
|||
# Check if Legendary is installed
|
||||
|
||||
if os.path.isfile(os.path.expanduser("~") + '/.config/legendary/user.json'):
|
||||
print("Launching Rare")
|
||||
startMainProcess()
|
||||
else:
|
||||
notLoggedIn()
|
||||
|
@ -64,7 +66,8 @@ def startMainProcess():
|
|||
|
||||
def notLoggedIn():
|
||||
app = QApplication(sys.argv)
|
||||
window = LoginWindow()
|
||||
dia = LoginDialog()
|
||||
dia.show()
|
||||
sys.exit(app.exec_())
|
||||
|
||||
|
||||
|
|
|
@ -5,7 +5,6 @@ from distutils.util import strtobool
|
|||
from legendary.cli import LegendaryCLI
|
||||
from legendary.core import LegendaryCore
|
||||
|
||||
|
||||
core = LegendaryCore()
|
||||
cli = LegendaryCLI()
|
||||
|
||||
|
@ -86,7 +85,16 @@ def start(game_name,
|
|||
user_name_override=user_name_override,
|
||||
language=language
|
||||
),
|
||||
[] # Extra
|
||||
[] # Extra
|
||||
)
|
||||
|
||||
# start("Sugar")
|
||||
def auth(sid:str):
|
||||
|
||||
cli.auth(Namespace(session_id=sid))
|
||||
|
||||
|
||||
def auth_import():
|
||||
try:
|
||||
cli.auth(Namespace(import_egs_auth=True))
|
||||
except:
|
||||
pass
|
Loading…
Reference in a new issue