From d5634213915b0bd16ad4b1dbb32fdd84014fcb8d Mon Sep 17 00:00:00 2001 From: loathingKernel <142770+loathingKernel@users.noreply.github.com> Date: Tue, 12 Dec 2023 01:00:07 +0200 Subject: [PATCH] EGLSyncGroup: Properly find the correct rows to insert widgets --- .../tabs/games/integrations/egl_sync_group.py | 18 +++++++------ .../tabs/games/integrations/egl_sync_group.py | 22 ++++++++------- .../tabs/games/integrations/egl_sync_group.ui | 27 ++++++++++++------- 3 files changed, 41 insertions(+), 26 deletions(-) diff --git a/rare/components/tabs/games/integrations/egl_sync_group.py b/rare/components/tabs/games/integrations/egl_sync_group.py index d0303203..fcacaf2a 100644 --- a/rare/components/tabs/games/integrations/egl_sync_group.py +++ b/rare/components/tabs/games/integrations/egl_sync_group.py @@ -6,7 +6,7 @@ from typing import Tuple, Iterable, List, Union from PyQt5.QtCore import Qt, QThreadPool, QRunnable, pyqtSlot, pyqtSignal from PyQt5.QtGui import QShowEvent -from PyQt5.QtWidgets import QGroupBox, QListWidgetItem, QFileDialog, QMessageBox, QFrame, QLabel +from PyQt5.QtWidgets import QGroupBox, QListWidgetItem, QFileDialog, QMessageBox, QFrame, QFormLayout from legendary.models.egl import EGLManifest from legendary.models.game import InstalledGame @@ -39,25 +39,27 @@ class EGLSyncGroup(QGroupBox): save_func=self.egl_path_edit_save_cb, parent=self, ) - self.ui.egl_path_edit_layout.addWidget(self.egl_path_edit) + self.ui.egl_sync_layout.setWidget( + self.ui.egl_sync_layout.getWidgetPosition(self.ui.egl_path_edit_label)[0], + QFormLayout.FieldRole, self.egl_path_edit + ) - self.egl_path_info_label = QLabel(self.tr("Estimated path"), self) self.egl_path_info = ElideLabel(parent=self) self.egl_path_info.setProperty("infoLabel", 1) - self.ui.egl_sync_layout.insertRow( - self.ui.egl_sync_layout.indexOf(self.ui.egl_path_edit_label) + 1, - self.egl_path_info_label, self.egl_path_info + self.ui.egl_sync_layout.setWidget( + self.ui.egl_sync_layout.getWidgetPosition(self.ui.egl_path_info_label)[0], + QFormLayout.FieldRole, self.egl_path_info ) if platform.system() == "Windows": self.ui.egl_path_edit_label.setEnabled(False) self.egl_path_edit.setEnabled(False) - self.egl_path_info_label.setEnabled(False) + self.ui.egl_path_info_label.setEnabled(False) self.egl_path_info.setEnabled(False) else: self.egl_path_edit.textChanged.connect(self.egl_path_changed) if self.core.egl.programdata_path: - self.egl_path_info_label.setEnabled(True) + self.ui.egl_path_info_label.setEnabled(True) self.egl_path_info.setEnabled(True) self.ui.egl_sync_check.setChecked(self.core.egl_sync_enabled) diff --git a/rare/ui/components/tabs/games/integrations/egl_sync_group.py b/rare/ui/components/tabs/games/integrations/egl_sync_group.py index e6a12f74..d59c2b2a 100644 --- a/rare/ui/components/tabs/games/integrations/egl_sync_group.py +++ b/rare/ui/components/tabs/games/integrations/egl_sync_group.py @@ -2,7 +2,7 @@ # Form implementation generated from reading ui file 'rare/ui/components/tabs/games/integrations/egl_sync_group.ui' # -# Created by: PyQt5 UI code generator 5.15.9 +# Created by: PyQt5 UI code generator 5.15.10 # # 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. @@ -14,7 +14,7 @@ from PyQt5 import QtCore, QtGui, QtWidgets class Ui_EGLSyncGroup(object): def setupUi(self, EGLSyncGroup): EGLSyncGroup.setObjectName("EGLSyncGroup") - EGLSyncGroup.resize(217, 88) + EGLSyncGroup.resize(424, 106) EGLSyncGroup.setWindowTitle("EGLSyncGroup") EGLSyncGroup.setCheckable(False) EGLSyncGroup.setChecked(False) @@ -24,19 +24,21 @@ class Ui_EGLSyncGroup(object): self.egl_path_edit_label = QtWidgets.QLabel(EGLSyncGroup) self.egl_path_edit_label.setObjectName("egl_path_edit_label") self.egl_sync_layout.setWidget(0, QtWidgets.QFormLayout.LabelRole, self.egl_path_edit_label) - self.egl_path_edit_layout = QtWidgets.QHBoxLayout() - self.egl_path_edit_layout.setObjectName("egl_path_edit_layout") - self.egl_sync_layout.setLayout(0, QtWidgets.QFormLayout.FieldRole, self.egl_path_edit_layout) self.egl_sync_check_label = QtWidgets.QLabel(EGLSyncGroup) self.egl_sync_check_label.setObjectName("egl_sync_check_label") - self.egl_sync_layout.setWidget(1, QtWidgets.QFormLayout.LabelRole, self.egl_sync_check_label) + self.egl_sync_layout.setWidget(2, QtWidgets.QFormLayout.LabelRole, self.egl_sync_check_label) self.egl_sync_check = QtWidgets.QCheckBox(EGLSyncGroup) - self.egl_sync_check.setText("") + font = QtGui.QFont() + font.setItalic(True) + self.egl_sync_check.setFont(font) self.egl_sync_check.setObjectName("egl_sync_check") - self.egl_sync_layout.setWidget(1, QtWidgets.QFormLayout.FieldRole, self.egl_sync_check) + self.egl_sync_layout.setWidget(2, QtWidgets.QFormLayout.FieldRole, self.egl_sync_check) self.import_export_layout = QtWidgets.QVBoxLayout() self.import_export_layout.setObjectName("import_export_layout") - self.egl_sync_layout.setLayout(2, QtWidgets.QFormLayout.SpanningRole, self.import_export_layout) + self.egl_sync_layout.setLayout(3, QtWidgets.QFormLayout.SpanningRole, self.import_export_layout) + self.egl_path_info_label = QtWidgets.QLabel(EGLSyncGroup) + self.egl_path_info_label.setObjectName("egl_path_info_label") + self.egl_sync_layout.setWidget(1, QtWidgets.QFormLayout.LabelRole, self.egl_path_info_label) self.retranslateUi(EGLSyncGroup) @@ -45,6 +47,8 @@ class Ui_EGLSyncGroup(object): EGLSyncGroup.setTitle(_translate("EGLSyncGroup", "Sync with Epic Games Launcher")) self.egl_path_edit_label.setText(_translate("EGLSyncGroup", "Prefix/Manifest path")) self.egl_sync_check_label.setText(_translate("EGLSyncGroup", "Enable automatic sync")) + self.egl_sync_check.setText(_translate("EGLSyncGroup", "This will immediately synchronize with EGL")) + self.egl_path_info_label.setText(_translate("EGLSyncGroup", "Estimated path")) if __name__ == "__main__": diff --git a/rare/ui/components/tabs/games/integrations/egl_sync_group.ui b/rare/ui/components/tabs/games/integrations/egl_sync_group.ui index 150669f0..10b71aab 100644 --- a/rare/ui/components/tabs/games/integrations/egl_sync_group.ui +++ b/rare/ui/components/tabs/games/integrations/egl_sync_group.ui @@ -6,8 +6,8 @@ 0 0 - 217 - 88 + 424 + 106 @@ -33,26 +33,35 @@ - - - - + Enable automatic sync - + + + + true + + - + This will immediately synchronize with EGL - + + + + + Estimated path + + +