1
0
Fork 0
mirror of synced 2024-06-23 08:40:45 +12:00

Merge pull request #207 from loathingKernel/install_shared_memory

Add max shared memory override and download reordering options
This commit is contained in:
Dummerle 2022-05-30 17:55:18 +02:00 committed by GitHub
commit 405379ef3b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 218 additions and 118 deletions

View file

@ -1,11 +1,12 @@
import os
import platform
import sys
from multiprocessing import Queue as MPQueue
from typing import Tuple
from PyQt5.QtCore import Qt, QObject, QRunnable, QThreadPool, pyqtSignal, pyqtSlot
from PyQt5.QtGui import QCloseEvent, QKeyEvent
from PyQt5.QtWidgets import QDialog, QFileDialog, QCheckBox, QMessageBox
from PyQt5.QtWidgets import QDialog, QFileDialog, QCheckBox
from legendary.core import LegendaryCore
from legendary.models.downloading import ConditionCheckResult
from legendary.models.game import Game
@ -21,9 +22,7 @@ from rare.utils.utils import get_size
class InstallDialog(QDialog, Ui_InstallDialog):
result_ready = pyqtSignal(InstallQueueItemModel)
def __init__(
self, dl_item: InstallQueueItemModel, update=False, silent=False, parent=None
):
def __init__(self, dl_item: InstallQueueItemModel, update=False, silent=False, parent=None):
super(InstallDialog, self).__init__(parent)
self.setupUi(self)
self.setAttribute(Qt.WA_DeleteOnClose, True)
@ -34,12 +33,13 @@ class InstallDialog(QDialog, Ui_InstallDialog):
self.dl_item = dl_item
self.dl_item.status_q = MPQueue()
self.app_name = self.dl_item.options.app_name
self.game = self.core.get_game(self.app_name) \
if not self.dl_item.options.overlay \
self.game = (
self.core.get_game(self.app_name)
if not self.dl_item.options.overlay
else Game(app_name=self.app_name, app_title="Epic Overlay")
)
self.game_path = self.game.metadata.get('customAttributes', {}). \
get('FolderName', {}).get('value', "")
self.game_path = self.game.metadata.get("customAttributes", {}).get("FolderName", {}).get("value", "")
self.update = update
self.silent = silent
@ -56,8 +56,9 @@ class InstallDialog(QDialog, Ui_InstallDialog):
self.setWindowTitle(f'{self.windowTitle()} - {header} "{self.game.app_title}"')
if not self.dl_item.options.base_path:
self.dl_item.options.base_path = self.core.lgd.config.get("Legendary", "install_dir",
fallback=os.path.expanduser("~/legendary"))
self.dl_item.options.base_path = self.core.lgd.config.get(
"Legendary", "install_dir", fallback=os.path.expanduser("~/legendary")
)
self.install_dir_edit = PathEdit(
path=self.dl_item.options.base_path,
@ -74,8 +75,7 @@ class InstallDialog(QDialog, Ui_InstallDialog):
self.shortcut_cb.setVisible(False)
self.shortcut_cb.setChecked(False)
self.warn_label.setVisible(False)
self.warn_message.setVisible(False)
self.error_box()
platforms = ["Windows"]
if dl_item.options.app_name in self.api_results.bit32_games:
@ -83,42 +83,32 @@ class InstallDialog(QDialog, Ui_InstallDialog):
if dl_item.options.app_name in self.api_results.mac_games:
platforms.append("Mac")
self.platform_combo_box.addItems(platforms)
self.platform_combo_box.currentIndexChanged.connect(lambda: self.option_changed(None))
self.platform_combo_box.currentIndexChanged.connect(
lambda: self.option_changed(None)
)
self.platform_combo_box.currentIndexChanged.connect(
lambda i: QMessageBox.warning(
self,
"Warning",
lambda i: self.error_box(
self.tr("Warning"),
self.tr("You will not be able to run the Game if you choose {}").format(
self.platform_combo_box.itemText(i)
),
)
if (
self.platform_combo_box.currentText() == "Mac"
and platform.system() != "Darwin"
)
if (self.platform_combo_box.currentText() == "Mac" and platform.system() != "Darwin")
else None
)
if platform.system() == "Darwin" and "Mac" in platforms:
self.platform_combo_box.setCurrentIndex(platforms.index("Mac"))
if self.core.lgd.config.has_option("Legendary", "max_workers"):
max_workers = self.core.lgd.config.get("Legendary", "max_workers")
else:
max_workers = 0
self.max_workers_spin.setValue(int(max_workers))
self.max_workers_spin.setValue(self.core.lgd.config.getint("Legendary", "max_workers", fallback=0))
self.max_workers_spin.valueChanged.connect(self.option_changed)
self.max_memory_spin.setValue(self.core.lgd.config.getint("Legendary", "max_memory", fallback=0))
self.max_memory_spin.valueChanged.connect(self.option_changed)
self.dl_optimizations_check.stateChanged.connect(self.option_changed)
self.force_download_check.stateChanged.connect(self.option_changed)
self.ignore_space_check.stateChanged.connect(self.option_changed)
self.download_only_check.stateChanged.connect(
lambda: self.non_reload_option_changed("download_only")
)
self.shortcut_cb.stateChanged.connect(
lambda: self.non_reload_option_changed("shortcut")
)
self.download_only_check.stateChanged.connect(lambda: self.non_reload_option_changed("download_only"))
self.shortcut_cb.stateChanged.connect(lambda: self.non_reload_option_changed("shortcut"))
self.sdl_list_checks = list()
try:
for key, info in games[self.app_name].items():
@ -164,7 +154,6 @@ class InstallDialog(QDialog, Ui_InstallDialog):
self.install_button.clicked.connect(self.install_clicked)
self.resize(self.minimumSize())
# self.setFixedSize(self.size())
def execute(self):
if self.silent:
@ -175,15 +164,15 @@ class InstallDialog(QDialog, Ui_InstallDialog):
self.show()
def get_options(self):
self.dl_item.options.base_path = (
self.install_dir_edit.text() if not self.update else None
)
self.dl_item.options.base_path = self.install_dir_edit.text() if not self.update else None
self.dl_item.options.max_workers = self.max_workers_spin.value()
self.dl_item.options.max_shm = self.max_memory_spin.value()
self.dl_item.options.dl_optimizations = self.dl_optimizations_check.isChecked()
self.dl_item.options.force = self.force_download_check.isChecked()
self.dl_item.options.ignore_space_req = self.ignore_space_check.isChecked()
self.dl_item.options.no_install = self.download_only_check.isChecked()
self.dl_item.options.install_platform = self.platform_combo_box.currentText()
self.dl_item.options.platform = self.platform_combo_box.currentText()
self.dl_item.options.sdl_list = [""]
for cb in self.sdl_list_checks:
if data := cb.isChecked():
@ -201,15 +190,12 @@ class InstallDialog(QDialog, Ui_InstallDialog):
self.threadpool.start(info_worker)
def verify_clicked(self):
self.error_box()
message = self.tr("Updating...")
self.download_size_info_label.setText(message)
self.download_size_info_label.setStyleSheet(
"font-style: italic; font-weight: normal"
)
self.download_size_info_label.setStyleSheet("font-style: italic; font-weight: normal")
self.install_size_info_label.setText(message)
self.install_size_info_label.setStyleSheet(
"font-style: italic; font-weight: normal"
)
self.install_size_info_label.setStyleSheet("font-style: italic; font-weight: normal")
self.cancel_button.setEnabled(False)
self.verify_button.setEnabled(False)
self.install_button.setEnabled(False)
@ -246,19 +232,13 @@ class InstallDialog(QDialog, Ui_InstallDialog):
install_size = self.dl_item.download.analysis.install_size
if download_size:
self.download_size_info_label.setText("{}".format(get_size(download_size)))
self.download_size_info_label.setStyleSheet(
"font-style: normal; font-weight: bold"
)
self.download_size_info_label.setStyleSheet("font-style: normal; font-weight: bold")
self.install_button.setEnabled(not self.options_changed)
else:
self.install_size_info_label.setText(self.tr("Game already installed"))
self.install_size_info_label.setStyleSheet(
"font-style: italics; font-weight: normal"
)
self.install_size_info_label.setStyleSheet("font-style: italics; font-weight: normal")
self.install_size_info_label.setText("{}".format(get_size(install_size)))
self.install_size_info_label.setStyleSheet(
"font-style: normal; font-weight: bold"
)
self.install_size_info_label.setStyleSheet("font-style: normal; font-weight: bold")
self.verify_button.setEnabled(self.options_changed)
self.cancel_button.setEnabled(True)
if self.silent:
@ -268,22 +248,25 @@ class InstallDialog(QDialog, Ui_InstallDialog):
self.install_preqs_check.setVisible(True)
self.install_preqs_lbl.setVisible(True)
self.install_preqs_check.setText(
self.tr("This will install {}").format(dl_item.igame.prereq_info.get("name", "")))
self.tr("Also install: {}").format(dl_item.igame.prereq_info.get("name", ""))
)
def on_worker_failed(self, message: str):
error_text = self.tr("Error")
self.download_size_info_label.setText(error_text)
self.install_size_info_label.setText(error_text)
self.warn_label.setText(error_text)
self.warn_message.setText(message)
self.warn_message.setVisible(True)
self.warn_label.setVisible(True)
QMessageBox.critical(self, self.windowTitle(), message)
self.error_box(error_text, message)
self.verify_button.setEnabled(self.options_changed)
self.cancel_button.setEnabled(True)
if self.silent:
self.close()
def error_box(self, label: str = "", message: str = ""):
self.warn_label.setVisible(bool(label))
self.warn_label.setText(label)
self.warn_message.setVisible(bool(message))
self.warn_message.setText(message)
def on_worker_finished(self):
self.worker_running = False
@ -305,13 +288,13 @@ class InstallDialog(QDialog, Ui_InstallDialog):
class InstallInfoWorker(QRunnable):
class Signals(QObject):
result = pyqtSignal(InstallDownloadModel)
failed = pyqtSignal(str)
finished = pyqtSignal()
def __init__(self, core: LegendaryCore, dl_item: InstallQueueItemModel, game: Game = None):
sys.excepthook = sys.__excepthook__
super(InstallInfoWorker, self).__init__()
self.signals = InstallInfoWorker.Signals()
self.core = core
@ -330,18 +313,18 @@ class InstallInfoWorker(QRunnable):
force=self.dl_item.options.force,
no_install=self.dl_item.options.no_install,
status_q=self.dl_item.status_q,
# max_shm=,
max_shm=self.dl_item.options.max_shm,
max_workers=self.dl_item.options.max_workers,
# game_folder=,
# disable_patching=,
# override_manifest=,
# override_old_manifest=,
# override_base_url=,
platform=self.dl_item.options.install_platform,
platform=self.dl_item.options.platform,
# file_prefix_filter=,
# file_exclude_filter=,
# file_install_tag=,
# dl_optimizations=,
dl_optimizations=self.dl_item.options.dl_optimizations,
# dl_timeout=,
repair=self.dl_item.options.repair,
# repair_use_latest=,
@ -361,7 +344,7 @@ class InstallInfoWorker(QRunnable):
path=self.dl_item.options.base_path,
status_queue=self.dl_item.status_q,
max_workers=self.dl_item.options.max_workers,
force=self.dl_item.options.force
force=self.dl_item.options.force,
)
download = InstallDownloadModel(
@ -371,15 +354,13 @@ class InstallInfoWorker(QRunnable):
igame=igame,
repair=False,
repair_file="",
res=ConditionCheckResult() # empty
res=ConditionCheckResult(), # empty
)
if not download.res or not download.res.failures:
self.signals.result.emit(download)
else:
self.signals.failed.emit(
"\n".join(str(i) for i in download.res.failures)
)
self.signals.failed.emit("\n".join(str(i) for i in download.res.failures))
except Exception as e:
self.signals.failed.emit(str(e))
self.signals.finished.emit()

