diff --git a/rare/components/dialogs/install_dialog.py b/rare/components/dialogs/install_dialog.py index a8f23c25..cbe99018 100644 --- a/rare/components/dialogs/install_dialog.py +++ b/rare/components/dialogs/install_dialog.py @@ -75,13 +75,12 @@ class InstallDialog(ActionDialog): header = self.tr("Modify") bicon = icon("fa.gear") self.setWindowTitle(dialog_title_game(header, rgame.app_title)) + self.setSubtitle(dialog_title_game(header, rgame.app_title)) install_widget = QWidget(self) self.ui = Ui_InstallDialog() self.ui.setupUi(install_widget) - self.ui.title_label.setText(f"

{dialog_title_game(header, rgame.app_title)}

") - self.core = rgame.core self.rgame = rgame self.__options: InstallOptionsModel = options diff --git a/rare/components/dialogs/move_dialog.py b/rare/components/dialogs/move_dialog.py index cab68049..b81af267 100644 --- a/rare/components/dialogs/move_dialog.py +++ b/rare/components/dialogs/move_dialog.py @@ -34,8 +34,7 @@ class MoveDialog(ActionDialog): super(MoveDialog, self).__init__(parent=parent) header = self.tr("Move") self.setWindowTitle(dialog_title_game(header, rgame.app_title)) - - title_label = QLabel(f"

{dialog_title_game(header, rgame.app_title)}

", self) + self.setSubtitle(dialog_title_game(header, rgame.app_title)) self.rcore = RareCore.instance() self.core = RareCore.instance().core() @@ -70,7 +69,6 @@ class MoveDialog(ActionDialog): layout = QVBoxLayout() layout.setSizeConstraint(QLayout.SetFixedSize) - layout.addWidget(title_label) layout.addWidget(self.path_edit) layout.addWidget(self.warn_label) layout.addLayout(bottom_layout) diff --git a/rare/components/dialogs/selective_dialog.py b/rare/components/dialogs/selective_dialog.py index 1c3b5031..ac7409e2 100644 --- a/rare/components/dialogs/selective_dialog.py +++ b/rare/components/dialogs/selective_dialog.py @@ -15,8 +15,7 @@ class SelectiveDialog(ButtonDialog): super(SelectiveDialog, self).__init__(parent=parent) header = self.tr("Optional downloads for") self.setWindowTitle(dialog_title_game(header, rgame.app_title)) - - title_label = QLabel(f"

{dialog_title_game(header, rgame.app_title)}

", self) + self.setSubtitle(dialog_title_game(header, rgame.app_title)) self.rgame = rgame self.selective_widget = SelectiveWidget(rgame, rgame.igame.platform, self) @@ -26,12 +25,7 @@ class SelectiveDialog(ButtonDialog): container_layout.setContentsMargins(0, 0, 0, 0) container_layout.addWidget(self.selective_widget) - layout = QVBoxLayout() - layout.setSizeConstraint(QLayout.SetFixedSize) - layout.addWidget(title_label) - layout.addWidget(container) - - self.setCentralLayout(layout) + self.setCentralWidget(container) self.accept_button.setText(self.tr("Verify")) self.accept_button.setIcon(icon("fa.check")) diff --git a/rare/components/dialogs/uninstall_dialog.py b/rare/components/dialogs/uninstall_dialog.py index dd6be379..07befe14 100644 --- a/rare/components/dialogs/uninstall_dialog.py +++ b/rare/components/dialogs/uninstall_dialog.py @@ -1,6 +1,5 @@ from PyQt5.QtCore import pyqtSignal from PyQt5.QtWidgets import ( - QLabel, QVBoxLayout, QCheckBox, ) @@ -18,8 +17,7 @@ class UninstallDialog(ButtonDialog): super(UninstallDialog, self).__init__(parent=parent) header = self.tr("Uninstall") self.setWindowTitle(dialog_title_game(header, rgame.app_title)) - - title_label = QLabel(f"

{dialog_title_game(header, rgame.app_title)}

", self) + self.setSubtitle(dialog_title_game(header, rgame.app_title)) self.keep_files = QCheckBox(self.tr("Keep files")) self.keep_files.setChecked(bool(options.keep_files)) @@ -34,7 +32,6 @@ class UninstallDialog(ButtonDialog): self.keep_overlay_keys.setEnabled(rgame.is_overlay) layout = QVBoxLayout() - layout.addWidget(title_label) layout.addWidget(self.keep_files) layout.addWidget(self.keep_config) layout.addWidget(self.keep_overlay_keys) diff --git a/rare/ui/components/dialogs/install_dialog.py b/rare/ui/components/dialogs/install_dialog.py index 8dc5c664..9e680570 100644 --- a/rare/ui/components/dialogs/install_dialog.py +++ b/rare/ui/components/dialogs/install_dialog.py @@ -14,20 +14,17 @@ from PyQt5 import QtCore, QtGui, QtWidgets class Ui_InstallDialog(object): def setupUi(self, InstallDialog): InstallDialog.setObjectName("InstallDialog") - InstallDialog.resize(197, 216) + InstallDialog.resize(197, 195) InstallDialog.setWindowTitle("InstallDialog") self.main_layout = QtWidgets.QFormLayout(InstallDialog) self.main_layout.setLabelAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.main_layout.setObjectName("main_layout") - self.title_label = QtWidgets.QLabel(InstallDialog) - self.title_label.setObjectName("title_label") - self.main_layout.setWidget(0, QtWidgets.QFormLayout.SpanningRole, self.title_label) self.install_dir_label = QtWidgets.QLabel(InstallDialog) self.install_dir_label.setObjectName("install_dir_label") - self.main_layout.setWidget(1, QtWidgets.QFormLayout.LabelRole, self.install_dir_label) + self.main_layout.setWidget(0, QtWidgets.QFormLayout.LabelRole, self.install_dir_label) self.platform_label = QtWidgets.QLabel(InstallDialog) self.platform_label.setObjectName("platform_label") - self.main_layout.setWidget(2, QtWidgets.QFormLayout.LabelRole, self.platform_label) + self.main_layout.setWidget(1, QtWidgets.QFormLayout.LabelRole, self.platform_label) self.platform_combo = QtWidgets.QComboBox(InstallDialog) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) @@ -35,43 +32,43 @@ class Ui_InstallDialog(object): sizePolicy.setHeightForWidth(self.platform_combo.sizePolicy().hasHeightForWidth()) self.platform_combo.setSizePolicy(sizePolicy) self.platform_combo.setObjectName("platform_combo") - self.main_layout.setWidget(2, QtWidgets.QFormLayout.FieldRole, self.platform_combo) + self.main_layout.setWidget(1, QtWidgets.QFormLayout.FieldRole, self.platform_combo) self.shortcut_label = QtWidgets.QLabel(InstallDialog) self.shortcut_label.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignVCenter) self.shortcut_label.setObjectName("shortcut_label") - self.main_layout.setWidget(3, QtWidgets.QFormLayout.LabelRole, self.shortcut_label) + self.main_layout.setWidget(2, QtWidgets.QFormLayout.LabelRole, self.shortcut_label) self.shortcut_check = QtWidgets.QCheckBox(InstallDialog) self.shortcut_check.setText("") self.shortcut_check.setObjectName("shortcut_check") - self.main_layout.setWidget(3, QtWidgets.QFormLayout.FieldRole, self.shortcut_check) + self.main_layout.setWidget(2, QtWidgets.QFormLayout.FieldRole, self.shortcut_check) self.selectable_layout = QtWidgets.QVBoxLayout() self.selectable_layout.setObjectName("selectable_layout") - self.main_layout.setLayout(4, QtWidgets.QFormLayout.SpanningRole, self.selectable_layout) + self.main_layout.setLayout(3, QtWidgets.QFormLayout.SpanningRole, self.selectable_layout) self.advanced_layout = QtWidgets.QVBoxLayout() self.advanced_layout.setObjectName("advanced_layout") - self.main_layout.setLayout(5, QtWidgets.QFormLayout.SpanningRole, self.advanced_layout) + self.main_layout.setLayout(4, QtWidgets.QFormLayout.SpanningRole, self.advanced_layout) self.download_size_label = QtWidgets.QLabel(InstallDialog) self.download_size_label.setObjectName("download_size_label") - self.main_layout.setWidget(6, QtWidgets.QFormLayout.LabelRole, self.download_size_label) + self.main_layout.setWidget(5, QtWidgets.QFormLayout.LabelRole, self.download_size_label) self.download_size_text = QtWidgets.QLabel(InstallDialog) font = QtGui.QFont() font.setItalic(True) self.download_size_text.setFont(font) self.download_size_text.setObjectName("download_size_text") - self.main_layout.setWidget(6, QtWidgets.QFormLayout.FieldRole, self.download_size_text) + self.main_layout.setWidget(5, QtWidgets.QFormLayout.FieldRole, self.download_size_text) self.install_size_label = QtWidgets.QLabel(InstallDialog) self.install_size_label.setObjectName("install_size_label") - self.main_layout.setWidget(7, QtWidgets.QFormLayout.LabelRole, self.install_size_label) + self.main_layout.setWidget(6, QtWidgets.QFormLayout.LabelRole, self.install_size_label) self.install_size_text = QtWidgets.QLabel(InstallDialog) font = QtGui.QFont() font.setItalic(True) self.install_size_text.setFont(font) self.install_size_text.setWordWrap(True) self.install_size_text.setObjectName("install_size_text") - self.main_layout.setWidget(7, QtWidgets.QFormLayout.FieldRole, self.install_size_text) + self.main_layout.setWidget(6, QtWidgets.QFormLayout.FieldRole, self.install_size_text) self.avail_space_label = QtWidgets.QLabel(InstallDialog) self.avail_space_label.setObjectName("avail_space_label") - self.main_layout.setWidget(8, QtWidgets.QFormLayout.LabelRole, self.avail_space_label) + self.main_layout.setWidget(7, QtWidgets.QFormLayout.LabelRole, self.avail_space_label) self.avail_space = QtWidgets.QLabel(InstallDialog) font = QtGui.QFont() font.setBold(True) @@ -79,10 +76,10 @@ class Ui_InstallDialog(object): self.avail_space.setFont(font) self.avail_space.setText("") self.avail_space.setObjectName("avail_space") - self.main_layout.setWidget(8, QtWidgets.QFormLayout.FieldRole, self.avail_space) + self.main_layout.setWidget(7, QtWidgets.QFormLayout.FieldRole, self.avail_space) self.warning_label = QtWidgets.QLabel(InstallDialog) self.warning_label.setObjectName("warning_label") - self.main_layout.setWidget(9, QtWidgets.QFormLayout.LabelRole, self.warning_label) + self.main_layout.setWidget(8, QtWidgets.QFormLayout.LabelRole, self.warning_label) self.warning_text = QtWidgets.QLabel(InstallDialog) font = QtGui.QFont() font.setItalic(True) @@ -92,13 +89,12 @@ class Ui_InstallDialog(object): self.warning_text.setWordWrap(True) self.warning_text.setTextInteractionFlags(QtCore.Qt.LinksAccessibleByMouse|QtCore.Qt.TextSelectableByMouse) self.warning_text.setObjectName("warning_text") - self.main_layout.setWidget(9, QtWidgets.QFormLayout.FieldRole, self.warning_text) + self.main_layout.setWidget(8, QtWidgets.QFormLayout.FieldRole, self.warning_text) self.retranslateUi(InstallDialog) def retranslateUi(self, InstallDialog): _translate = QtCore.QCoreApplication.translate - self.title_label.setText(_translate("InstallDialog", "error")) self.install_dir_label.setText(_translate("InstallDialog", "Install folder")) self.platform_label.setText(_translate("InstallDialog", "Platform")) self.shortcut_label.setText(_translate("InstallDialog", "Create shortcut")) diff --git a/rare/ui/components/dialogs/install_dialog.ui b/rare/ui/components/dialogs/install_dialog.ui index d16cf4d4..6b00a183 100644 --- a/rare/ui/components/dialogs/install_dialog.ui +++ b/rare/ui/components/dialogs/install_dialog.ui @@ -7,7 +7,7 @@ 0 0 197 - 216 + 195 @@ -17,28 +17,21 @@ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - error - - - - + Install folder - + Platform - + @@ -48,7 +41,7 @@ - + Create shortcut @@ -58,27 +51,27 @@ - + - + - + - + Download size - + @@ -90,14 +83,14 @@ - + Total install size - + @@ -112,14 +105,14 @@ - + Available space - + @@ -132,14 +125,14 @@ - + Warning - + diff --git a/rare/widgets/dialogs.py b/rare/widgets/dialogs.py index a5a97db8..2c6839b4 100644 --- a/rare/widgets/dialogs.py +++ b/rare/widgets/dialogs.py @@ -11,7 +11,7 @@ from PyQt5.QtWidgets import ( QVBoxLayout, QHBoxLayout, QWidget, - QLayout, QSpacerItem, QSizePolicy, + QLayout, QSpacerItem, QSizePolicy, QLabel, ) from rare.utils.misc import icon @@ -74,6 +74,9 @@ class ButtonDialog(BaseDialog): def __init__(self, parent=None): super(ButtonDialog, self).__init__(parent=parent) + self.subtitle_label = QLabel(self) + self.subtitle_label.setVisible(False) + self.reject_button = QPushButton(self) self.reject_button.setText(self.tr("Cancel")) self.reject_button.setIcon(icon("fa.remove")) @@ -91,6 +94,7 @@ class ButtonDialog(BaseDialog): self.button_layout.addWidget(self.accept_button) self.main_layout = QVBoxLayout(self) + self.main_layout.addWidget(self.subtitle_label) # lk: dirty way to set a minimum width with fixed size constraint spacer = QSpacerItem( 480, self.main_layout.spacing(), @@ -103,13 +107,23 @@ class ButtonDialog(BaseDialog): def close(self): raise RuntimeError(f"Don't use `close()` with {type(self).__name__}") + def setSubtitle(self, text: str): + self.subtitle_label.setText(f"{text}") + self.subtitle_label.setVisible(True) + def setCentralWidget(self, widget: QWidget): widget.layout().setContentsMargins(0, 0, 0, 0) - self.main_layout.insertWidget(0, widget) + self.main_layout.insertWidget( + self.main_layout.indexOf(self.subtitle_label) + 1, + widget + ) def setCentralLayout(self, layout: QLayout): layout.setContentsMargins(0, 0, 0, 0) - self.main_layout.insertLayout(0, layout) + self.main_layout.insertLayout( + self.main_layout.indexOf(self.subtitle_label) + 1, + layout + ) @abstractmethod def accept_handler(self):