mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 02:34:06 -04:00
Fix #1999307 [Enhancement Request: MDE editor: Quick toggle for metadata fields to download](https://bugs.launchpad.net/calibre/+bug/1999307)
This commit is contained in:
parent
f1815c2b82
commit
6be22faa78
@ -8,7 +8,7 @@ __docformat__ = 'restructuredtext en'
|
|||||||
from operator import attrgetter
|
from operator import attrgetter
|
||||||
from qt.core import (
|
from qt.core import (
|
||||||
QAbstractListModel, QAbstractTableModel, QDialogButtonBox, QFrame, QIcon, QLabel,
|
QAbstractListModel, QAbstractTableModel, QDialogButtonBox, QFrame, QIcon, QLabel,
|
||||||
QScrollArea, Qt, QVBoxLayout, QWidget, pyqtSignal, QDialog
|
QScrollArea, Qt, QVBoxLayout, QWidget, pyqtSignal, QDialog, QMenu, QCursor
|
||||||
)
|
)
|
||||||
|
|
||||||
from calibre.customize.ui import (
|
from calibre.customize.ui import (
|
||||||
@ -320,6 +320,8 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form):
|
|||||||
|
|
||||||
self.fields_model = FieldsModel(self)
|
self.fields_model = FieldsModel(self)
|
||||||
self.fields_view.setModel(self.fields_model)
|
self.fields_view.setModel(self.fields_model)
|
||||||
|
self.fields_view.setContextMenuPolicy(Qt.ContextMenuPolicy.CustomContextMenu)
|
||||||
|
self.fields_view.customContextMenuRequested.connect(self.context_menu)
|
||||||
self.fields_model.dataChanged.connect(self.changed_signal)
|
self.fields_model.dataChanged.connect(self.changed_signal)
|
||||||
|
|
||||||
self.select_all_button.clicked.connect(self.fields_model.select_all)
|
self.select_all_button.clicked.connect(self.fields_model.select_all)
|
||||||
@ -336,6 +338,14 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form):
|
|||||||
l.setStretch(0, 1)
|
l.setStretch(0, 1)
|
||||||
l.setStretch(1, 1)
|
l.setStretch(1, 1)
|
||||||
|
|
||||||
|
def context_menu(self, pos):
|
||||||
|
m = QMenu(self)
|
||||||
|
m.addAction(_('Select all'), self.fields_model.select_all)
|
||||||
|
m.addAction(_('Select none'), self.fields_model.clear_all)
|
||||||
|
m.addAction(_('Set as default'), self.fields_model.commit_user_defaults)
|
||||||
|
m.addAction(_('Select default'), self.fields_model.select_user_defaults)
|
||||||
|
m.exec(QCursor.pos())
|
||||||
|
|
||||||
def configure_plugin(self):
|
def configure_plugin(self):
|
||||||
for index in self.sources_view.selectionModel().selectedRows():
|
for index in self.sources_view.selectionModel().selectedRows():
|
||||||
plugin = self.sources_model.data(index, Qt.ItemDataRole.UserRole)
|
plugin = self.sources_model.data(index, Qt.ItemDataRole.UserRole)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user