View file

@ -14,7 +14,7 @@ from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_InstallDialog(object):
def setupUi(self, InstallDialog):
InstallDialog.setObjectName("InstallDialog")
InstallDialog.resize(337, 372)
InstallDialog.resize(406, 447)
InstallDialog.setWindowTitle("Rare")
self.install_dialog_layout = QtWidgets.QFormLayout(InstallDialog)
self.install_dialog_layout.setSizeConstraint(QtWidgets.QLayout.SetFixedSize)
@ -51,7 +51,7 @@ class Ui_InstallDialog(object):
self.install_dialog_layout.setLayout(3, QtWidgets.QFormLayout.FieldRole, self.max_workers_layout)
self.force_download_label = QtWidgets.QLabel(InstallDialog)
self.force_download_label.setObjectName("force_download_label")
self.install_dialog_layout.setWidget(4, QtWidgets.QFormLayout.LabelRole, self.force_download_label)
self.install_dialog_layout.setWidget(6, QtWidgets.QFormLayout.LabelRole, self.force_download_label)
self.force_download_check = QtWidgets.QCheckBox(InstallDialog)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
@ -60,7 +60,7 @@ class Ui_InstallDialog(object):
self.force_download_check.setSizePolicy(sizePolicy)
self.force_download_check.setText("")
self.force_download_check.setObjectName("force_download_check")
self.install_dialog_layout.setWidget(4, QtWidgets.QFormLayout.FieldRole, self.force_download_check)
self.install_dialog_layout.setWidget(6, QtWidgets.QFormLayout.FieldRole, self.force_download_check)
self.platform_label = QtWidgets.QLabel(InstallDialog)
self.platform_label.setObjectName("platform_label")
self.install_dialog_layout.setWidget(2, QtWidgets.QFormLayout.LabelRole, self.platform_label)
@ -74,20 +74,20 @@ class Ui_InstallDialog(object):
self.install_dialog_layout.setWidget(2, QtWidgets.QFormLayout.FieldRole, self.platform_combo_box)
self.ignore_space_label = QtWidgets.QLabel(InstallDialog)
self.ignore_space_label.setObjectName("ignore_space_label")
self.install_dialog_layout.setWidget(5, QtWidgets.QFormLayout.LabelRole, self.ignore_space_label)
self.install_dialog_layout.setWidget(7, QtWidgets.QFormLayout.LabelRole, self.ignore_space_label)
self.download_only_label = QtWidgets.QLabel(InstallDialog)
self.download_only_label.setObjectName("download_only_label")
self.install_dialog_layout.setWidget(6, QtWidgets.QFormLayout.LabelRole, self.download_only_label)
self.install_dialog_layout.setWidget(8, QtWidgets.QFormLayout.LabelRole, self.download_only_label)
self.shortcut_lbl = QtWidgets.QLabel(InstallDialog)
self.shortcut_lbl.setObjectName("shortcut_lbl")
self.install_dialog_layout.setWidget(7, QtWidgets.QFormLayout.LabelRole, self.shortcut_lbl)
self.install_dialog_layout.setWidget(9, QtWidgets.QFormLayout.LabelRole, self.shortcut_lbl)
self.shortcut_cb = QtWidgets.QCheckBox(InstallDialog)
self.shortcut_cb.setText("")
self.shortcut_cb.setObjectName("shortcut_cb")
self.install_dialog_layout.setWidget(7, QtWidgets.QFormLayout.FieldRole, self.shortcut_cb)
self.install_dialog_layout.setWidget(9, QtWidgets.QFormLayout.FieldRole, self.shortcut_cb)
self.sdl_list_label = QtWidgets.QLabel(InstallDialog)
self.sdl_list_label.setObjectName("sdl_list_label")
self.install_dialog_layout.setWidget(9, QtWidgets.QFormLayout.LabelRole, self.sdl_list_label)
self.install_dialog_layout.setWidget(11, QtWidgets.QFormLayout.LabelRole, self.sdl_list_label)
self.sdl_list_frame = QtWidgets.QFrame(InstallDialog)
self.sdl_list_frame.setFrameShape(QtWidgets.QFrame.StyledPanel)
self.sdl_list_frame.setFrameShadow(QtWidgets.QFrame.Raised)
@ -95,36 +95,38 @@ class Ui_InstallDialog(object):
self.sdl_list_layout = QtWidgets.QVBoxLayout(self.sdl_list_frame)
self.sdl_list_layout.setSpacing(0)
self.sdl_list_layout.setObjectName("sdl_list_layout")
self.install_dialog_layout.setWidget(9, QtWidgets.QFormLayout.FieldRole, self.sdl_list_frame)
self.install_dialog_layout.setWidget(11, QtWidgets.QFormLayout.FieldRole, self.sdl_list_frame)
self.download_size_label = QtWidgets.QLabel(InstallDialog)
self.download_size_label.setObjectName("download_size_label")
self.install_dialog_layout.setWidget(11, QtWidgets.QFormLayout.LabelRole, self.download_size_label)
self.install_dialog_layout.setWidget(13, QtWidgets.QFormLayout.LabelRole, self.download_size_label)
self.download_size_info_label = QtWidgets.QLabel(InstallDialog)
font = QtGui.QFont()
font.setItalic(True)
self.download_size_info_label.setFont(font)
self.download_size_info_label.setObjectName("download_size_info_label")
self.install_dialog_layout.setWidget(11, QtWidgets.QFormLayout.FieldRole, self.download_size_info_label)
self.install_dialog_layout.setWidget(13, QtWidgets.QFormLayout.FieldRole, self.download_size_info_label)
self.install_size_label = QtWidgets.QLabel(InstallDialog)
self.install_size_label.setObjectName("install_size_label")
self.install_dialog_layout.setWidget(12, QtWidgets.QFormLayout.LabelRole, self.install_size_label)
self.install_dialog_layout.setWidget(14, QtWidgets.QFormLayout.LabelRole, self.install_size_label)
self.install_size_info_label = QtWidgets.QLabel(InstallDialog)
font = QtGui.QFont()
font.setItalic(True)
self.install_size_info_label.setFont(font)
self.install_size_info_label.setWordWrap(True)
self.install_size_info_label.setObjectName("install_size_info_label")
self.install_dialog_layout.setWidget(12, QtWidgets.QFormLayout.FieldRole, self.install_size_info_label)
self.install_dialog_layout.setWidget(14, QtWidgets.QFormLayout.FieldRole, self.install_size_info_label)
self.warn_message = QtWidgets.QLabel(InstallDialog)
font = QtGui.QFont()
font.setItalic(True)
self.warn_message.setFont(font)
self.warn_message.setFrameShape(QtWidgets.QFrame.StyledPanel)
self.warn_message.setFrameShadow(QtWidgets.QFrame.Sunken)
self.warn_message.setWordWrap(True)
self.warn_message.setObjectName("warn_message")
self.install_dialog_layout.setWidget(13, QtWidgets.QFormLayout.FieldRole, self.warn_message)
self.install_dialog_layout.setWidget(15, QtWidgets.QFormLayout.FieldRole, self.warn_message)
self.warn_label = QtWidgets.QLabel(InstallDialog)
self.warn_label.setObjectName("warn_label")
self.install_dialog_layout.setWidget(13, QtWidgets.QFormLayout.LabelRole, self.warn_label)
self.install_dialog_layout.setWidget(15, QtWidgets.QFormLayout.LabelRole, self.warn_label)
self.button_layout = QtWidgets.QHBoxLayout()
self.button_layout.setObjectName("button_layout")
spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
@ -138,14 +140,17 @@ class Ui_InstallDialog(object):
self.install_button = QtWidgets.QPushButton(InstallDialog)
self.install_button.setObjectName("install_button")
self.button_layout.addWidget(self.install_button)
self.install_dialog_layout.setLayout(14, QtWidgets.QFormLayout.SpanningRole, self.button_layout)
self.install_dialog_layout.setLayout(16, QtWidgets.QFormLayout.SpanningRole, self.button_layout)
self.install_preqs_lbl = QtWidgets.QLabel(InstallDialog)
self.install_preqs_lbl.setObjectName("install_preqs_lbl")
self.install_dialog_layout.setWidget(8, QtWidgets.QFormLayout.LabelRole, self.install_preqs_lbl)
self.install_dialog_layout.setWidget(10, QtWidgets.QFormLayout.LabelRole, self.install_preqs_lbl)
self.install_preqs_check = QtWidgets.QCheckBox(InstallDialog)
font = QtGui.QFont()
font.setItalic(True)
self.install_preqs_check.setFont(font)
self.install_preqs_check.setText("")
self.install_preqs_check.setObjectName("install_preqs_check")
self.install_dialog_layout.setWidget(8, QtWidgets.QFormLayout.FieldRole, self.install_preqs_check)
self.install_dialog_layout.setWidget(10, QtWidgets.QFormLayout.FieldRole, self.install_preqs_check)
self.ignore_space_check = QtWidgets.QCheckBox(InstallDialog)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
@ -156,7 +161,7 @@ class Ui_InstallDialog(object):
font.setItalic(True)
self.ignore_space_check.setFont(font)
self.ignore_space_check.setObjectName("ignore_space_check")
self.install_dialog_layout.setWidget(5, QtWidgets.QFormLayout.FieldRole, self.ignore_space_check)
self.install_dialog_layout.setWidget(7, QtWidgets.QFormLayout.FieldRole, self.ignore_space_check)
self.download_only_check = QtWidgets.QCheckBox(InstallDialog)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
@ -167,7 +172,39 @@ class Ui_InstallDialog(object):
font.setItalic(True)
self.download_only_check.setFont(font)
self.download_only_check.setObjectName("download_only_check")
self.install_dialog_layout.setWidget(6, QtWidgets.QFormLayout.FieldRole, self.download_only_check)
self.install_dialog_layout.setWidget(8, QtWidgets.QFormLayout.FieldRole, self.download_only_check)
self.max_memory_label = QtWidgets.QLabel(InstallDialog)
self.max_memory_label.setObjectName("max_memory_label")
self.install_dialog_layout.setWidget(4, QtWidgets.QFormLayout.LabelRole, self.max_memory_label)
self.max_memory_layout = QtWidgets.QHBoxLayout()
self.max_memory_layout.setObjectName("max_memory_layout")
self.max_memory_spin = QtWidgets.QSpinBox(InstallDialog)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.max_memory_spin.sizePolicy().hasHeightForWidth())
self.max_memory_spin.setSizePolicy(sizePolicy)
self.max_memory_spin.setMinimum(0)
self.max_memory_spin.setMaximum(10240)
self.max_memory_spin.setSingleStep(128)
self.max_memory_spin.setProperty("value", 1024)
self.max_memory_spin.setObjectName("max_memory_spin")
self.max_memory_layout.addWidget(self.max_memory_spin)
self.max_memory_info_label = QtWidgets.QLabel(InstallDialog)
font = QtGui.QFont()
font.setItalic(True)
self.max_memory_info_label.setFont(font)
self.max_memory_info_label.setObjectName("max_memory_info_label")
self.max_memory_layout.addWidget(self.max_memory_info_label)
self.install_dialog_layout.setLayout(4, QtWidgets.QFormLayout.FieldRole, self.max_memory_layout)
self.dl_optimizations_label = QtWidgets.QLabel(InstallDialog)
self.dl_optimizations_label.setObjectName("dl_optimizations_label")
self.install_dialog_layout.setWidget(5, QtWidgets.QFormLayout.LabelRole, self.dl_optimizations_label)
self.dl_optimizations_check = QtWidgets.QCheckBox(InstallDialog)
self.dl_optimizations_check.setText("")
self.dl_optimizations_check.setChecked(False)
self.dl_optimizations_check.setObjectName("dl_optimizations_check")
self.install_dialog_layout.setWidget(5, QtWidgets.QFormLayout.FieldRole, self.dl_optimizations_check)
self.retranslateUi(InstallDialog)
QtCore.QMetaObject.connectSlotsByName(InstallDialog)
@ -189,13 +226,17 @@ class Ui_InstallDialog(object):
self.install_size_label.setText(_translate("InstallDialog", "Total install size"))
self.install_size_info_label.setText(_translate("InstallDialog", "Click verify..."))
self.warn_message.setText(_translate("InstallDialog", "None"))
self.warn_label.setText(_translate("InstallDialog", "Warnings"))
self.warn_label.setText(_translate("InstallDialog", "Warning"))
self.cancel_button.setText(_translate("InstallDialog", "Cancel"))
self.verify_button.setText(_translate("InstallDialog", "Verify"))
self.install_button.setText(_translate("InstallDialog", "Install"))
self.install_preqs_lbl.setText(_translate("InstallDialog", "Install prerequisites"))
self.ignore_space_check.setText(_translate("InstallDialog", "Use with caution!"))
self.download_only_check.setText(_translate("InstallDialog", "Do not try to install."))
self.max_memory_label.setText(_translate("InstallDialog", "Max shared memory"))
self.max_memory_spin.setSuffix(_translate("InstallDialog", "MiB"))
self.max_memory_info_label.setText(_translate("InstallDialog", "Less is slower (0: Default)"))
self.dl_optimizations_label.setText(_translate("InstallDialog", "Enable reordering"))
if __name__ == "__main__":

