From 956ef2d2331b3a6ab8a3d8ac55a80b1bd9b68ba2 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 7 Aug 2023 08:47:46 +0530 Subject: [PATCH] Allow using the new manage data files dialog from within the edit metadata dialog --- src/calibre/gui2/metadata/single.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/calibre/gui2/metadata/single.py b/src/calibre/gui2/metadata/single.py index 4d0fdd1cab..28334d52aa 100644 --- a/src/calibre/gui2/metadata/single.py +++ b/src/calibre/gui2/metadata/single.py @@ -92,6 +92,11 @@ class MetadataSingleDialogBase(QDialog): self.prev_button = QPushButton(QIcon.ic('back.png'), _('Previous'), self) self.prev_button.setShortcut(QKeySequence('Alt+Left')) + self.data_files_button = QPushButton(QIcon.ic('unpack-book.png'), _('Data files'), self) + self.data_files_button.setShortcut(QKeySequence('Alt+Space')) + self.data_files_button.setToolTip(_('Manage the extra data files associated with this book [{}]').format( + self.data_files_button.shortcut().toString(QKeySequence.SequenceFormat.NativeText))) + self.data_files_button.clicked.connect(self.manage_data_files) self.button_box.addButton(self.prev_button, QDialogButtonBox.ButtonRole.ActionRole) self.button_box.addButton(self.next_button, QDialogButtonBox.ButtonRole.ActionRole) @@ -106,6 +111,7 @@ class MetadataSingleDialogBase(QDialog): self.l.addWidget(self.central_widget) ll = self.button_box_layout = QHBoxLayout() self.l.addLayout(ll) + ll.addWidget(self.data_files_button) ll.addSpacing(10) ll.addWidget(self.button_box) @@ -383,6 +389,11 @@ class MetadataSingleDialogBase(QDialog): def data_changed(self): self.was_data_edited = True + def manage_data_files(self): + from calibre.gui2.dialogs.data_files_manager import DataFilesManager + d = DataFilesManager(self.db, self.book_id, self) + d.exec() + def __call__(self, id_): self.book_id = id_ self.books_to_refresh = set()