Add download option to create a shortcut after installation
This commit is contained in:
parent
7ef59ecb09
commit
8f83b4adde
|
@ -69,6 +69,9 @@ class InstallDialog(QDialog, Ui_InstallDialog):
|
|||
if self.update:
|
||||
self.install_dir_label.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_message.setVisible(False)
|
||||
|
@ -112,6 +115,9 @@ class InstallDialog(QDialog, Ui_InstallDialog):
|
|||
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():
|
||||
|
@ -143,6 +149,15 @@ class InstallDialog(QDialog, Ui_InstallDialog):
|
|||
self.download_only_check.setVisible(False)
|
||||
self.download_only_info_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.verify_button.clicked.connect(self.verify_clicked)
|
||||
|
@ -206,16 +221,13 @@ class InstallDialog(QDialog, Ui_InstallDialog):
|
|||
self.options_changed = True
|
||||
self.install_button.setEnabled(False)
|
||||
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, ""
|
||||
|
||||
def non_reload_option_changed(self, option: str):
|
||||
if option == "download_only":
|
||||
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):
|
||||
self.dl_item.download = None
|
||||
|
@ -254,6 +266,10 @@ class InstallDialog(QDialog, Ui_InstallDialog):
|
|||
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.verify_button.setEnabled(self.options_changed)
|
||||
self.cancel_button.setEnabled(True)
|
||||
|
|
|
@ -15,6 +15,7 @@ from legendary.core import LegendaryCore
|
|||
from legendary.models.downloading import UIUpdate, WriterTask
|
||||
from rare import shared
|
||||
from rare.utils.models import InstallQueueItemModel
|
||||
from rare.utils.utils import create_desktop_link
|
||||
|
||||
logger = getLogger("DownloadThread")
|
||||
|
||||
|
@ -190,6 +191,13 @@ class DownloadThread(QThread):
|
|||
self.core.uninstall_tag(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")
|
||||
|
||||
def _handle_postinstall(self, postinstall, igame):
|
||||
|
|
|
@ -45,8 +45,10 @@ class DxvkSettings(QGroupBox, Ui_DxvkSettings):
|
|||
if dxvk_options is not None:
|
||||
if dxvk_options == "0":
|
||||
self.show_dxvk.setCurrentIndex(1)
|
||||
return
|
||||
elif dxvk_options == "1":
|
||||
self.show_dxvk.setCurrentIndex(2)
|
||||
return
|
||||
else:
|
||||
self.show_dxvk.setCurrentIndex(3)
|
||||
self.gb_dxvk_options.setDisabled(False)
|
||||
|
|
|
@ -40,7 +40,7 @@ class LinuxSettings(QWidget, Ui_LinuxSettings):
|
|||
|
||||
# dxvk
|
||||
self.dxvk = DxvkSettings(self.name)
|
||||
self.dxvk_layout.addWidget(self.dxvk)
|
||||
self.overlay_layout.addWidget(self.dxvk)
|
||||
|
||||
def load_prefix(self) -> str:
|
||||
return self.load_setting(
|
||||
|
|
|
@ -14,7 +14,7 @@ from PyQt5 import QtCore, QtGui, QtWidgets
|
|||
class Ui_InstallDialog(object):
|
||||
def setupUi(self, InstallDialog):
|
||||
InstallDialog.setObjectName("InstallDialog")
|
||||
InstallDialog.resize(340, 296)
|
||||
InstallDialog.resize(340, 314)
|
||||
InstallDialog.setWindowTitle("Rare")
|
||||
self.install_dialog_layout = QtWidgets.QFormLayout(InstallDialog)
|
||||
self.install_dialog_layout.setSizeConstraint(QtWidgets.QLayout.SetFixedSize)
|
||||
|
@ -128,18 +128,19 @@ class Ui_InstallDialog(object):
|
|||
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(9, QtWidgets.QFormLayout.FieldRole, self.install_size_info_label)
|
||||
self.warn_label = QtWidgets.QLabel(InstallDialog)
|
||||
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)
|
||||
font = QtGui.QFont()
|
||||
font.setItalic(True)
|
||||
self.warn_message.setFont(font)
|
||||
self.warn_message.setWordWrap(True)
|
||||
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.setObjectName("button_layout")
|
||||
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.setObjectName("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.setObjectName("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.setObjectName("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)
|
||||
QtCore.QMetaObject.connectSlotsByName(InstallDialog)
|
||||
|
@ -186,6 +195,7 @@ class Ui_InstallDialog(object):
|
|||
self.verify_button.setText(_translate("InstallDialog", "Verify"))
|
||||
self.install_button.setText(_translate("InstallDialog", "Install"))
|
||||
self.platform_label.setText(_translate("InstallDialog", "Platform"))
|
||||
self.shortcut_lbl.setText(_translate("InstallDialog", "Create shortcut"))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>340</width>
|
||||
<height>296</height>
|
||||
<height>314</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
|
@ -205,50 +205,53 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item row="9" column="1">
|
||||
<widget class="QLabel" name="install_size_info_label">
|
||||
<property name="font">
|
||||
<font>
|
||||
<italic>true</italic>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Click verify...</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="install_size_info_label">
|
||||
<property name="font">
|
||||
<font>
|
||||
<italic>true</italic>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Click verify...</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="0">
|
||||
<widget class="QLabel" name="warn_label">
|
||||
<property name="text">
|
||||
<string>Warnings</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="1">
|
||||
<widget class="QLabel" name="warn_message">
|
||||
<property name="font">
|
||||
<font>
|
||||
<italic>true</italic>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>None</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<item row="11" column="0">
|
||||
<widget class="QLabel" name="warn_label">
|
||||
<property name="text">
|
||||
<string>Warnings</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="11" column="1">
|
||||
<widget class="QLabel" name="warn_message">
|
||||
<property name="font">
|
||||
<font>
|
||||
<italic>true</italic>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>None</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="13" column="0" colspan="2">
|
||||
<layout class="QHBoxLayout" name="button_layout">
|
||||
<item>
|
||||
<spacer name="button_hspacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
<item row="14" column="0" colspan="2">
|
||||
<layout class="QHBoxLayout" name="button_layout">
|
||||
<item>
|
||||
<spacer name="button_hspacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
|
@ -274,18 +277,35 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QComboBox" name="platform_combo_box"/>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="platform_label">
|
||||
<property name="text">
|
||||
<string>Platform</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QComboBox" name="platform_combo_box"/>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="platform_label">
|
||||
<property name="text">
|
||||
<string>Platform</string>
|
||||
</property>
|
||||
</widget>
|
||||
</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>
|
||||
</widget>
|
||||
<resources/>
|
||||
|
|
|
@ -2,13 +2,13 @@
|
|||
|
||||
# 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
|
||||
# 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):
|
||||
|
@ -32,16 +32,16 @@ class Ui_LinuxSettings(object):
|
|||
self.prefix_layout.setObjectName("prefix_layout")
|
||||
self.wine_layout.setLayout(0, QtWidgets.QFormLayout.FieldRole, self.prefix_layout)
|
||||
self.exec_label = QtWidgets.QLabel(self.wine_groupbox)
|
||||
self.exec_label.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
|
||||
self.exec_label.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignTrailing | QtCore.Qt.AlignVCenter)
|
||||
self.exec_label.setObjectName("exec_label")
|
||||
self.wine_layout.setWidget(1, QtWidgets.QFormLayout.LabelRole, self.exec_label)
|
||||
self.exec_layout = QtWidgets.QVBoxLayout()
|
||||
self.exec_layout.setObjectName("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.dxvk_layout = QtWidgets.QVBoxLayout()
|
||||
self.dxvk_layout.setObjectName("dxvk_layout")
|
||||
self.linux_layout.addLayout(self.dxvk_layout, 1, 0, 1, 1)
|
||||
self.overlay_layout = QtWidgets.QVBoxLayout()
|
||||
self.overlay_layout.setObjectName("overlay_layout")
|
||||
self.linux_layout.addLayout(self.overlay_layout, 1, 0, 1, 1)
|
||||
|
||||
self.retranslateUi(LinuxSettings)
|
||||
QtCore.QMetaObject.connectSlotsByName(LinuxSettings)
|
||||
|
|
|
@ -1,75 +1,75 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>LinuxSettings</class>
|
||||
<widget class="QWidget" name="LinuxSettings">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>569</width>
|
||||
<height>454</height>
|
||||
</rect>
|
||||
<class>LinuxSettings</class>
|
||||
<widget class="QWidget" name="LinuxSettings">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>569</width>
|
||||
<height>454</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>LinuxSettings</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="linux_layout">
|
||||
<item row="3" column="0">
|
||||
<spacer name="linux_vspacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QGroupBox" name="wine_groupbox">
|
||||
<property name="title">
|
||||
<string>Wine Settings</string>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="wine_layout">
|
||||
<property name="labelAlignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="prefix_label">
|
||||
<property name="text">
|
||||
<string>Prefix</string>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>LinuxSettings</string>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="linux_layout">
|
||||
<item row="3" column="0">
|
||||
<spacer name="linux_vspacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QGroupBox" name="wine_groupbox">
|
||||
<property name="title">
|
||||
<string>Wine Settings</string>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="wine_layout">
|
||||
<property name="labelAlignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="prefix_label">
|
||||
<property name="text">
|
||||
<string>Prefix</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<layout class="QVBoxLayout" name="prefix_layout"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="exec_label">
|
||||
<property name="text">
|
||||
<string>Executable</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<layout class="QVBoxLayout" name="exec_layout"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<layout class="QVBoxLayout" name="dxvk_layout"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<layout class="QVBoxLayout" name="prefix_layout"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="exec_label">
|
||||
<property name="text">
|
||||
<string>Executable</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<layout class="QVBoxLayout" name="exec_layout"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<layout class="QVBoxLayout" name="overlay_layout"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
|
|
@ -25,6 +25,7 @@ class InstallOptionsModel:
|
|||
silent: bool = False
|
||||
platform: str = ""
|
||||
overlay: bool = False
|
||||
create_shortcut: bool = True
|
||||
|
||||
def set_no_install(self, enabled: bool) -> None:
|
||||
self.no_install = enabled
|
||||
|
|
Loading…
Reference in a new issue