View file

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>337</width>
<height>372</height>
<width>406</width>
<height>447</height>
</rect>
</property>
<property name="windowTitle">
@ -70,14 +70,14 @@
</item>
</layout>
</item>
<item row="4" column="0">
<item row="6" column="0">
<widget class="QLabel" name="force_download_label">
<property name="text">
<string>Force redownload</string>
</property>
</widget>
</item>
<item row="4" column="1">
<item row="6" column="1">
<widget class="QCheckBox" name="force_download_check">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
@ -107,42 +107,42 @@
</property>
</widget>
</item>
<item row="5" column="0">
<item row="7" column="0">
<widget class="QLabel" name="ignore_space_label">
<property name="text">
<string>Ignore free space</string>
</property>
</widget>
</item>
<item row="6" column="0">
<item row="8" column="0">
<widget class="QLabel" name="download_only_label">
<property name="text">
<string>Download only</string>
</property>
</widget>
</item>
<item row="7" column="0">
<item row="9" column="0">
<widget class="QLabel" name="shortcut_lbl">
<property name="text">
<string>Create shortcut</string>
</property>
</widget>
</item>
<item row="7" column="1">
<item row="9" column="1">
<widget class="QCheckBox" name="shortcut_cb">
<property name="text">
<string notr="true"/>
</property>
</widget>
</item>
<item row="9" column="0">
<item row="11" column="0">
<widget class="QLabel" name="sdl_list_label">
<property name="text">
<string>Optional packs</string>
</property>
</widget>
</item>
<item row="9" column="1">
<item row="11" column="1">
<widget class="QFrame" name="sdl_list_frame">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
@ -157,14 +157,14 @@
</layout>
</widget>
</item>
<item row="11" column="0">
<item row="13" column="0">
<widget class="QLabel" name="download_size_label">
<property name="text">
<string>Download size</string>
</property>
</widget>
</item>
<item row="11" column="1">
<item row="13" column="1">
<widget class="QLabel" name="download_size_info_label">
<property name="font">
<font>
@ -176,14 +176,14 @@
</property>
</widget>
</item>
<item row="12" column="0">
<item row="14" column="0">
<widget class="QLabel" name="install_size_label">
<property name="text">
<string>Total install size</string>
</property>
</widget>
</item>
<item row="12" column="1">
<item row="14" column="1">
<widget class="QLabel" name="install_size_info_label">
<property name="font">
<font>
@ -198,13 +198,19 @@
</property>
</widget>
</item>
<item row="13" column="1">
<item row="15" column="1">
<widget class="QLabel" name="warn_message">
<property name="font">
<font>
<italic>true</italic>
</font>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Sunken</enum>
</property>
<property name="text">
<string>None</string>
</property>
@ -213,14 +219,14 @@
</property>
</widget>
</item>
<item row="13" column="0">
<item row="15" column="0">
<widget class="QLabel" name="warn_label">
<property name="text">
<string>Warnings</string>
<string>Warning</string>
</property>
</widget>
</item>
<item row="14" column="0" colspan="2">
<item row="16" column="0" colspan="2">
<layout class="QHBoxLayout" name="button_layout">
<item>
<spacer name="button_hspacer">
@ -258,21 +264,26 @@
</item>
</layout>
</item>
<item row="8" column="0">
<item row="10" column="0">
<widget class="QLabel" name="install_preqs_lbl">
<property name="text">
<string>Install prerequisites</string>
</property>
</widget>
</item>
<item row="8" column="1">
<item row="10" column="1">
<widget class="QCheckBox" name="install_preqs_check">
<property name="font">
<font>
<italic>true</italic>
</font>
</property>
<property name="text">
<string notr="true"/>
</property>
</widget>
</item>
<item row="5" column="1">
<item row="7" column="1">
<widget class="QCheckBox" name="ignore_space_check">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
@ -290,7 +301,7 @@
</property>
</widget>
</item>
<item row="6" column="1">
<item row="8" column="1">
<widget class="QCheckBox" name="download_only_check">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
@ -308,6 +319,71 @@
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="max_memory_label">
<property name="text">
<string>Max shared memory</string>
</property>
</widget>
</item>
<item row="4" column="1">
<layout class="QHBoxLayout" name="max_memory_layout">
<item>
<widget class="QSpinBox" name="max_memory_spin">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="suffix">
<string>MiB</string>
</property>
<property name="minimum">
<number>0</number>
</property>
<property name="maximum">
<number>10240</number>
</property>
<property name="singleStep">
<number>128</number>
</property>
<property name="value">
<number>1024</number>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="max_memory_info_label">
<property name="font">
<font>
<italic>true</italic>
</font>
</property>
<property name="text">
<string>Less is slower (0: Default)</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="5" column="0">
<widget class="QLabel" name="dl_optimizations_label">
<property name="text">
<string>Enable reordering</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QCheckBox" name="dl_optimizations_check">
<property name="text">
<string notr="true"/>
</property>
<property name="checked">
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>

