mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Enhancement #1934043: Right click on item in the Manage items window to open the window to manage it.
One can now bring up the Manage ??? dialog by holding the SHIFT or CTRL key when clicking the button. If you want a particular item then copy the text to the clipboard before opening the editor then pasting it into the search or filter box.
This commit is contained in:
parent
ac0969b9e9
commit
d4187664af
@ -56,6 +56,7 @@ class Base(object):
|
|||||||
|
|
||||||
def __init__(self, db, col_id, parent=None):
|
def __init__(self, db, col_id, parent=None):
|
||||||
self.db, self.col_id = db, col_id
|
self.db, self.col_id = db, col_id
|
||||||
|
self.book_id = None
|
||||||
self.col_metadata = db.custom_column_num_map[col_id]
|
self.col_metadata = db.custom_column_num_map[col_id]
|
||||||
self.initial_val = self.widgets = None
|
self.initial_val = self.widgets = None
|
||||||
self.signals_to_disconnect = []
|
self.signals_to_disconnect = []
|
||||||
@ -86,6 +87,7 @@ class Base(object):
|
|||||||
l.addWidget(self.clear_button)
|
l.addWidget(self.clear_button)
|
||||||
|
|
||||||
def initialize(self, book_id):
|
def initialize(self, book_id):
|
||||||
|
self.book_id = book_id
|
||||||
val = self.db.get_custom(book_id, num=self.col_id, index_is_id=True)
|
val = self.db.get_custom(book_id, num=self.col_id, index_is_id=True)
|
||||||
val = self.normalize_db_val(val)
|
val = self.normalize_db_val(val)
|
||||||
self.setter(val)
|
self.setter(val)
|
||||||
@ -437,7 +439,7 @@ class MultipleWidget(QWidget):
|
|||||||
self.tags_box = EditWithComplete(parent)
|
self.tags_box = EditWithComplete(parent)
|
||||||
layout.addWidget(self.tags_box, stretch=1000)
|
layout.addWidget(self.tags_box, stretch=1000)
|
||||||
self.editor_button = QToolButton(self)
|
self.editor_button = QToolButton(self)
|
||||||
self.editor_button.setToolTip(_('Open item editor'))
|
self.editor_button.setToolTip(_('Open item editor. If CTRL or SHIFT is pressed, open manage items'))
|
||||||
self.editor_button.setIcon(QIcon(I('chapters.png')))
|
self.editor_button.setIcon(QIcon(I('chapters.png')))
|
||||||
layout.addWidget(self.editor_button)
|
layout.addWidget(self.editor_button)
|
||||||
self.setLayout(layout)
|
self.setLayout(layout)
|
||||||
@ -547,6 +549,8 @@ class Text(Base):
|
|||||||
return val
|
return val
|
||||||
|
|
||||||
def edit(self):
|
def edit(self):
|
||||||
|
ctrl_or_shift_pressed = (QApplication.keyboardModifiers() &
|
||||||
|
(Qt.KeyboardModifier.ControlModifier + Qt.KeyboardModifier.ShiftModifier))
|
||||||
if (self.getter() != self.initial_val and (self.getter() or self.initial_val)):
|
if (self.getter() != self.initial_val and (self.getter() or self.initial_val)):
|
||||||
d = _save_dialog(self.parent, _('Values changed'),
|
d = _save_dialog(self.parent, _('Values changed'),
|
||||||
_('You have changed the values. In order to use this '
|
_('You have changed the values. In order to use this '
|
||||||
@ -560,6 +564,11 @@ class Text(Base):
|
|||||||
self.initial_val = self.current_val
|
self.initial_val = self.current_val
|
||||||
else:
|
else:
|
||||||
self.setter(self.initial_val)
|
self.setter(self.initial_val)
|
||||||
|
if ctrl_or_shift_pressed:
|
||||||
|
from calibre.gui2.ui import get_gui
|
||||||
|
get_gui().do_tags_list_edit(None, self.key)
|
||||||
|
self.initialize(self.book_id)
|
||||||
|
else:
|
||||||
d = TagEditor(self.parent, self.db, self.book_id, self.key)
|
d = TagEditor(self.parent, self.db, self.book_id, self.key)
|
||||||
if d.exec_() == QDialog.DialogCode.Accepted:
|
if d.exec_() == QDialog.DialogCode.Accepted:
|
||||||
self.setter(d.tags)
|
self.setter(d.tags)
|
||||||
|
@ -1404,12 +1404,15 @@ class TagsEdit(EditWithComplete, ToMetadataMixin): # {{{
|
|||||||
self.current_val = tags
|
self.current_val = tags
|
||||||
self.update_items_cache(db.new_api.all_field_names('tags'))
|
self.update_items_cache(db.new_api.all_field_names('tags'))
|
||||||
self.original_val = self.current_val
|
self.original_val = self.current_val
|
||||||
|
self.db = db
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def changed(self):
|
def changed(self):
|
||||||
return self.current_val != self.original_val
|
return self.current_val != self.original_val
|
||||||
|
|
||||||
def edit(self, db, id_):
|
def edit(self, db, id_):
|
||||||
|
ctrl_or_shift_pressed = (QApplication.keyboardModifiers() &
|
||||||
|
(Qt.KeyboardModifier.ControlModifier + Qt.KeyboardModifier.ShiftModifier))
|
||||||
if self.changed:
|
if self.changed:
|
||||||
d = save_dialog(self, _('Tags changed'),
|
d = save_dialog(self, _('Tags changed'),
|
||||||
_('You have changed the tags. In order to use the tags'
|
_('You have changed the tags. In order to use the tags'
|
||||||
@ -1423,6 +1426,12 @@ class TagsEdit(EditWithComplete, ToMetadataMixin): # {{{
|
|||||||
self.original_val = self.current_val
|
self.original_val = self.current_val
|
||||||
else:
|
else:
|
||||||
self.current_val = self.original_val
|
self.current_val = self.original_val
|
||||||
|
if ctrl_or_shift_pressed:
|
||||||
|
from calibre.gui2.ui import get_gui
|
||||||
|
get_gui().do_tags_list_edit(None, 'tags')
|
||||||
|
self.update_items_cache(self.db.new_api.all_field_names('tags'))
|
||||||
|
self.initialize(self.db, id_)
|
||||||
|
else:
|
||||||
d = TagEditor(self, db, id_)
|
d = TagEditor(self, db, id_)
|
||||||
if d.exec_() == QDialog.DialogCode.Accepted:
|
if d.exec_() == QDialog.DialogCode.Accepted:
|
||||||
self.current_val = d.tags
|
self.current_val = d.tags
|
||||||
|
Loading…
x
Reference in New Issue
Block a user