mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Implement #3429 ("Cancel All" or similar when editing a large group of books)
This commit is contained in:
parent
5b3dd55e1a
commit
cca1e605dc
@ -252,9 +252,19 @@ class MetadataSingleDialog(ResizableDialog, Ui_MetadataSingleDialog):
|
|||||||
if ext not in extensions:
|
if ext not in extensions:
|
||||||
self.db.remove_format(self.row, ext, notify=False)
|
self.db.remove_format(self.row, ext, notify=False)
|
||||||
|
|
||||||
def __init__(self, window, row, db, accepted_callback=None):
|
def do_cancel_all(self):
|
||||||
|
self.cancel_all = True
|
||||||
|
self.reject()
|
||||||
|
|
||||||
|
def __init__(self, window, row, db, accepted_callback=None, cancel_all=False):
|
||||||
ResizableDialog.__init__(self, window)
|
ResizableDialog.__init__(self, window)
|
||||||
self.bc_box.layout().setAlignment(self.cover, Qt.AlignCenter|Qt.AlignHCenter)
|
self.bc_box.layout().setAlignment(self.cover, Qt.AlignCenter|Qt.AlignHCenter)
|
||||||
|
self.cancel_all = False
|
||||||
|
if cancel_all:
|
||||||
|
self.__abort_button = self.button_box.addButton(self.button_box.Abort)
|
||||||
|
self.__abort_button.setToolTip(_('Abort the editing of all remaining books'))
|
||||||
|
self.connect(self.__abort_button, SIGNAL('clicked()'),
|
||||||
|
self.do_cancel_all)
|
||||||
self.splitter.setStretchFactor(100, 1)
|
self.splitter.setStretchFactor(100, 1)
|
||||||
self.db = db
|
self.db = db
|
||||||
self.pi = ProgressIndicator(self)
|
self.pi = ProgressIndicator(self)
|
||||||
|
@ -1025,10 +1025,13 @@ class Main(MainWindow, Ui_MainWindow, DeviceGUI):
|
|||||||
self._metadata_view_id = self.library_view.model().db.id(row.row())
|
self._metadata_view_id = self.library_view.model().db.id(row.row())
|
||||||
d = MetadataSingleDialog(self, row.row(),
|
d = MetadataSingleDialog(self, row.row(),
|
||||||
self.library_view.model().db,
|
self.library_view.model().db,
|
||||||
accepted_callback=accepted)
|
accepted_callback=accepted,
|
||||||
|
cancel_all=rows.index(row) < len(rows)-1)
|
||||||
self.connect(d, SIGNAL('view_format(PyQt_PyObject)'),
|
self.connect(d, SIGNAL('view_format(PyQt_PyObject)'),
|
||||||
self.metadata_view_format)
|
self.metadata_view_format)
|
||||||
d.exec_()
|
d.exec_()
|
||||||
|
if d.cancel_all:
|
||||||
|
break
|
||||||
if rows:
|
if rows:
|
||||||
current = self.library_view.currentIndex()
|
current = self.library_view.currentIndex()
|
||||||
self.library_view.model().current_changed(current, previous)
|
self.library_view.model().current_changed(current, previous)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user