View file

@ -14,7 +14,7 @@ from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_LegendarySettings(object):
def setupUi(self, LegendarySettings):
LegendarySettings.setObjectName("LegendarySettings")
LegendarySettings.resize(552, 334)
LegendarySettings.resize(595, 334)
LegendarySettings.setWindowTitle("LegendarySettings")
self.legendary_layout = QtWidgets.QHBoxLayout(LegendarySettings)
self.legendary_layout.setObjectName("legendary_layout")
@ -159,7 +159,7 @@ class Ui_LegendarySettings(object):
self.download_group.setTitle(_translate("LegendarySettings", "Download Settings"))
self.max_workers_label.setText(_translate("LegendarySettings", "Max Workers"))
self.max_workers_info_label.setText(_translate("LegendarySettings", "Less is slower (0: Default)"))
self.max_memory_label.setText(_translate("LegendarySettings", "Max Memory"))
self.max_memory_label.setText(_translate("LegendarySettings", "Max Shared Memory"))
self.max_memory_spin.setSuffix(_translate("LegendarySettings", "MiB"))
self.max_memory_info_label.setText(_translate("LegendarySettings", "Less is slower (0: Default)"))
self.preferred_cdn_label.setText(_translate("LegendarySettings", "Preferred CDN"))

View file

@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>552</width>
<width>595</width>
<height>334</height>
</rect>
</property>
@ -90,7 +90,7 @@
<item row="1" column="0">
<widget class="QLabel" name="max_memory_label">
<property name="text">
<string>Max Memory</string>
<string>Max Shared Memory</string>
</property>
</widget>
</item>

View file

@ -1,5 +1,5 @@
import os
import platform
import platform as pf
from dataclasses import field, dataclass
from multiprocessing import Queue
from typing import Union, List, Optional
@ -16,6 +16,7 @@ from legendary.models.game import Game, InstalledGame
class InstallOptionsModel:
app_name: str
base_path: str = ""
max_shm: int = 1024
max_workers: int = os.cpu_count() * 2
repair: bool = False
no_install: bool = False
@ -24,10 +25,11 @@ class InstallOptionsModel:
sdl_list: list = field(default_factory=lambda: [""])
update: bool = False
silent: bool = False
install_platform: str = ""
platform: str = ""
dl_optimizations: bool = False
overlay: bool = False
create_shortcut: bool = True
install_preqs: bool = platform.system() == "Windows"
install_preqs: bool = pf.system() == "Windows"
def set_no_install(self, enabled: bool) -> None:
self.no_install = enabled