mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix transform running on incorrect container object
This commit is contained in:
parent
c75a9f718e
commit
b50834b23d
@ -643,24 +643,24 @@ class Boss(QObject):
|
|||||||
if ret != QDialog.DialogCode.Accepted:
|
if ret != QDialog.DialogCode.Accepted:
|
||||||
return
|
return
|
||||||
|
|
||||||
cc = current_container()
|
mime_map = current_container().mime_map
|
||||||
names = ()
|
names = ()
|
||||||
if scope == 'current':
|
if scope == 'current':
|
||||||
if not self.currently_editing or cc.mime_map.get(self.currently_editing) not in OEB_DOCS:
|
if not self.currently_editing or mime_map.get(self.currently_editing) not in OEB_DOCS:
|
||||||
return error_dialog(self.gui, _('No HTML file'), _('Not currently editing an HTML file'), show=True)
|
return error_dialog(self.gui, _('No HTML file'), _('Not currently editing an HTML file'), show=True)
|
||||||
names = (self.currently_editing,)
|
names = (self.currently_editing,)
|
||||||
elif scope == 'open':
|
elif scope == 'open':
|
||||||
names = tuple(name for name in editors if cc.mime_map.get(name) in OEB_DOCS)
|
names = tuple(name for name in editors if mime_map.get(name) in OEB_DOCS)
|
||||||
if not names:
|
if not names:
|
||||||
return error_dialog(self.gui, _('No HTML files'), _('Not currently editing any HTML files'), show=True)
|
return error_dialog(self.gui, _('No HTML files'), _('Not currently editing any HTML files'), show=True)
|
||||||
elif scope == 'selected':
|
elif scope == 'selected':
|
||||||
names = tuple(name for name in self.gui.file_list.file_list.selected_names if cc.mime_map.get(name) in OEB_DOCS)
|
names = tuple(name for name in self.gui.file_list.file_list.selected_names if mime_map.get(name) in OEB_DOCS)
|
||||||
if not names:
|
if not names:
|
||||||
return error_dialog(self.gui, _('No HTML files'), _('No HTML files are currently selected in the File browser'), show=True)
|
return error_dialog(self.gui, _('No HTML files'), _('No HTML files are currently selected in the File browser'), show=True)
|
||||||
with BusyCursor():
|
with BusyCursor():
|
||||||
self.add_savepoint(_('Before HTML transformation'))
|
self.add_savepoint(_('Before HTML transformation'))
|
||||||
try:
|
try:
|
||||||
changed = transform_container(cc, last_used_html_transform_rules, names)
|
changed = transform_container(current_container(), last_used_html_transform_rules, names)
|
||||||
except:
|
except:
|
||||||
self.rewind_savepoint()
|
self.rewind_savepoint()
|
||||||
raise
|
raise
|
||||||
@ -668,9 +668,7 @@ class Boss(QObject):
|
|||||||
self.apply_container_update_to_gui()
|
self.apply_container_update_to_gui()
|
||||||
if not changed:
|
if not changed:
|
||||||
self.rewind_savepoint()
|
self.rewind_savepoint()
|
||||||
info_dialog(self.gui, _('No changes'), _(
|
return info_dialog(self.gui, _('No changes'), _('No HTML was changed.'), show=True)
|
||||||
'No HTML was changed.'), show=True)
|
|
||||||
return
|
|
||||||
self.show_current_diff()
|
self.show_current_diff()
|
||||||
|
|
||||||
def transform_styles(self):
|
def transform_styles(self):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user