1
0
Fork 0
mirror of synced 2024-06-28 11:11:15 +12:00

Add directory watcher to monitor egl_programdata folder for changes.

Clear known manifests when changing directory
Run egl_sync() after importing or exporting
Arrange Importable and Exportable lists vertically

Signed-off-by: Stelios Tsampas <loathingkernel@gmail.com>
This commit is contained in:
Stelios Tsampas 2021-10-16 23:21:36 +03:00 committed by Dummerle
parent 3065105365
commit d8f39857db
No known key found for this signature in database
GPG key ID: AB68CC59CA39F2F1
5 changed files with 241 additions and 234 deletions

View file

@ -4,7 +4,7 @@ from glob import glob
from typing import Tuple from typing import Tuple
from logging import getLogger from logging import getLogger
from PyQt5.QtCore import Qt, QThread from PyQt5.QtCore import Qt, QThread, QFileSystemWatcher
from PyQt5.QtWidgets import QHBoxLayout, QVBoxLayout, QLabel, QGroupBox, \ from PyQt5.QtWidgets import QHBoxLayout, QVBoxLayout, QLabel, QGroupBox, \
QCheckBox, QPushButton, QListWidgetItem, QDialog, QFileDialog, QSizePolicy QCheckBox, QPushButton, QListWidgetItem, QDialog, QFileDialog, QSizePolicy
@ -62,22 +62,28 @@ class EGLSyncGroup(QGroupBox, Ui_EGLSyncGroup):
# if os.path.exists(p := os.path.join(i, "drive_c/ProgramData/Epic/EpicGamesLauncher/Data/Manifests")): # if os.path.exists(p := os.path.join(i, "drive_c/ProgramData/Epic/EpicGamesLauncher/Data/Manifests")):
# egl_path = p # egl_path = p
if platform.system() != "Windows": egl_path = shared.core.egl.programdata_path
egl_path = self.core.egl.programdata_path if egl_path is None:
if egl_path is None: egl_path = str()
egl_path = str() self.egl_path_edit = PathEdit(
self.egl_path_edit = PathEdit( path=egl_path,
path=egl_path, ph_text=estimated_path,
ph_text=estimated_path, file_type=QFileDialog.DirectoryOnly,
file_type=QFileDialog.DirectoryOnly, edit_func=self.egl_path_edit_cb,
edit_func=self.egl_path_edit_cb, save_func=self.egl_path_save_cb,
save_func=self.egl_path_save_cb, parent=self
parent=self )
) self.egl_path_edit.textChanged.connect(self.egl_path_changed)
self.egl_path_edit.textChanged.connect(self.egl_path_changed) self.egl_path_layout.addWidget(self.egl_path_edit)
self.egl_path_layout.addWidget(self.egl_path_edit)
else: self.egl_watcher = QFileSystemWatcher([self.egl_path_edit.text()], self)
self.egl_watcher.directoryChanged.connect(self.egl_items_changed)
if platform.system() == "Windows":
self.egl_path_label.setVisible(False) self.egl_path_label.setVisible(False)
self.egl_path_edit.setVisible(False)
self.egl_path_info_label.setVisible(False)
self.egl_path_info.setVisible(False)
self.egl_sync_check.setChecked(shared.core.egl_sync_enabled) self.egl_sync_check.setChecked(shared.core.egl_sync_enabled)
self.egl_sync_check.stateChanged.connect(self.egl_sync_changed) self.egl_sync_check.stateChanged.connect(self.egl_sync_changed)
@ -118,69 +124,70 @@ class EGLSyncGroup(QGroupBox, Ui_EGLSyncGroup):
return True, path return True, path
return False, path return False, path
def egl_path_save_cb(self, path): @staticmethod
def egl_path_save_cb(path):
if not path: if not path:
# This is the same as "--unlink" # This is the same as "--unlink"
self.core.egl.programdata_path = None shared.core.egl.programdata_path = None
self.core.lgd.config.remove_option('Legendary', 'egl_programdata') shared.core.lgd.config.remove_option('Legendary', 'egl_programdata')
self.core.lgd.config.remove_option('Legendary', 'egl_sync') shared.core.lgd.config.remove_option('Legendary', 'egl_sync')
# remove EGL GUIDs from all games, DO NOT remove .egstore folders because that would fuck things up. # remove EGL GUIDs from all games, DO NOT remove .egstore folders because that would fuck things up.
for igame in self.core.get_installed_list(): for igame in shared.core.get_installed_list():
igame.egl_guid = '' igame.egl_guid = ''
self.core.install_game(igame) shared.core.install_game(igame)
else: else:
self.core.egl.programdata_path = path # NOTE: need to clear known manifests to force refresh
self.core.lgd.config.set("Legendary", "egl_programdata", path) shared.core.egl.manifests.clear()
self.core.lgd.save_config() shared.core.egl.programdata_path = path
shared.core.lgd.config.set("Legendary", "egl_programdata", path)
shared.core.lgd.save_config()
def egl_path_changed(self, path): def egl_path_changed(self, path):
if self.egl_path_edit.is_valid: if self.egl_path_edit.is_valid:
self.egl_sync_check.setEnabled(bool(path)) self.egl_sync_check.setEnabled(bool(path))
self.egl_sync_check.setCheckState(Qt.Unchecked) self.egl_sync_check.setCheckState(Qt.Unchecked)
self.update_lists() self.egl_watcher.removePaths([p for p in self.egl_watcher.directories()])
self.egl_watcher.addPaths([path])
self.update_lists()
def egl_sync_changed(self, state): def egl_sync_changed(self, state):
if state == Qt.Unchecked: if state == Qt.Unchecked:
self.core.lgd.config.remove_option('Legendary', 'egl_sync') self.core.lgd.config.remove_option('Legendary', 'egl_sync')
else: else:
self.core.lgd.config.set('Legendary', 'egl_sync', str(True)) self.core.lgd.config.set('Legendary', 'egl_sync', str(True))
# self.core.egl_sync() # lk: not sure if this should be done here
# self.update_lists() # self.select_items(self.importable_items, Qt.Checked)
# self.import_selected()
# self.select_items(self.exportable_items, Qt.Checked)
# self.export_selected()
self.core.lgd.save_config() self.core.lgd.save_config()
def egl_items_changed(self, path: str):
if path == shared.core.egl.programdata_path and self.egl_path_edit.is_valid:
shared.core.egl.manifests.clear()
self.update_import_list()
self.update_export_list()
def update_lists(self): def update_lists(self):
have_path = bool(shared.core.egl.programdata_path) and self.egl_path_edit.is_valid have_path = bool(shared.core.egl.programdata_path) and self.egl_path_edit.is_valid
self.egl_sync_label.setEnabled(have_path) self.egl_sync_label.setEnabled(have_path)
self.egl_sync_check.setEnabled(have_path) self.egl_sync_check.setEnabled(have_path)
self.export_import_widget.setEnabled(have_path) self.import_export_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_label.setVisible(not have_path)
self.import_list.setVisible(have_path) self.import_list.setVisible(have_path)
self.import_buttons_widget.setVisible(have_path) self.import_buttons_widget.setVisible(have_path)
self.export_label.setVisible(not have_path)
self.export_list.setVisible(have_path)
self.export_buttons_widget.setVisible(have_path)
if not have_path: if not have_path:
return return
self.update_export_list()
self.update_import_list() self.update_import_list()
self.update_export_list()
def update_export_list(self):
self.export_list.clear()
self.exportable_items.clear()
exportable_games = shared.core.egl_get_exportable()
for igame in exportable_games:
ew = EGLSyncItem(igame, True, self.export_list)
self.exportable_items.append(ew)
self.export_list.addItem(ew)
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): def update_import_list(self):
self.import_list.clear() self.import_list.clear()
@ -195,25 +202,40 @@ class EGLSyncGroup(QGroupBox, Ui_EGLSyncGroup):
self.import_list.setVisible(have_importable) self.import_list.setVisible(have_importable)
self.import_buttons_widget.setVisible(have_importable) self.import_buttons_widget.setVisible(have_importable)
def update_export_list(self):
self.export_list.clear()
self.exportable_items.clear()
exportable_games = shared.core.egl_get_exportable()
for igame in exportable_games:
ew = EGLSyncItem(igame, True, self.export_list)
self.exportable_items.append(ew)
self.export_list.addItem(ew)
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)
@staticmethod @staticmethod
def select_items(item_list, state): def select_items(item_list, state):
for w in item_list: for w in item_list:
w.setCheckState(state) w.setCheckState(state)
def export_selected(self):
for ew in self.exportable_items:
if ew.is_checked():
ew.export_game()
self.export_list.takeItem(self.export_list.row(ew))
self.update_export_list()
def import_selected(self): def import_selected(self):
for iw in self.importable_items: for iw in self.importable_items:
if iw.is_checked: if iw.is_checked:
iw.import_game() iw.import_game()
self.import_list.takeItem(self.import_list.row(iw)) self.import_list.takeItem(self.import_list.row(iw))
self.core.egl_sync()
self.update_import_list() self.update_import_list()
def export_selected(self):
for ew in self.exportable_items:
if ew.is_checked():
ew.export_game()
self.export_list.takeItem(self.export_list.row(ew))
self.core.egl_sync()
self.update_export_list()
class EGLSyncItem(QListWidgetItem): class EGLSyncItem(QListWidgetItem):
def __init__(self, game, export: bool, parent=None): def __init__(self, game, export: bool, parent=None):

