Edit book: Fix regression in previous release causing applying any container update marking all open image editors as modified.

No choice but to implement only_if_different and hope that it is
accurate.
This commit is contained in:
Kovid Goyal 2022-11-07 15:28:14 +05:30
parent 9e008a62bc
commit 6ff213ff0c
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 4 additions and 4 deletions

View File

@ -293,7 +293,9 @@ class Canvas(QWidget):
self.redo_action = a = self.undo_stack.createRedoAction(self, _('Redo') + ' ')
a.setIcon(QIcon.ic('edit-redo.png'))
def load_image(self, data):
def load_image(self, data, only_if_different=False):
if only_if_different and self.original_image_data and not self.is_modified and self.original_image_data == data:
return
self.is_valid = False
try:
fmt = identify(data)[0].encode('ascii')

View File

@ -163,9 +163,7 @@ class Editor(QMainWindow):
self._is_modified = False # The image_changed signal will have been triggered causing this editor to be incorrectly marked as modified
def replace_data(self, raw, only_if_different=True):
# We ignore only_if_different as it is useless in our case, and
# there is no easy way to check two images for equality
self.canvas.load_image(raw)
self.canvas.load_image(raw, only_if_different=only_if_different)
def apply_settings(self, prefs=None, dictionaries_changed=False):
pass