diff --git a/picard/ui/options/maintenance.py b/picard/ui/options/maintenance.py
index 92c5b1f6ee..7ba03f26f9 100644
--- a/picard/ui/options/maintenance.py
+++ b/picard/ui/options/maintenance.py
@@ -2,7 +2,7 @@
#
# Picard, the next-generation MusicBrainz tagger
#
-# Copyright (C) 2021-2022 Bob Swift
+# Copyright (C) 2021-2022, 2024 Bob Swift
# Copyright (C) 2021-2023 Philipp Wolfer
# Copyright (C) 2021-2024 Laurent Monin
#
@@ -85,23 +85,21 @@ def __init__(self, parent=None):
self.ui = Ui_MaintenanceOptionsPage()
self.ui.setupUi(self)
self.ui.description.setText(_(
- "This allows you to remove unused option settings from the configuration INI file.\n\n"
"Settings that are found in the configuration file that do not appear on any option "
- "settings page will be listed below. If your configuration file does not contain any "
+ "settings page are listed below. If your configuration file does not contain any "
"unused option settings, then the list will be empty and the removal checkbox will be "
"disabled.\n\n"
"Note that unused option settings could come from plugins that have been uninstalled, "
"so please be careful to not remove settings that you may want to use later when "
"the plugin is reinstalled. Options belonging to plugins that are installed but "
- "currently disabled will not be listed for possible removal.\n\n"
- "To remove one or more settings, first enable the removal by checking the \"Remove "
- "selected options\" box. You can then select the settings to remove by checking the "
- "box next to the setting. When you choose \"Make It So!\" to save your option "
+ "currently disabled are not listed for possible removal.\n\n"
+ "To remove one or more settings, select the settings that you want to remove by "
+ "checking the box next to the setting, and enable the removal by checking the \"Remove "
+ "selected options\" box. When you choose \"Make It So!\" to save your option "
"settings, the selected items will be removed."
))
self.ui.tableWidget.setHorizontalHeaderLabels([_("Option"), _("Value")])
self.ui.select_all.stateChanged.connect(self.select_all_changed)
- self.ui.enable_cleanup.stateChanged.connect(self.enable_cleanup_changed)
self.ui.open_folder_button.clicked.connect(self.open_config_dir)
self.ui.save_backup_button.clicked.connect(self.save_backup)
self.ui.load_backup_button.clicked.connect(self.load_backup)
@@ -172,7 +170,7 @@ def load(self):
self.ui.option_counts.setText(
_("The configuration file currently contains %(totalcount)d option "
- "settings, %(unusedcount)d which are unused.") % {
+ "settings (%(unusedcount)d unused).") % {
'totalcount': len(file_options),
'unusedcount': len(orphan_options),
})
@@ -200,9 +198,7 @@ def load(self):
self.ui.tableWidget.setCellWidget(row, 1, tableitem)
self.ui.tableWidget.resizeColumnsToContents()
self.ui.select_all.setCheckState(QtCore.Qt.CheckState.Unchecked)
- if not len(orphan_options):
- self.ui.select_all.setEnabled(False)
- self.enable_cleanup_changed()
+ self._set_cleanup_state()
def open_config_dir(self):
config = get_config()
@@ -393,10 +389,11 @@ def make_setting_value_text(self, key):
value = config.setting.raw_value(key)
return repr(value)
- def enable_cleanup_changed(self):
- state = self.ui.enable_cleanup.checkState() == QtCore.Qt.CheckState.Checked
+ def _set_cleanup_state(self):
+ state = self.ui.tableWidget.rowCount() > 0
self.ui.select_all.setEnabled(state)
- self.ui.tableWidget.setEnabled(state)
+ self.ui.enable_cleanup.setChecked(False)
+ self.ui.enable_cleanup.setEnabled(state)
register_options_page(MaintenanceOptionsPage)
diff --git a/picard/ui/options/releases.py b/picard/ui/options/releases.py
index d3799d41a2..5af54999c7 100644
--- a/picard/ui/options/releases.py
+++ b/picard/ui/options/releases.py
@@ -77,6 +77,7 @@ def __init__(self, *args):
self.setSingleStep(self._step)
self.setTickInterval(self._step)
self.setPageStep(self._pagestep)
+ self.tagger = QtCore.QCoreApplication.instance()
def showEvent(self, event):
super().showEvent(event)
diff --git a/picard/ui/searchdialog/album.py b/picard/ui/searchdialog/album.py
index 158a8e6f75..1016d51908 100644
--- a/picard/ui/searchdialog/album.py
+++ b/picard/ui/searchdialog/album.py
@@ -161,6 +161,7 @@ def __init__(self, parent, force_advanced_search=None, existing_album=None):
self.cover_cells = []
self.fetching = False
self.scrolled.connect(self.fetch_coverarts)
+ self.resized.connect(self.fetch_coverarts)
@staticmethod
def show_releasegroup_search(releasegroup_id, existing_album=None):
diff --git a/picard/ui/tablebaseddialog.py b/picard/ui/tablebaseddialog.py
index 0c899b6ceb..b51f3e8cb3 100644
--- a/picard/ui/tablebaseddialog.py
+++ b/picard/ui/tablebaseddialog.py
@@ -50,8 +50,9 @@
class ResultTable(QtWidgets.QTableWidget):
- def __init__(self, parent):
- super().__init__(parent)
+ def __init__(self, parent=None, parent_dialog=None):
+ super().__init__(parent=parent)
+ self.parent_dialog = parent_dialog
self.setSelectionMode(QtWidgets.QAbstractItemView.SelectionMode.ExtendedSelection)
self.setSelectionBehavior(QtWidgets.QAbstractItemView.SelectionBehavior.SelectRows)
self.setEditTriggers(QtWidgets.QAbstractItemView.EditTrigger.NoEditTriggers)
@@ -59,11 +60,8 @@ def __init__(self, parent):
self.horizontalHeader().setSectionResizeMode(QtWidgets.QHeaderView.ResizeMode.Stretch)
self.horizontalHeader().setSectionResizeMode(QtWidgets.QHeaderView.ResizeMode.Interactive)
- @throttle(1000) # only emit scrolled signal once per second
- def emit_scrolled(x):
- parent.scrolled.emit()
- self.horizontalScrollBar().valueChanged.connect(emit_scrolled)
- self.verticalScrollBar().valueChanged.connect(emit_scrolled)
+ self.horizontalScrollBar().valueChanged.connect(self.emit_scrolled)
+ self.verticalScrollBar().valueChanged.connect(self.emit_scrolled)
self.setHorizontalScrollMode(QtWidgets.QAbstractItemView.ScrollMode.ScrollPerPixel)
def prepare(self, headers):
@@ -73,6 +71,20 @@ def prepare(self, headers):
self.setRowCount(0)
self.setSortingEnabled(False)
+ @throttle(1000) # only emit scrolled signal once per second
+ def emit_scrolled(self, value):
+ if self.parent_dialog:
+ self.parent_dialog.scrolled.emit()
+
+ @throttle(1000) # only emit resized signal once per second
+ def emit_resized(self):
+ if self.parent_dialog:
+ self.parent_dialog.resized.emit()
+
+ def resizeEvent(self, event):
+ self.emit_resized()
+ super().resizeEvent(event)
+
class SortableTableWidgetItem(QtWidgets.QTableWidgetItem):
@@ -88,6 +100,7 @@ class TableBasedDialog(PicardDialog):
defaultsize = QtCore.QSize(720, 360)
scrolled = pyqtSignal()
+ resized = pyqtSignal()
def __init__(self, parent):
super().__init__(parent)
@@ -155,7 +168,7 @@ def add_widget_to_center_layout(self, widget):
widget.show()
def create_table_obj(self):
- return ResultTable(self)
+ return ResultTable(parent_dialog=self)
def create_table(self):
self.table = self.create_table_obj()
diff --git a/picard/ui/ui_options_maintenance.py b/picard/ui/ui_options_maintenance.py
index d8b5956ed6..e139d299d6 100644
--- a/picard/ui/ui_options_maintenance.py
+++ b/picard/ui/ui_options_maintenance.py
@@ -92,9 +92,6 @@ def setupUi(self, MaintenanceOptionsPage):
self.option_counts.setText("")
self.option_counts.setObjectName("option_counts")
self.vboxlayout.addWidget(self.option_counts)
- self.enable_cleanup = QtWidgets.QCheckBox(parent=MaintenanceOptionsPage)
- self.enable_cleanup.setObjectName("enable_cleanup")
- self.vboxlayout.addWidget(self.enable_cleanup)
self.description = QtWidgets.QLabel(parent=MaintenanceOptionsPage)
self.description.setText("")
self.description.setAlignment(QtCore.Qt.AlignmentFlag.AlignLeading|QtCore.Qt.AlignmentFlag.AlignLeft|QtCore.Qt.AlignmentFlag.AlignTop)
@@ -109,9 +106,18 @@ def setupUi(self, MaintenanceOptionsPage):
self.line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken)
self.line.setObjectName("line")
self.vboxlayout.addWidget(self.line)
+ self.horizontalLayout_2 = QtWidgets.QHBoxLayout()
+ self.horizontalLayout_2.setContentsMargins(-1, 0, -1, -1)
+ self.horizontalLayout_2.setObjectName("horizontalLayout_2")
self.select_all = QtWidgets.QCheckBox(parent=MaintenanceOptionsPage)
self.select_all.setObjectName("select_all")
- self.vboxlayout.addWidget(self.select_all)
+ self.horizontalLayout_2.addWidget(self.select_all)
+ spacerItem2 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Minimum)
+ self.horizontalLayout_2.addItem(spacerItem2)
+ self.enable_cleanup = QtWidgets.QCheckBox(parent=MaintenanceOptionsPage)
+ self.enable_cleanup.setObjectName("enable_cleanup")
+ self.horizontalLayout_2.addWidget(self.enable_cleanup)
+ self.vboxlayout.addLayout(self.horizontalLayout_2)
self.tableWidget = QtWidgets.QTableWidget(parent=MaintenanceOptionsPage)
self.tableWidget.setSizeAdjustPolicy(QtWidgets.QAbstractScrollArea.SizeAdjustPolicy.AdjustToContents)
self.tableWidget.setEditTriggers(QtWidgets.QAbstractItemView.EditTrigger.NoEditTriggers)
@@ -124,6 +130,14 @@ def setupUi(self, MaintenanceOptionsPage):
self.retranslateUi(MaintenanceOptionsPage)
QtCore.QMetaObject.connectSlotsByName(MaintenanceOptionsPage)
+ MaintenanceOptionsPage.setTabOrder(self.config_file, self.open_folder_button)
+ MaintenanceOptionsPage.setTabOrder(self.open_folder_button, self.autobackup_dir)
+ MaintenanceOptionsPage.setTabOrder(self.autobackup_dir, self.browse_autobackup_dir)
+ MaintenanceOptionsPage.setTabOrder(self.browse_autobackup_dir, self.load_backup_button)
+ MaintenanceOptionsPage.setTabOrder(self.load_backup_button, self.save_backup_button)
+ MaintenanceOptionsPage.setTabOrder(self.save_backup_button, self.select_all)
+ MaintenanceOptionsPage.setTabOrder(self.select_all, self.enable_cleanup)
+ MaintenanceOptionsPage.setTabOrder(self.enable_cleanup, self.tableWidget)
def retranslateUi(self, MaintenanceOptionsPage):
self.label.setText(_("Configuration file:"))
@@ -132,5 +146,5 @@ def retranslateUi(self, MaintenanceOptionsPage):
self.browse_autobackup_dir.setText(_("Browse…"))
self.load_backup_button.setText(_("Load backup…"))
self.save_backup_button.setText(_("Save backup…"))
- self.enable_cleanup.setText(_("Remove selected options"))
self.select_all.setText(_("Select all"))
+ self.enable_cleanup.setText(_("Remove selected options"))
diff --git a/ui/options_maintenance.ui b/ui/options_maintenance.ui
index 34a44ef546..7ab1503cfb 100644
--- a/ui/options_maintenance.ui
+++ b/ui/options_maintenance.ui
@@ -138,13 +138,6 @@
- -
-
-
- Remove selected options
-
-
-
-
@@ -185,11 +178,38 @@
-
-
-
- Select all
+
+
+ 0
-
+
-
+
+
+ Select all
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+ -
+
+
+ Remove selected options
+
+
+
+
-
@@ -214,6 +234,17 @@
+
+ config_file
+ open_folder_button
+ autobackup_dir
+ browse_autobackup_dir
+ load_backup_button
+ save_backup_button
+ select_all
+ enable_cleanup
+ tableWidget
+