View file

@ -12,9 +12,13 @@
} }
QLabel { QLabel {
border-width: 0px; border-width: 1px;
border-style: solid;
border-radius: 2px;
border-color: transparent;
background-color: transparent; background-color: transparent;
padding: 0px; padding: 0px;
selection-background-color: #2f4f4f;
} }
QMenu, QMenu,

View file

@ -14,7 +14,7 @@ from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_EGLSyncGroup(object): class Ui_EGLSyncGroup(object):
def setupUi(self, EGLSyncGroup): def setupUi(self, EGLSyncGroup):
EGLSyncGroup.setObjectName("EGLSyncGroup") EGLSyncGroup.setObjectName("EGLSyncGroup")
EGLSyncGroup.resize(772, 368) EGLSyncGroup.resize(814, 702)
EGLSyncGroup.setCheckable(False) EGLSyncGroup.setCheckable(False)
EGLSyncGroup.setChecked(False) EGLSyncGroup.setChecked(False)
self.egl_sync_layout = QtWidgets.QFormLayout(EGLSyncGroup) self.egl_sync_layout = QtWidgets.QFormLayout(EGLSyncGroup)
@ -23,6 +23,9 @@ class Ui_EGLSyncGroup(object):
self.egl_path_label = QtWidgets.QLabel(EGLSyncGroup) self.egl_path_label = QtWidgets.QLabel(EGLSyncGroup)
self.egl_path_label.setObjectName("egl_path_label") self.egl_path_label.setObjectName("egl_path_label")
self.egl_sync_layout.setWidget(0, QtWidgets.QFormLayout.LabelRole, self.egl_path_label) self.egl_sync_layout.setWidget(0, QtWidgets.QFormLayout.LabelRole, self.egl_path_label)
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_path_info_label = QtWidgets.QLabel(EGLSyncGroup) self.egl_path_info_label = QtWidgets.QLabel(EGLSyncGroup)
self.egl_path_info_label.setObjectName("egl_path_info_label") 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.egl_sync_layout.setWidget(1, QtWidgets.QFormLayout.LabelRole, self.egl_path_info_label)
@ -31,22 +34,48 @@ class Ui_EGLSyncGroup(object):
self.egl_path_info.setTextInteractionFlags(QtCore.Qt.LinksAccessibleByMouse|QtCore.Qt.TextSelectableByMouse) self.egl_path_info.setTextInteractionFlags(QtCore.Qt.LinksAccessibleByMouse|QtCore.Qt.TextSelectableByMouse)
self.egl_path_info.setObjectName("egl_path_info") self.egl_path_info.setObjectName("egl_path_info")
self.egl_sync_layout.setWidget(1, QtWidgets.QFormLayout.FieldRole, self.egl_path_info) self.egl_sync_layout.setWidget(1, QtWidgets.QFormLayout.FieldRole, self.egl_path_info)
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.egl_sync_check = QtWidgets.QCheckBox(EGLSyncGroup) self.egl_sync_check = QtWidgets.QCheckBox(EGLSyncGroup)
self.egl_sync_check.setText("") self.egl_sync_check.setText("")
self.egl_sync_check.setObjectName("egl_sync_check") self.egl_sync_check.setObjectName("egl_sync_check")
self.egl_sync_layout.setWidget(2, QtWidgets.QFormLayout.FieldRole, self.egl_sync_check) self.egl_sync_layout.setWidget(2, QtWidgets.QFormLayout.FieldRole, self.egl_sync_check)
self.egl_path_layout = QtWidgets.QHBoxLayout() self.import_export_widget = QtWidgets.QWidget(EGLSyncGroup)
self.egl_path_layout.setObjectName("egl_path_layout") self.import_export_widget.setObjectName("import_export_widget")
self.egl_sync_layout.setLayout(0, QtWidgets.QFormLayout.FieldRole, self.egl_path_layout) self.import_export_layout = QtWidgets.QVBoxLayout(self.import_export_widget)
self.egl_sync_label = QtWidgets.QLabel(EGLSyncGroup) self.import_export_layout.setContentsMargins(0, 0, 0, 0)
self.egl_sync_label.setObjectName("egl_sync_label") self.import_export_layout.setObjectName("import_export_layout")
self.egl_sync_layout.setWidget(2, QtWidgets.QFormLayout.LabelRole, self.egl_sync_label) self.import_group = QtWidgets.QGroupBox(self.import_export_widget)
self.export_import_widget = QtWidgets.QWidget(EGLSyncGroup) self.import_group.setObjectName("import_group")
self.export_import_widget.setObjectName("export_import_widget") self.import_layout = QtWidgets.QVBoxLayout(self.import_group)
self.export_import_layout = QtWidgets.QHBoxLayout(self.export_import_widget) self.import_layout.setObjectName("import_layout")
self.export_import_layout.setContentsMargins(0, 0, 0, 0) self.import_label = QtWidgets.QLabel(self.import_group)
self.export_import_layout.setObjectName("export_import_layout") self.import_label.setObjectName("import_label")
self.export_group = QtWidgets.QGroupBox(self.export_import_widget) self.import_layout.addWidget(self.import_label)
self.import_list = QtWidgets.QListWidget(self.import_group)
self.import_list.setAlternatingRowColors(True)
self.import_list.setObjectName("import_list")
self.import_layout.addWidget(self.import_list)
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_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_buttons_widget)
self.import_select_none_button.setObjectName("import_select_none_button")
self.import_buttons_layout.addWidget(self.import_select_none_button)
spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
self.import_buttons_layout.addItem(spacerItem)
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.addWidget(self.import_buttons_widget, 0, QtCore.Qt.AlignLeft)
self.import_export_layout.addWidget(self.import_group)
self.export_group = QtWidgets.QGroupBox(self.import_export_widget)
self.export_group.setObjectName("export_group") self.export_group.setObjectName("export_group")
self.export_layout = QtWidgets.QVBoxLayout(self.export_group) self.export_layout = QtWidgets.QVBoxLayout(self.export_group)
self.export_layout.setObjectName("export_layout") self.export_layout.setObjectName("export_layout")
@ -57,8 +86,6 @@ class Ui_EGLSyncGroup(object):
self.export_list.setAlternatingRowColors(True) self.export_list.setAlternatingRowColors(True)
self.export_list.setObjectName("export_list") self.export_list.setObjectName("export_list")
self.export_layout.addWidget(self.export_list) self.export_layout.addWidget(self.export_list)
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 = QtWidgets.QWidget(self.export_group)
self.export_buttons_widget.setObjectName("export_buttons_widget") self.export_buttons_widget.setObjectName("export_buttons_widget")
self.export_buttons_layout = QtWidgets.QHBoxLayout(self.export_buttons_widget) self.export_buttons_layout = QtWidgets.QHBoxLayout(self.export_buttons_widget)
@ -75,40 +102,9 @@ class Ui_EGLSyncGroup(object):
self.export_button = QtWidgets.QPushButton(self.export_buttons_widget) self.export_button = QtWidgets.QPushButton(self.export_buttons_widget)
self.export_button.setObjectName("export_button") self.export_button.setObjectName("export_button")
self.export_buttons_layout.addWidget(self.export_button) self.export_buttons_layout.addWidget(self.export_button)
self.export_layout.addWidget(self.export_buttons_widget) self.export_layout.addWidget(self.export_buttons_widget, 0, QtCore.Qt.AlignLeft)
self.export_import_layout.addWidget(self.export_group) self.import_export_layout.addWidget(self.export_group)
self.import_group = QtWidgets.QGroupBox(self.export_import_widget) self.egl_sync_layout.setWidget(3, QtWidgets.QFormLayout.SpanningRole, self.import_export_widget)
self.import_group.setObjectName("import_group")
self.import_layout = QtWidgets.QVBoxLayout(self.import_group)
self.import_layout.setObjectName("import_layout")
self.import_label = QtWidgets.QLabel(self.import_group)
self.import_label.setObjectName("import_label")
self.import_layout.addWidget(self.import_label)
self.import_list = QtWidgets.QListWidget(self.import_group)
self.import_list.setAlternatingRowColors(True)
self.import_list.setObjectName("import_list")
self.import_layout.addWidget(self.import_list)
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_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_buttons_widget)
self.import_select_none_button.setObjectName("import_select_none_button")
self.import_buttons_layout.addWidget(self.import_select_none_button)
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.addWidget(self.import_buttons_widget)
self.export_import_layout.addWidget(self.import_group)
self.egl_sync_layout.setWidget(3, QtWidgets.QFormLayout.SpanningRole, self.export_import_widget)
self.retranslateUi(EGLSyncGroup) self.retranslateUi(EGLSyncGroup)
QtCore.QMetaObject.connectSlotsByName(EGLSyncGroup) QtCore.QMetaObject.connectSlotsByName(EGLSyncGroup)
@ -120,18 +116,18 @@ class Ui_EGLSyncGroup(object):
self.egl_path_label.setText(_translate("EGLSyncGroup", "Prefix/Manifest path")) self.egl_path_label.setText(_translate("EGLSyncGroup", "Prefix/Manifest path"))
self.egl_path_info_label.setText(_translate("EGLSyncGroup", "Estimated path")) self.egl_path_info_label.setText(_translate("EGLSyncGroup", "Estimated path"))
self.egl_sync_label.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)
self.export_select_all_button.setText(_translate("EGLSyncGroup", "Select all"))
self.export_select_none_button.setText(_translate("EGLSyncGroup", "Select none"))
self.export_button.setText(_translate("EGLSyncGroup", "Export"))
self.import_group.setTitle(_translate("EGLSyncGroup", "Importable games")) self.import_group.setTitle(_translate("EGLSyncGroup", "Importable games"))
self.import_label.setText(_translate("EGLSyncGroup", "No games to import from EGS")) self.import_label.setText(_translate("EGLSyncGroup", "No games to import from EGS"))
self.import_list.setSortingEnabled(True) self.import_list.setSortingEnabled(True)
self.import_select_all_button.setText(_translate("EGLSyncGroup", "Select all")) self.import_select_all_button.setText(_translate("EGLSyncGroup", "Select all"))
self.import_select_none_button.setText(_translate("EGLSyncGroup", "Select none")) self.import_select_none_button.setText(_translate("EGLSyncGroup", "Select none"))
self.import_button.setText(_translate("EGLSyncGroup", "Import")) self.import_button.setText(_translate("EGLSyncGroup", "Import"))
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)
self.export_select_all_button.setText(_translate("EGLSyncGroup", "Select all"))
self.export_select_none_button.setText(_translate("EGLSyncGroup", "Select none"))
self.export_button.setText(_translate("EGLSyncGroup", "Export"))
if __name__ == "__main__": if __name__ == "__main__":

