Allow using the new manage data files dialog from within the edit metadata dialog

This commit is contained in:
Kovid Goyal 2023-08-07 08:47:46 +05:30
parent c9f411f5bc
commit 956ef2d233
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -92,6 +92,11 @@ class MetadataSingleDialogBase(QDialog):
self.prev_button = QPushButton(QIcon.ic('back.png'), _('Previous'), self.prev_button = QPushButton(QIcon.ic('back.png'), _('Previous'),
self) self)
self.prev_button.setShortcut(QKeySequence('Alt+Left')) 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.prev_button, QDialogButtonBox.ButtonRole.ActionRole)
self.button_box.addButton(self.next_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) self.l.addWidget(self.central_widget)
ll = self.button_box_layout = QHBoxLayout() ll = self.button_box_layout = QHBoxLayout()
self.l.addLayout(ll) self.l.addLayout(ll)
ll.addWidget(self.data_files_button)
ll.addSpacing(10) ll.addSpacing(10)
ll.addWidget(self.button_box) ll.addWidget(self.button_box)
@ -383,6 +389,11 @@ class MetadataSingleDialogBase(QDialog):
def data_changed(self): def data_changed(self):
self.was_data_edited = True 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_): def __call__(self, id_):
self.book_id = id_ self.book_id = id_
self.books_to_refresh = set() self.books_to_refresh = set()