mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Impliment Bug #4529: Support Delete key for format list in metadata single dialog.
This commit is contained in:
parent
07f90ad1a8
commit
e6d92db622
@ -171,7 +171,7 @@ class MetadataSingleDialog(ResizableDialog, Ui_MetadataSingleDialog):
|
||||
if self._add_formats(paths):
|
||||
event.accept()
|
||||
|
||||
def remove_format(self, x):
|
||||
def remove_format(self, x=None):
|
||||
rows = self.formats.selectionModel().selectedRows(0)
|
||||
for row in rows:
|
||||
self.formats.takeItem(row.row())
|
||||
@ -327,6 +327,7 @@ class MetadataSingleDialog(ResizableDialog, Ui_MetadataSingleDialog):
|
||||
self.deduce_author_sort)
|
||||
self.connect(self.formats, SIGNAL('itemDoubleClicked(QListWidgetItem*)'),
|
||||
self.show_format)
|
||||
self.connect(self.formats, SIGNAL('delete_format()'), self.remove_format)
|
||||
self.connect(self.button_set_cover, SIGNAL('clicked()'), self.set_cover)
|
||||
self.connect(self.button_set_metadata, SIGNAL('clicked()'),
|
||||
self.set_metadata_from_format)
|
||||
|
@ -137,6 +137,13 @@ class FormatList(QListWidget):
|
||||
def dragMoveEvent(self, event):
|
||||
event.acceptProposedAction()
|
||||
|
||||
def keyPressEvent(self, event):
|
||||
if event.key() == Qt.Key_Delete:
|
||||
self.emit(SIGNAL('delete_format()'))
|
||||
else:
|
||||
QListWidget.keyPressEvent(self, event)
|
||||
|
||||
|
||||
class ImageView(QLabel):
|
||||
|
||||
MAX_WIDTH = 400
|
||||
|
Loading…
x
Reference in New Issue
Block a user