Add download option to create a shortcut after installation
This commit is contained in:
parent
7ef59ecb09
commit
8f83b4adde
9 changed files with 194 additions and 137 deletions
|
@ -69,6 +69,9 @@ class InstallDialog(QDialog, Ui_InstallDialog):
|
||||||
if self.update:
|
if self.update:
|
||||||
self.install_dir_label.setVisible(False)
|
self.install_dir_label.setVisible(False)
|
||||||
self.install_dir_edit.setVisible(False)
|
self.install_dir_edit.setVisible(False)
|
||||||
|
self.shortcut_lbl.setVisible(False)
|
||||||
|
self.shortcut_cb.setVisible(False)
|
||||||
|
self.shortcut_cb.setChecked(False)
|
||||||
|
|
||||||
self.warn_label.setVisible(False)
|
self.warn_label.setVisible(False)
|
||||||
self.warn_message.setVisible(False)
|
self.warn_message.setVisible(False)
|
||||||
|
@ -112,6 +115,9 @@ class InstallDialog(QDialog, Ui_InstallDialog):
|
||||||
self.download_only_check.stateChanged.connect(
|
self.download_only_check.stateChanged.connect(
|
||||||
lambda: self.non_reload_option_changed("download_only")
|
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()
|
self.sdl_list_checks = list()
|
||||||
try:
|
try:
|
||||||
for key, info in games[self.app_name].items():
|
for key, info in games[self.app_name].items():
|
||||||
|
@ -143,6 +149,15 @@ class InstallDialog(QDialog, Ui_InstallDialog):
|
||||||
self.download_only_check.setVisible(False)
|
self.download_only_check.setVisible(False)
|
||||||
self.download_only_info_label.setVisible(False)
|
self.download_only_info_label.setVisible(False)
|
||||||
self.download_only_label.setVisible(False)
|
self.download_only_label.setVisible(False)
|
||||||
|
self.shortcut_cb.setVisible(False)
|
||||||
|
self.shortcut_lbl.setVisible(False)
|
||||||
|
|
||||||
|
if platform.system() == "Darwin":
|
||||||
|
self.shortcut_cb.setDisabled(True)
|
||||||
|
self.shortcut_cb.setChecked(False)
|
||||||
|
self.shortcut_cb.setToolTip(self.tr("Creating a shortcut is not supported on MacOS"))
|
||||||
|
|
||||||
|
self.non_reload_option_changed("shortcut")
|
||||||
|
|
||||||
self.cancel_button.clicked.connect(self.cancel_clicked)
|
self.cancel_button.clicked.connect(self.cancel_clicked)
|
||||||
self.verify_button.clicked.connect(self.verify_clicked)
|
self.verify_button.clicked.connect(self.verify_clicked)
|
||||||
|
@ -206,16 +221,13 @@ class InstallDialog(QDialog, Ui_InstallDialog):
|
||||||
self.options_changed = True
|
self.options_changed = True
|
||||||
self.install_button.setEnabled(False)
|
self.install_button.setEnabled(False)
|
||||||
self.verify_button.setEnabled(not self.worker_running)
|
self.verify_button.setEnabled(not self.worker_running)
|
||||||
# directory is not empty
|
|
||||||
full_path = os.path.join(self.dl_item.options.base_path, self.game_path)
|
|
||||||
if not self.dl_item.options.update and os.path.exists(full_path) and len(os.listdir(full_path)) != 0:
|
|
||||||
return False, path, PathEdit.reasons.dir_not_empty
|
|
||||||
|
|
||||||
return True, path, ""
|
return True, path, ""
|
||||||
|
|
||||||
def non_reload_option_changed(self, option: str):
|
def non_reload_option_changed(self, option: str):
|
||||||
if option == "download_only":
|
if option == "download_only":
|
||||||
self.dl_item.options.no_install = self.download_only_check.isChecked()
|
self.dl_item.options.no_install = self.download_only_check.isChecked()
|
||||||
|
elif option == "shortcut":
|
||||||
|
self.dl_item.options.create_shortcut = self.shortcut_cb.isChecked()
|
||||||
|
|
||||||
def cancel_clicked(self):
|
def cancel_clicked(self):
|
||||||
self.dl_item.download = None
|
self.dl_item.download = None
|
||||||
|
@ -254,6 +266,10 @@ class InstallDialog(QDialog, Ui_InstallDialog):
|
||||||
error_text = self.tr("Error")
|
error_text = self.tr("Error")
|
||||||
self.download_size_info_label.setText(error_text)
|
self.download_size_info_label.setText(error_text)
|
||||||
self.install_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)
|
QMessageBox.critical(self, self.windowTitle(), message)
|
||||||
self.verify_button.setEnabled(self.options_changed)
|
self.verify_button.setEnabled(self.options_changed)
|
||||||
self.cancel_button.setEnabled(True)
|
self.cancel_button.setEnabled(True)
|
||||||
|
|
|
@ -15,6 +15,7 @@ from legendary.core import LegendaryCore
|
||||||
from legendary.models.downloading import UIUpdate, WriterTask
|
from legendary.models.downloading import UIUpdate, WriterTask
|
||||||
from rare import shared
|
from rare import shared
|
||||||
from rare.utils.models import InstallQueueItemModel
|
from rare.utils.models import InstallQueueItemModel
|
||||||
|
from rare.utils.utils import create_desktop_link
|
||||||
|
|
||||||
logger = getLogger("DownloadThread")
|
logger = getLogger("DownloadThread")
|
||||||
|
|
||||||
|
@ -190,6 +191,13 @@ class DownloadThread(QThread):
|
||||||
self.core.uninstall_tag(old_igame)
|
self.core.uninstall_tag(old_igame)
|
||||||
self.core.install_game(old_igame)
|
self.core.install_game(old_igame)
|
||||||
|
|
||||||
|
if not self.queue_item.options.update and self.queue_item.options.create_shortcut:
|
||||||
|
if not create_desktop_link(self.queue_item.options.app_name, self.core, "desktop"):
|
||||||
|
# maybe add it to download summary, to show in finished downloads
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
logger.info("Desktop shortcut written")
|
||||||
|
|
||||||
self.status.emit("finish")
|
self.status.emit("finish")
|
||||||
|
|
||||||
def _handle_postinstall(self, postinstall, igame):
|
def _handle_postinstall(self, postinstall, igame):
|
||||||
|
|
|
@ -45,8 +45,10 @@ class DxvkSettings(QGroupBox, Ui_DxvkSettings):
|
||||||
if dxvk_options is not None:
|
if dxvk_options is not None:
|
||||||
if dxvk_options == "0":
|
if dxvk_options == "0":
|
||||||
self.show_dxvk.setCurrentIndex(1)
|
self.show_dxvk.setCurrentIndex(1)
|
||||||
|
return
|
||||||
elif dxvk_options == "1":
|
elif dxvk_options == "1":
|
||||||
self.show_dxvk.setCurrentIndex(2)
|
self.show_dxvk.setCurrentIndex(2)
|
||||||
|
return
|
||||||
else:
|
else:
|
||||||
self.show_dxvk.setCurrentIndex(3)
|
self.show_dxvk.setCurrentIndex(3)
|
||||||
self.gb_dxvk_options.setDisabled(False)
|
self.gb_dxvk_options.setDisabled(False)
|
||||||
|
|
|
@ -40,7 +40,7 @@ class LinuxSettings(QWidget, Ui_LinuxSettings):
|
||||||
|
|
||||||
# dxvk
|
# dxvk
|
||||||
self.dxvk = DxvkSettings(self.name)
|
self.dxvk = DxvkSettings(self.name)
|
||||||
self.dxvk_layout.addWidget(self.dxvk)
|
self.overlay_layout.addWidget(self.dxvk)
|
||||||
|
|
||||||
def load_prefix(self) -> str:
|
def load_prefix(self) -> str:
|
||||||
return self.load_setting(
|
return self.load_setting(
|
||||||
|
|
|
@ -14,7 +14,7 @@ from PyQt5 import QtCore, QtGui, QtWidgets
|
||||||
class Ui_InstallDialog(object):
|
class Ui_InstallDialog(object):
|
||||||
def setupUi(self, InstallDialog):
|
def setupUi(self, InstallDialog):
|
||||||
InstallDialog.setObjectName("InstallDialog")
|
InstallDialog.setObjectName("InstallDialog")
|
||||||
InstallDialog.resize(340, 296)
|
InstallDialog.resize(340, 314)
|
||||||
InstallDialog.setWindowTitle("Rare")
|
InstallDialog.setWindowTitle("Rare")
|
||||||
self.install_dialog_layout = QtWidgets.QFormLayout(InstallDialog)
|
self.install_dialog_layout = QtWidgets.QFormLayout(InstallDialog)
|
||||||
self.install_dialog_layout.setSizeConstraint(QtWidgets.QLayout.SetFixedSize)
|
self.install_dialog_layout.setSizeConstraint(QtWidgets.QLayout.SetFixedSize)
|
||||||
|
@ -128,18 +128,19 @@ class Ui_InstallDialog(object):
|
||||||
font = QtGui.QFont()
|
font = QtGui.QFont()
|
||||||
font.setItalic(True)
|
font.setItalic(True)
|
||||||
self.install_size_info_label.setFont(font)
|
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_size_info_label.setObjectName("install_size_info_label")
|
||||||
self.install_dialog_layout.setWidget(9, QtWidgets.QFormLayout.FieldRole, self.install_size_info_label)
|
self.install_dialog_layout.setWidget(9, QtWidgets.QFormLayout.FieldRole, self.install_size_info_label)
|
||||||
self.warn_label = QtWidgets.QLabel(InstallDialog)
|
self.warn_label = QtWidgets.QLabel(InstallDialog)
|
||||||
self.warn_label.setObjectName("warn_label")
|
self.warn_label.setObjectName("warn_label")
|
||||||
self.install_dialog_layout.setWidget(10, QtWidgets.QFormLayout.LabelRole, self.warn_label)
|
self.install_dialog_layout.setWidget(11, QtWidgets.QFormLayout.LabelRole, self.warn_label)
|
||||||
self.warn_message = QtWidgets.QLabel(InstallDialog)
|
self.warn_message = QtWidgets.QLabel(InstallDialog)
|
||||||
font = QtGui.QFont()
|
font = QtGui.QFont()
|
||||||
font.setItalic(True)
|
font.setItalic(True)
|
||||||
self.warn_message.setFont(font)
|
self.warn_message.setFont(font)
|
||||||
self.warn_message.setWordWrap(True)
|
self.warn_message.setWordWrap(True)
|
||||||
self.warn_message.setObjectName("warn_message")
|
self.warn_message.setObjectName("warn_message")
|
||||||
self.install_dialog_layout.setWidget(10, QtWidgets.QFormLayout.FieldRole, self.warn_message)
|
self.install_dialog_layout.setWidget(11, QtWidgets.QFormLayout.FieldRole, self.warn_message)
|
||||||
self.button_layout = QtWidgets.QHBoxLayout()
|
self.button_layout = QtWidgets.QHBoxLayout()
|
||||||
self.button_layout.setObjectName("button_layout")
|
self.button_layout.setObjectName("button_layout")
|
||||||
spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
|
spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
|
||||||
|
@ -153,13 +154,21 @@ class Ui_InstallDialog(object):
|
||||||
self.install_button = QtWidgets.QPushButton(InstallDialog)
|
self.install_button = QtWidgets.QPushButton(InstallDialog)
|
||||||
self.install_button.setObjectName("install_button")
|
self.install_button.setObjectName("install_button")
|
||||||
self.button_layout.addWidget(self.install_button)
|
self.button_layout.addWidget(self.install_button)
|
||||||
self.install_dialog_layout.setLayout(13, QtWidgets.QFormLayout.SpanningRole, self.button_layout)
|
self.install_dialog_layout.setLayout(14, QtWidgets.QFormLayout.SpanningRole, self.button_layout)
|
||||||
self.platform_combo_box = QtWidgets.QComboBox(InstallDialog)
|
self.platform_combo_box = QtWidgets.QComboBox(InstallDialog)
|
||||||
self.platform_combo_box.setObjectName("platform_combo_box")
|
self.platform_combo_box.setObjectName("platform_combo_box")
|
||||||
self.install_dialog_layout.setWidget(4, QtWidgets.QFormLayout.FieldRole, self.platform_combo_box)
|
self.install_dialog_layout.setWidget(4, QtWidgets.QFormLayout.FieldRole, self.platform_combo_box)
|
||||||
self.platform_label = QtWidgets.QLabel(InstallDialog)
|
self.platform_label = QtWidgets.QLabel(InstallDialog)
|
||||||
self.platform_label.setObjectName("platform_label")
|
self.platform_label.setObjectName("platform_label")
|
||||||
self.install_dialog_layout.setWidget(4, QtWidgets.QFormLayout.LabelRole, self.platform_label)
|
self.install_dialog_layout.setWidget(4, QtWidgets.QFormLayout.LabelRole, self.platform_label)
|
||||||
|
self.shortcut_lbl = QtWidgets.QLabel(InstallDialog)
|
||||||
|
self.shortcut_lbl.setObjectName("shortcut_lbl")
|
||||||
|
self.install_dialog_layout.setWidget(12, QtWidgets.QFormLayout.LabelRole, self.shortcut_lbl)
|
||||||
|
self.shortcut_cb = QtWidgets.QCheckBox(InstallDialog)
|
||||||
|
self.shortcut_cb.setText("")
|
||||||
|
self.shortcut_cb.setChecked(True)
|
||||||
|
self.shortcut_cb.setObjectName("shortcut_cb")
|
||||||
|
self.install_dialog_layout.setWidget(12, QtWidgets.QFormLayout.FieldRole, self.shortcut_cb)
|
||||||
|
|
||||||
self.retranslateUi(InstallDialog)
|
self.retranslateUi(InstallDialog)
|
||||||
QtCore.QMetaObject.connectSlotsByName(InstallDialog)
|
QtCore.QMetaObject.connectSlotsByName(InstallDialog)
|
||||||
|
@ -186,6 +195,7 @@ class Ui_InstallDialog(object):
|
||||||
self.verify_button.setText(_translate("InstallDialog", "Verify"))
|
self.verify_button.setText(_translate("InstallDialog", "Verify"))
|
||||||
self.install_button.setText(_translate("InstallDialog", "Install"))
|
self.install_button.setText(_translate("InstallDialog", "Install"))
|
||||||
self.platform_label.setText(_translate("InstallDialog", "Platform"))
|
self.platform_label.setText(_translate("InstallDialog", "Platform"))
|
||||||
|
self.shortcut_lbl.setText(_translate("InstallDialog", "Create shortcut"))
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>340</width>
|
<width>340</width>
|
||||||
<height>296</height>
|
<height>314</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
|
@ -214,16 +214,19 @@
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Click verify...</string>
|
<string>Click verify...</string>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="wordWrap">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="10" column="0">
|
<item row="11" column="0">
|
||||||
<widget class="QLabel" name="warn_label">
|
<widget class="QLabel" name="warn_label">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Warnings</string>
|
<string>Warnings</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="10" column="1">
|
<item row="11" column="1">
|
||||||
<widget class="QLabel" name="warn_message">
|
<widget class="QLabel" name="warn_message">
|
||||||
<property name="font">
|
<property name="font">
|
||||||
<font>
|
<font>
|
||||||
|
@ -238,7 +241,7 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="13" column="0" colspan="2">
|
<item row="14" column="0" colspan="2">
|
||||||
<layout class="QHBoxLayout" name="button_layout">
|
<layout class="QHBoxLayout" name="button_layout">
|
||||||
<item>
|
<item>
|
||||||
<spacer name="button_hspacer">
|
<spacer name="button_hspacer">
|
||||||
|
@ -286,6 +289,23 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="12" column="0">
|
||||||
|
<widget class="QLabel" name="shortcut_lbl">
|
||||||
|
<property name="text">
|
||||||
|
<string>Create shortcut</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="12" column="1">
|
||||||
|
<widget class="QCheckBox" name="shortcut_cb">
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true"/>
|
||||||
|
</property>
|
||||||
|
<property name="checked">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<resources/>
|
<resources/>
|
||||||
|
|
|
@ -2,13 +2,13 @@
|
||||||
|
|
||||||
# Form implementation generated from reading ui file 'rare/ui/components/tabs/settings/linux.ui'
|
# Form implementation generated from reading ui file 'rare/ui/components/tabs/settings/linux.ui'
|
||||||
#
|
#
|
||||||
# Created by: PyQt5 UI code generator 5.15.4
|
# Created by: PyQt5 UI code generator 5.15.6
|
||||||
#
|
#
|
||||||
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
|
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
|
||||||
# run again. Do not edit this file unless you know what you are doing.
|
# run again. Do not edit this file unless you know what you are doing.
|
||||||
|
|
||||||
|
|
||||||
from PyQt5 import QtCore, QtGui, QtWidgets
|
from PyQt5 import QtCore, QtWidgets
|
||||||
|
|
||||||
|
|
||||||
class Ui_LinuxSettings(object):
|
class Ui_LinuxSettings(object):
|
||||||
|
@ -39,9 +39,9 @@ class Ui_LinuxSettings(object):
|
||||||
self.exec_layout.setObjectName("exec_layout")
|
self.exec_layout.setObjectName("exec_layout")
|
||||||
self.wine_layout.setLayout(1, QtWidgets.QFormLayout.FieldRole, self.exec_layout)
|
self.wine_layout.setLayout(1, QtWidgets.QFormLayout.FieldRole, self.exec_layout)
|
||||||
self.linux_layout.addWidget(self.wine_groupbox, 0, 0, 1, 1)
|
self.linux_layout.addWidget(self.wine_groupbox, 0, 0, 1, 1)
|
||||||
self.dxvk_layout = QtWidgets.QVBoxLayout()
|
self.overlay_layout = QtWidgets.QVBoxLayout()
|
||||||
self.dxvk_layout.setObjectName("dxvk_layout")
|
self.overlay_layout.setObjectName("overlay_layout")
|
||||||
self.linux_layout.addLayout(self.dxvk_layout, 1, 0, 1, 1)
|
self.linux_layout.addLayout(self.overlay_layout, 1, 0, 1, 1)
|
||||||
|
|
||||||
self.retranslateUi(LinuxSettings)
|
self.retranslateUi(LinuxSettings)
|
||||||
QtCore.QMetaObject.connectSlotsByName(LinuxSettings)
|
QtCore.QMetaObject.connectSlotsByName(LinuxSettings)
|
||||||
|
|
|
@ -66,7 +66,7 @@
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="0">
|
<item row="1" column="0">
|
||||||
<layout class="QVBoxLayout" name="dxvk_layout"/>
|
<layout class="QVBoxLayout" name="overlay_layout"/>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
|
|
|
@ -25,6 +25,7 @@ class InstallOptionsModel:
|
||||||
silent: bool = False
|
silent: bool = False
|
||||||
platform: str = ""
|
platform: str = ""
|
||||||
overlay: bool = False
|
overlay: bool = False
|
||||||
|
create_shortcut: bool = True
|
||||||
|
|
||||||
def set_no_install(self, enabled: bool) -> None:
|
def set_no_install(self, enabled: bool) -> None:
|
||||||
self.no_install = enabled
|
self.no_install = enabled
|
||||||
|
|
Loading…
Reference in a new issue