diff --git a/rare/components/tabs/games/import_sync/__init__.py b/rare/components/tabs/games/import_sync/__init__.py index 77102f49..0d1fdf95 100644 --- a/rare/components/tabs/games/import_sync/__init__.py +++ b/rare/components/tabs/games/import_sync/__init__.py @@ -42,8 +42,8 @@ class ImportSyncWidget(QWidget): def __init__(self, widget: QWidget, title: str, info: str, parent=None): super(ImportSyncWidget, self).__init__(parent=parent) self.layout = QVBoxLayout() - self.title = QLabel(f"

{title}{title}{info}

") diff --git a/rare/components/tabs/games/import_sync/egl_sync_widget.py b/rare/components/tabs/games/import_sync/egl_sync_widget.py index 2f76da04..24f0745d 100644 --- a/rare/components/tabs/games/import_sync/egl_sync_widget.py +++ b/rare/components/tabs/games/import_sync/egl_sync_widget.py @@ -6,7 +6,7 @@ from logging import getLogger from PyQt5.QtCore import Qt, QThread from PyQt5.QtWidgets import QHBoxLayout, QVBoxLayout, QLabel, QGroupBox, \ - QCheckBox, QPushButton, QListWidgetItem, QDialog, QFileDialog + QCheckBox, QPushButton, QListWidgetItem, QDialog, QFileDialog, QSizePolicy import rare.shared as shared from rare.ui.components.tabs.games.import_sync.egl_sync_widget import Ui_EGLSyncGroup @@ -68,6 +68,7 @@ class EGLSyncGroup(QGroupBox, Ui_EGLSyncGroup): egl_path = str() self.egl_path_edit = PathEdit( path=egl_path, + ph_text=estimated_path, file_type=QFileDialog.DirectoryOnly, edit_func=self.egl_path_edit_cb, save_func=self.egl_path_save_cb, @@ -112,7 +113,7 @@ class EGLSyncGroup(QGroupBox, Ui_EGLSyncGroup): # path is a wine prefix path = os.path.join(path, 'dosdevices/c:', 'ProgramData/Epic/EpicGamesLauncher/Data/Manifests') elif not path.endswith('ProgramData/Epic/EpicGamesLauncher/Data/Manifests'): - # lower() might not be needed here + # lower() might or might not be needed in the check return False, path if os.path.exists(path): return True, path @@ -149,18 +150,27 @@ class EGLSyncGroup(QGroupBox, Ui_EGLSyncGroup): self.core.lgd.save_config() def update_lists(self): - self.export_list.setVisible(bool(shared.core.egl.programdata_path)) - self.import_list.setVisible(bool(shared.core.egl.programdata_path)) - if not shared.core.egl.programdata_path: + have_path = bool(shared.core.egl.programdata_path) + self.egl_sync_label.setEnabled(have_path) + self.egl_sync_check.setEnabled(have_path) + + self.export_import_widget.setEnabled(have_path) + + self.export_label.setVisible(not have_path) + self.export_list.setVisible(have_path) + self.export_buttons_widget.setVisible(have_path) + + self.import_label.setVisible(not have_path) + self.import_list.setVisible(have_path) + self.import_buttons_widget.setVisible(have_path) + + if not have_path: return + self.update_export_list() self.update_import_list() def update_export_list(self): - self.export_button.setDisabled(not bool(shared.core.egl.programdata_path)) - self.export_select_all_button.setDisabled(not bool(shared.core.egl.programdata_path)) - self.export_select_none_button.setDisabled(not bool(shared.core.egl.programdata_path)) - self.export_list.clear() self.exportable_items.clear() exportable_games = shared.core.egl_get_exportable() @@ -168,15 +178,12 @@ class EGLSyncGroup(QGroupBox, Ui_EGLSyncGroup): ew = EGLSyncItem(igame, True, self.export_list) self.exportable_items.append(ew) self.export_list.addItem(ew) - for btn in self.export_buttons_layout.children(): - btn.setEnabled(bool(exportable_games)) - self.export_label.setVisible(not bool(exportable_games)) + have_exportable = bool(exportable_games) + self.export_label.setVisible(not have_exportable) + self.export_list.setVisible(have_exportable) + self.export_buttons_widget.setVisible(have_exportable) def update_import_list(self): - self.import_button.setDisabled(not bool(shared.core.egl.programdata_path)) - self.import_select_all_button.setDisabled(not bool(shared.core.egl.programdata_path)) - self.import_select_none_button.setDisabled(not bool(shared.core.egl.programdata_path)) - self.import_list.clear() self.importable_items.clear() importable_games = shared.core.egl_get_importable() @@ -184,9 +191,10 @@ class EGLSyncGroup(QGroupBox, Ui_EGLSyncGroup): iw = EGLSyncItem(game, False, self.import_list) self.importable_items.append(iw) self.import_list.addItem(iw) - for btn in self.import_buttons_layout.children(): - btn.setEnabled(bool(importable_games)) - self.import_label.setVisible(not bool(importable_games)) + have_importable = bool(importable_games) + self.import_label.setVisible(not have_importable) + self.import_list.setVisible(have_importable) + self.import_buttons_widget.setVisible(have_importable) @staticmethod def select_items(item_list, state): diff --git a/rare/ui/components/tabs/games/import_sync/egl_sync_widget.py b/rare/ui/components/tabs/games/import_sync/egl_sync_widget.py index c95d8b36..1fca3a66 100644 --- a/rare/ui/components/tabs/games/import_sync/egl_sync_widget.py +++ b/rare/ui/components/tabs/games/import_sync/egl_sync_widget.py @@ -32,11 +32,21 @@ class Ui_EGLSyncGroup(object): self.egl_path_info.setObjectName("egl_path_info") self.egl_sync_layout.setWidget(1, QtWidgets.QFormLayout.FieldRole, self.egl_path_info) self.egl_sync_check = QtWidgets.QCheckBox(EGLSyncGroup) + self.egl_sync_check.setText("") self.egl_sync_check.setObjectName("egl_sync_check") self.egl_sync_layout.setWidget(2, QtWidgets.QFormLayout.FieldRole, self.egl_sync_check) - self.export_import_layout = QtWidgets.QHBoxLayout() + self.egl_path_layout = QtWidgets.QHBoxLayout() + self.egl_path_layout.setObjectName("egl_path_layout") + self.egl_sync_layout.setLayout(0, QtWidgets.QFormLayout.FieldRole, self.egl_path_layout) + self.egl_sync_label = QtWidgets.QLabel(EGLSyncGroup) + self.egl_sync_label.setObjectName("egl_sync_label") + self.egl_sync_layout.setWidget(2, QtWidgets.QFormLayout.LabelRole, self.egl_sync_label) + self.export_import_widget = QtWidgets.QWidget(EGLSyncGroup) + self.export_import_widget.setObjectName("export_import_widget") + self.export_import_layout = QtWidgets.QHBoxLayout(self.export_import_widget) + self.export_import_layout.setContentsMargins(0, 0, 0, 0) self.export_import_layout.setObjectName("export_import_layout") - self.export_group = QtWidgets.QGroupBox(EGLSyncGroup) + self.export_group = QtWidgets.QGroupBox(self.export_import_widget) self.export_group.setObjectName("export_group") self.export_layout = QtWidgets.QVBoxLayout(self.export_group) self.export_layout.setObjectName("export_layout") @@ -47,22 +57,27 @@ class Ui_EGLSyncGroup(object): self.export_list.setAlternatingRowColors(True) self.export_list.setObjectName("export_list") self.export_layout.addWidget(self.export_list) - self.export_buttons_layout = QtWidgets.QHBoxLayout() + spacerItem = QtWidgets.QSpacerItem(40, 4, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) + self.export_layout.addItem(spacerItem) + self.export_buttons_widget = QtWidgets.QWidget(self.export_group) + self.export_buttons_widget.setObjectName("export_buttons_widget") + self.export_buttons_layout = QtWidgets.QHBoxLayout(self.export_buttons_widget) + self.export_buttons_layout.setContentsMargins(0, 0, 0, 0) self.export_buttons_layout.setObjectName("export_buttons_layout") - self.export_select_all_button = QtWidgets.QPushButton(self.export_group) + self.export_select_all_button = QtWidgets.QPushButton(self.export_buttons_widget) self.export_select_all_button.setObjectName("export_select_all_button") self.export_buttons_layout.addWidget(self.export_select_all_button) - self.export_select_none_button = QtWidgets.QPushButton(self.export_group) + self.export_select_none_button = QtWidgets.QPushButton(self.export_buttons_widget) self.export_select_none_button.setObjectName("export_select_none_button") self.export_buttons_layout.addWidget(self.export_select_none_button) - spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) - self.export_buttons_layout.addItem(spacerItem) - self.export_button = QtWidgets.QPushButton(self.export_group) + spacerItem1 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) + self.export_buttons_layout.addItem(spacerItem1) + self.export_button = QtWidgets.QPushButton(self.export_buttons_widget) self.export_button.setObjectName("export_button") self.export_buttons_layout.addWidget(self.export_button) - self.export_layout.addLayout(self.export_buttons_layout) + self.export_layout.addWidget(self.export_buttons_widget) self.export_import_layout.addWidget(self.export_group) - self.import_group = QtWidgets.QGroupBox(EGLSyncGroup) + self.import_group = QtWidgets.QGroupBox(self.export_import_widget) self.import_group.setObjectName("import_group") self.import_layout = QtWidgets.QVBoxLayout(self.import_group) self.import_layout.setObjectName("import_layout") @@ -73,25 +88,27 @@ class Ui_EGLSyncGroup(object): self.import_list.setAlternatingRowColors(True) self.import_list.setObjectName("import_list") self.import_layout.addWidget(self.import_list) - self.import_buttons_layout = QtWidgets.QHBoxLayout() + spacerItem2 = QtWidgets.QSpacerItem(40, 4, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) + self.import_layout.addItem(spacerItem2) + self.import_buttons_widget = QtWidgets.QWidget(self.import_group) + self.import_buttons_widget.setObjectName("import_buttons_widget") + self.import_buttons_layout = QtWidgets.QHBoxLayout(self.import_buttons_widget) + self.import_buttons_layout.setContentsMargins(0, 0, 0, 0) self.import_buttons_layout.setObjectName("import_buttons_layout") - self.import_select_all_button = QtWidgets.QPushButton(self.import_group) + self.import_select_all_button = QtWidgets.QPushButton(self.import_buttons_widget) self.import_select_all_button.setObjectName("import_select_all_button") self.import_buttons_layout.addWidget(self.import_select_all_button) - self.import_select_none_button = QtWidgets.QPushButton(self.import_group) + self.import_select_none_button = QtWidgets.QPushButton(self.import_buttons_widget) self.import_select_none_button.setObjectName("import_select_none_button") self.import_buttons_layout.addWidget(self.import_select_none_button) - spacerItem1 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) - self.import_buttons_layout.addItem(spacerItem1) - self.import_button = QtWidgets.QPushButton(self.import_group) + spacerItem3 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) + self.import_buttons_layout.addItem(spacerItem3) + self.import_button = QtWidgets.QPushButton(self.import_buttons_widget) self.import_button.setObjectName("import_button") self.import_buttons_layout.addWidget(self.import_button) - self.import_layout.addLayout(self.import_buttons_layout) + self.import_layout.addWidget(self.import_buttons_widget) self.export_import_layout.addWidget(self.import_group) - self.egl_sync_layout.setLayout(3, QtWidgets.QFormLayout.SpanningRole, self.export_import_layout) - self.egl_path_layout = QtWidgets.QHBoxLayout() - self.egl_path_layout.setObjectName("egl_path_layout") - self.egl_sync_layout.setLayout(0, QtWidgets.QFormLayout.FieldRole, self.egl_path_layout) + self.egl_sync_layout.setWidget(3, QtWidgets.QFormLayout.SpanningRole, self.export_import_widget) self.retranslateUi(EGLSyncGroup) QtCore.QMetaObject.connectSlotsByName(EGLSyncGroup) @@ -102,7 +119,7 @@ class Ui_EGLSyncGroup(object): EGLSyncGroup.setTitle(_translate("EGLSyncGroup", "Sync with Epic Games Launcher")) self.egl_path_label.setText(_translate("EGLSyncGroup", "Prefix/Manifest path")) self.egl_path_info_label.setText(_translate("EGLSyncGroup", "Estimated path")) - self.egl_sync_check.setText(_translate("EGLSyncGroup", "Enable automatic sync")) + self.egl_sync_label.setText(_translate("EGLSyncGroup", "Enable automatic sync")) self.export_group.setTitle(_translate("EGLSyncGroup", "Exportable games")) self.export_label.setText(_translate("EGLSyncGroup", "No games to export to EGS")) self.export_list.setSortingEnabled(True) diff --git a/rare/ui/components/tabs/games/import_sync/egl_sync_widget.ui b/rare/ui/components/tabs/games/import_sync/egl_sync_widget.ui index 1d5e18d4..56f643e1 100644 --- a/rare/ui/components/tabs/games/import_sync/egl_sync_widget.ui +++ b/rare/ui/components/tabs/games/import_sync/egl_sync_widget.ui @@ -52,145 +52,220 @@ + + + + + + + + + + Enable automatic sync - - - - - Exportable games - - - - - - No games to export to EGS - - - - - - - true - - - true - - - - - - - - - Select all + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + Exportable games + + + + + + No games to export to EGS + + + + + + + true + + + true + + + + + + + Qt::Horizontal + + + + 40 + 4 + + + + + + + + + 0 - - - - - - Select none + + 0 - - - - - - Qt::Horizontal + + 0 - - - 40 - 20 - + + 0 - - - - - - Export + + + + Select all + + + + + + + Select none + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Export + + + + + + + + + + + + + Importable games + + + + + + No games to import from EGS + + + + + + + true + + + true + + + + + + + Qt::Horizontal + + + + 40 + 4 + + + + + + + + + 0 - - - - - - - - - - - Importable games - - - - - - No games to import from EGS - - - - - - - true - - - true - - - - - - - - - Select all + + 0 - - - - - - Select none + + 0 - - - - - - Qt::Horizontal + + 0 - - - 40 - 20 - - - - - - - - Import - - - - - - - - - - - - + + + + Select all + + + + + + + Select none + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Import + + + + + + + + + + + diff --git a/rare/utils/extra_widgets.py b/rare/utils/extra_widgets.py index 5bb5771f..afce7a4f 100644 --- a/rare/utils/extra_widgets.py +++ b/rare/utils/extra_widgets.py @@ -153,7 +153,7 @@ class IndicatorLineEdit(QWidget): if not ph_text: _translate = QCoreApplication.translate - self.line_edit.setPlaceholderText(_translate("PathEdit", "Default")) + self.line_edit.setPlaceholderText(_translate(self.__class__.__name__, "Default")) if text: self.line_edit.setText(text)