View file

@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>772</width> <width>814</width>
<height>368</height> <height>702</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@ -33,6 +33,9 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="1">
<layout class="QHBoxLayout" name="egl_path_layout"/>
</item>
<item row="1" column="0"> <item row="1" column="0">
<widget class="QLabel" name="egl_path_info_label"> <widget class="QLabel" name="egl_path_info_label">
<property name="text"> <property name="text">
@ -50,16 +53,6 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="1">
<widget class="QCheckBox" name="egl_sync_check">
<property name="text">
<string notr="true"/>
</property>
</widget>
</item>
<item row="0" column="1">
<layout class="QHBoxLayout" name="egl_path_layout"/>
</item>
<item row="2" column="0"> <item row="2" column="0">
<widget class="QLabel" name="egl_sync_label"> <widget class="QLabel" name="egl_sync_label">
<property name="text"> <property name="text">
@ -67,9 +60,16 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="1">
<widget class="QCheckBox" name="egl_sync_check">
<property name="text">
<string notr="true"/>
</property>
</widget>
</item>
<item row="3" column="0" colspan="2"> <item row="3" column="0" colspan="2">
<widget class="QWidget" name="export_import_widget" native="true"> <widget class="QWidget" name="import_export_widget" native="true">
<layout class="QHBoxLayout" name="export_import_layout"> <layout class="QVBoxLayout" name="import_export_layout">
<property name="leftMargin"> <property name="leftMargin">
<number>0</number> <number>0</number>
</property> </property>
@ -82,97 +82,6 @@
<property name="bottomMargin"> <property name="bottomMargin">
<number>0</number> <number>0</number>
</property> </property>
<item>
<widget class="QGroupBox" name="export_group">
<property name="title">
<string>Exportable games</string>
</property>
<layout class="QVBoxLayout" name="export_layout">
<item>
<widget class="QLabel" name="export_label">
<property name="text">
<string>No games to export to EGS</string>
</property>
</widget>
</item>
<item>
<widget class="QListWidget" name="export_list">
<property name="alternatingRowColors">
<bool>true</bool>
</property>
<property name="sortingEnabled">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<spacer name="export_group_hspacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>4</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QWidget" name="export_buttons_widget" native="true">
<layout class="QHBoxLayout" name="export_buttons_layout">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QPushButton" name="export_select_all_button">
<property name="text">
<string>Select all</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="export_select_none_button">
<property name="text">
<string>Select none</string>
</property>
</widget>
</item>
<item>
<spacer name="export_buttons_hspacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="export_button">
<property name="text">
<string>Export</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</item>
<item> <item>
<widget class="QGroupBox" name="import_group"> <widget class="QGroupBox" name="import_group">
<property name="title"> <property name="title">
@ -191,25 +100,15 @@
<property name="alternatingRowColors"> <property name="alternatingRowColors">
<bool>true</bool> <bool>true</bool>
</property> </property>
<property name="spacing">
<number>1</number>
</property>
<property name="sortingEnabled"> <property name="sortingEnabled">
<bool>true</bool> <bool>true</bool>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item alignment="Qt::AlignLeft">
<spacer name="import_group_hspacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>4</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QWidget" name="import_buttons_widget" native="true"> <widget class="QWidget" name="import_buttons_widget" native="true">
<layout class="QHBoxLayout" name="import_buttons_layout"> <layout class="QHBoxLayout" name="import_buttons_layout">
<property name="leftMargin"> <property name="leftMargin">
@ -264,6 +163,87 @@
</layout> </layout>
</widget> </widget>
</item> </item>
<item>
<widget class="QGroupBox" name="export_group">
<property name="title">
<string>Exportable games</string>
</property>
<layout class="QVBoxLayout" name="export_layout">
<item>
<widget class="QLabel" name="export_label">
<property name="text">
<string>No games to export to EGS</string>
</property>
</widget>
</item>
<item>
<widget class="QListWidget" name="export_list">
<property name="alternatingRowColors">
<bool>true</bool>
</property>
<property name="spacing">
<number>1</number>
</property>
<property name="sortingEnabled">
<bool>true</bool>
</property>
</widget>
</item>
<item alignment="Qt::AlignLeft">
<widget class="QWidget" name="export_buttons_widget" native="true">
<layout class="QHBoxLayout" name="export_buttons_layout">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QPushButton" name="export_select_all_button">
<property name="text">
<string>Select all</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="export_select_none_button">
<property name="text">
<string>Select none</string>
</property>
</widget>
</item>
<item>
<spacer name="export_buttons_hspacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="export_button">
<property name="text">
<string>Export</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</item>
</layout> </layout>
</widget> </widget>
</item> </item>

