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
|
return
|
||||||
# Prevent the TagView from updating due to signals from the database
|
# Prevent the TagView from updating due to signals from the database
|
||||||
self.gui.tags_view.blockSignals(True)
|
self.gui.tags_view.blockSignals(True)
|
||||||
|
changed = False
|
||||||
try:
|
try:
|
||||||
changed = MetadataBulkDialog(self.gui, rows,
|
while True:
|
||||||
self.gui.library_view.model()).changed
|
dialog = MetadataBulkDialog(self.gui, rows, self.gui.library_view.model())
|
||||||
|
if dialog.changed:
|
||||||
|
changed = True
|
||||||
|
if not dialog.do_again:
|
||||||
|
break
|
||||||
finally:
|
finally:
|
||||||
self.gui.tags_view.blockSignals(False)
|
self.gui.tags_view.blockSignals(False)
|
||||||
if changed:
|
if changed:
|
||||||
|
@ -6,7 +6,7 @@ __copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net>'
|
|||||||
import re
|
import re
|
||||||
|
|
||||||
from PyQt4.Qt import Qt, QDialog, QGridLayout, QVBoxLayout, QFont, QLabel, \
|
from PyQt4.Qt import Qt, QDialog, QGridLayout, QVBoxLayout, QFont, QLabel, \
|
||||||
pyqtSignal
|
pyqtSignal, QDialogButtonBox
|
||||||
from PyQt4 import QtGui
|
from PyQt4 import QtGui
|
||||||
|
|
||||||
from calibre.gui2.dialogs.metadata_bulk_ui import Ui_MetadataBulkDialog
|
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.create_custom_column_editors()
|
||||||
|
|
||||||
self.prepare_search_and_replace()
|
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_()
|
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):
|
def prepare_search_and_replace(self):
|
||||||
self.search_for.initialize('bulk_edit_search_for')
|
self.search_for.initialize('bulk_edit_search_for')
|
||||||
self.replace_with.initialize('bulk_edit_replace_with')
|
self.replace_with.initialize('bulk_edit_replace_with')
|
||||||
@ -692,7 +703,6 @@ class MetadataBulkDialog(QDialog, Ui_MetadataBulkDialog):
|
|||||||
self.db.clean()
|
self.db.clean()
|
||||||
return QDialog.accept(self)
|
return QDialog.accept(self)
|
||||||
|
|
||||||
|
|
||||||
def series_changed(self, *args):
|
def series_changed(self, *args):
|
||||||
self.write_series = True
|
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>
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="standardButtons">
|
<property name="standardButtons">
|
||||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
<set>QDialogButtonBox::Apply|QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user