Add prefix path select dialog to LoginDialog.
* Make exception handling more general in InstallDialog. * Fix the title of PathEdit file selection dialog.
This commit is contained in:
parent
90ac9a1574
commit
f49cc413dd
4 changed files with 18 additions and 10 deletions
|
@ -241,7 +241,7 @@ class InstallInfoWorker(QRunnable):
|
|||
sdl_prompt=lambda app_name, title: self.dl_item.options.sdl_list
|
||||
))
|
||||
self.signals.result.emit(download)
|
||||
except RuntimeError as e:
|
||||
except Exception as e:
|
||||
self.signals.failed.emit(str(e))
|
||||
self.signals.finished.emit()
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
from dataclasses import dataclass
|
||||
|
||||
from PyQt5.QtCore import Qt
|
||||
from PyQt5.QtWidgets import QDialog, QVBoxLayout, QLabel, QWidget, QPushButton
|
||||
from PyQt5.QtWidgets import QDialog
|
||||
from custom_legendary.core import LegendaryCore
|
||||
|
||||
from rare.components.dialogs.login.browser_login import BrowserLogin
|
||||
|
@ -12,7 +12,7 @@ from rare.ui.components.dialogs.login.login_dialog import Ui_LoginDialog
|
|||
|
||||
@dataclass
|
||||
class LoginPages:
|
||||
login: int
|
||||
landing: int
|
||||
browser: int
|
||||
import_egl: int
|
||||
success: int
|
||||
|
@ -20,7 +20,7 @@ class LoginPages:
|
|||
|
||||
class LoginDialog(QDialog, Ui_LoginDialog):
|
||||
logged_in: bool = False
|
||||
pages = LoginPages(0, 1, 2, 3)
|
||||
pages = LoginPages(landing=0, browser=1, import_egl=2, success=3)
|
||||
|
||||
def __init__(self, core: LegendaryCore, parent=None):
|
||||
super(LoginDialog, self).__init__(parent=parent)
|
||||
|
@ -52,7 +52,7 @@ class LoginDialog(QDialog, Ui_LoginDialog):
|
|||
self.back_button.clicked.connect(self.back_clicked)
|
||||
self.next_button.clicked.connect(self.next_clicked)
|
||||
|
||||
self.login_stack.setCurrentIndex(self.pages.login)
|
||||
self.login_stack.setCurrentIndex(self.pages.landing)
|
||||
|
||||
self.resize(self.minimumSizeHint())
|
||||
self.setFixedSize(self.size())
|
||||
|
@ -60,10 +60,10 @@ class LoginDialog(QDialog, Ui_LoginDialog):
|
|||
def back_clicked(self):
|
||||
self.back_button.setEnabled(False)
|
||||
self.next_button.setEnabled(True)
|
||||
self.login_stack.setCurrentIndex(self.pages.login)
|
||||
self.login_stack.setCurrentIndex(self.pages.landing)
|
||||
|
||||
def next_clicked(self):
|
||||
if self.login_stack.currentIndex() == self.pages.login:
|
||||
if self.login_stack.currentIndex() == self.pages.landing:
|
||||
if self.login_browser_radio.isChecked():
|
||||
self.login_stack.setCurrentIndex(self.pages.browser)
|
||||
self.next_button.setEnabled(False)
|
||||
|
|
|
@ -3,7 +3,7 @@ from getpass import getuser
|
|||
from logging import getLogger
|
||||
|
||||
from PyQt5.QtCore import pyqtSignal
|
||||
from PyQt5.QtWidgets import QWidget
|
||||
from PyQt5.QtWidgets import QWidget, QFileDialog
|
||||
from custom_legendary.core import LegendaryCore
|
||||
|
||||
from rare.ui.components.dialogs.login.import_login import Ui_ImportLogin
|
||||
|
@ -46,13 +46,14 @@ class ImportLogin(QWidget, Ui_ImportLogin):
|
|||
self.status_label.setText(self.tr("Select the Wine prefix you want to import."))
|
||||
else:
|
||||
self.status_label.setText(self.tr("Could not any EGL Program Data."))
|
||||
|
||||
self.prefix_tool.clicked.connect(self.prefix_path)
|
||||
self.prefix_combo.editTextChanged.connect(self.changed.emit)
|
||||
|
||||
def get_wine_prefixes(self):
|
||||
possible_prefixes = [
|
||||
os.path.expanduser("~/.wine"),
|
||||
os.path.expanduser("~/Games/epic-games-store"),
|
||||
os.path.expanduser("~/Wine/Stores")
|
||||
]
|
||||
prefixes = []
|
||||
for prefix in possible_prefixes:
|
||||
|
@ -60,6 +61,13 @@ class ImportLogin(QWidget, Ui_ImportLogin):
|
|||
prefixes.append(prefix)
|
||||
return prefixes
|
||||
|
||||
def prefix_path(self):
|
||||
prefix_dialog = QFileDialog(self, self.tr("Choose path"), os.path.expanduser("~/"))
|
||||
prefix_dialog.setFileMode(QFileDialog.DirectoryOnly)
|
||||
if prefix_dialog.exec_():
|
||||
names = prefix_dialog.selectedFiles()
|
||||
self.prefix_combo.setCurrentText(names[0])
|
||||
|
||||
def is_valid(self):
|
||||
if os.name == "nt":
|
||||
return self.found
|
||||
|
|
|
@ -163,7 +163,7 @@ class PathEdit(QWidget, Ui_PathEdit):
|
|||
dlg_path = self.text_edit.text()
|
||||
if not dlg_path:
|
||||
dlg_path = os.path.expanduser("~/")
|
||||
dlg = QFileDialog(self, self.tr("Choose Path"), dlg_path)
|
||||
dlg = QFileDialog(self, self.tr("Choose path"), dlg_path)
|
||||
dlg.setFileMode(self.file_type)
|
||||
if self.type_filter:
|
||||
dlg.setFilter([self.type_filter])
|
||||
|
|
Loading…
Reference in a new issue