mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix #7732 (Multiple Search and Replace without closing Dialog)
This commit is contained in:
commit
5a4968e9df
@ -162,9 +162,14 @@ class EditMetadataAction(InterfaceAction):
|
||||
return
|
||||
# Prevent the TagView from updating due to signals from the database
|
||||
self.gui.tags_view.blockSignals(True)
|
||||
changed = False
|
||||
try:
|
||||
changed = MetadataBulkDialog(self.gui, rows,
|
||||
self.gui.library_view.model()).changed
|
||||
while True:
|
||||
dialog = MetadataBulkDialog(self.gui, rows, self.gui.library_view.model())
|
||||
if dialog.changed:
|
||||
changed = True
|
||||
if not dialog.do_again:
|
||||
break
|
||||
finally:
|
||||
self.gui.tags_view.blockSignals(False)
|
||||
if changed:
|
||||
|
@ -6,7 +6,7 @@ __copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net>'
|
||||
import re
|
||||
|
||||
from PyQt4.Qt import Qt, QDialog, QGridLayout, QVBoxLayout, QFont, QLabel, \
|
||||
pyqtSignal
|
||||
pyqtSignal, QDialogButtonBox
|
||||
from PyQt4 import QtGui
|
||||
|
||||
from calibre.gui2.dialogs.metadata_bulk_ui import Ui_MetadataBulkDialog
|
||||
@ -232,8 +232,19 @@ class MetadataBulkDialog(QDialog, Ui_MetadataBulkDialog):
|
||||
self.create_custom_column_editors()
|
||||
|
||||
self.prepare_search_and_replace()
|
||||
|
||||
self.button_box.clicked.connect(self.button_clicked)
|
||||
self.button_box.button(QDialogButtonBox.Apply).setToolTip(_(
|
||||
'Immediately make all changes without closing the dialog. '
|
||||
'This operation cannot be canceled or undone'))
|
||||
self.do_again = False
|
||||
self.exec_()
|
||||
|
||||
def button_clicked(self, which):
|
||||
if which == self.button_box.button(QDialogButtonBox.Apply):
|
||||
self.do_again = True
|
||||
self.accept()
|
||||
|
||||
def prepare_search_and_replace(self):
|
||||
self.search_for.initialize('bulk_edit_search_for')
|
||||
self.replace_with.initialize('bulk_edit_replace_with')
|
||||
@ -692,7 +703,6 @@ class MetadataBulkDialog(QDialog, Ui_MetadataBulkDialog):
|
||||
self.db.clean()
|
||||
return QDialog.accept(self)
|
||||
|
||||
|
||||
def series_changed(self, *args):
|
||||
self.write_series = True
|
||||
|
||||
|
@ -710,7 +710,7 @@ nothing should be put between the original text and the inserted text</string>
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
<set>QDialogButtonBox::Apply|QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
Loading…
x
Reference in New Issue
Block a user