mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix #4529 (Support delete key for fomat deletion in metadata window)
This commit is contained in:
commit
63a1434d62
@ -171,7 +171,7 @@ class MetadataSingleDialog(ResizableDialog, Ui_MetadataSingleDialog):
|
|||||||
if self._add_formats(paths):
|
if self._add_formats(paths):
|
||||||
event.accept()
|
event.accept()
|
||||||
|
|
||||||
def remove_format(self, x):
|
def remove_format(self, *args):
|
||||||
rows = self.formats.selectionModel().selectedRows(0)
|
rows = self.formats.selectionModel().selectedRows(0)
|
||||||
for row in rows:
|
for row in rows:
|
||||||
self.formats.takeItem(row.row())
|
self.formats.takeItem(row.row())
|
||||||
@ -327,6 +327,7 @@ class MetadataSingleDialog(ResizableDialog, Ui_MetadataSingleDialog):
|
|||||||
self.deduce_author_sort)
|
self.deduce_author_sort)
|
||||||
self.connect(self.formats, SIGNAL('itemDoubleClicked(QListWidgetItem*)'),
|
self.connect(self.formats, SIGNAL('itemDoubleClicked(QListWidgetItem*)'),
|
||||||
self.show_format)
|
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_cover, SIGNAL('clicked()'), self.set_cover)
|
||||||
self.connect(self.button_set_metadata, SIGNAL('clicked()'),
|
self.connect(self.button_set_metadata, SIGNAL('clicked()'),
|
||||||
self.set_metadata_from_format)
|
self.set_metadata_from_format)
|
||||||
|
@ -137,6 +137,13 @@ class FormatList(QListWidget):
|
|||||||
def dragMoveEvent(self, event):
|
def dragMoveEvent(self, event):
|
||||||
event.acceptProposedAction()
|
event.acceptProposedAction()
|
||||||
|
|
||||||
|
def keyPressEvent(self, event):
|
||||||
|
if event.key() == Qt.Key_Delete:
|
||||||
|
self.emit(SIGNAL('delete_format()'))
|
||||||
|
else:
|
||||||
|
return QListWidget.keyPressEvent(self, event)
|
||||||
|
|
||||||
|
|
||||||
class ImageView(QLabel):
|
class ImageView(QLabel):
|
||||||
|
|
||||||
MAX_WIDTH = 400
|
MAX_WIDTH = 400
|
||||||
|
Loading…
x
Reference in New Issue
Block a user