View file

@ -148,22 +148,27 @@ class IndicatorLineEdit(QWidget):
self.indicator_label = QLabel() self.indicator_label = QLabel()
self.indicator_label.setPixmap(icon("ei.info-circle", color="gray").pixmap(16, 16)) self.indicator_label.setPixmap(icon("ei.info-circle", color="gray").pixmap(16, 16))
self.indicator_label.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed) self.indicator_label.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
self.__indicator(edit_func(text)[0])
self.layout.addWidget(self.indicator_label) self.layout.addWidget(self.indicator_label)
if not ph_text: if not ph_text:
_translate = QCoreApplication.translate _translate = QCoreApplication.translate
self.line_edit.setPlaceholderText(_translate(self.__class__.__name__, "Default")) self.line_edit.setPlaceholderText(_translate(self.__class__.__name__, "Default"))
if text:
self.line_edit.setText(text)
self.edit_func = edit_func self.edit_func = edit_func
self.save_func = save_func self.save_func = save_func
self.line_edit.textChanged.connect(self.__edit) self.line_edit.textChanged.connect(self.__edit)
if self.edit_func is None: if self.edit_func is None:
self.line_edit.textChanged.connect(self.__save) self.line_edit.textChanged.connect(self.__save)
# lk: this can be placed here to trigger __edit
# lk: it going to save the input again if it is valid which
# lk: is ok to do given the checks don't misbehave (they shouldn't)
# lk: however it is going to edit any "understood" bad input to good input
# lk: and we might not want that (but the validity check reports on the edited string)
# lk: it is also going to trigger this widget's textChanged signal but that gets lost
if text:
self.line_edit.setText(text)
def text(self) -> str: def text(self) -> str:
return self.line_edit.text() return self.line_edit.text()