mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Edit book: Show a popup after a fix all html/beautify all files so the user can easily see what was changed, if needed.
See #1785482 ([enhancement] editor, Fix HTML all file verbose)
This commit is contained in:
parent
1837438d85
commit
ef14d73112
@ -12,7 +12,7 @@ from urlparse import urlparse
|
|||||||
|
|
||||||
from PyQt5.Qt import (
|
from PyQt5.Qt import (
|
||||||
QObject, QApplication, QDialog, QGridLayout, QLabel, QSize, Qt,
|
QObject, QApplication, QDialog, QGridLayout, QLabel, QSize, Qt,
|
||||||
QDialogButtonBox, QIcon, QInputDialog, QUrl, pyqtSignal)
|
QDialogButtonBox, QIcon, QInputDialog, QUrl, pyqtSignal, QVBoxLayout)
|
||||||
|
|
||||||
from calibre import prints, isbytestring
|
from calibre import prints, isbytestring
|
||||||
from calibre.constants import cache_dir, iswindows
|
from calibre.constants import cache_dir, iswindows
|
||||||
@ -774,6 +774,21 @@ class Boss(QObject):
|
|||||||
d.container_diff(other, self.global_undo.current_container,
|
d.container_diff(other, self.global_undo.current_container,
|
||||||
names=(self.global_undo.label_for_container(other), self.global_undo.label_for_container(self.global_undo.current_container)))
|
names=(self.global_undo.label_for_container(other), self.global_undo.label_for_container(self.global_undo.current_container)))
|
||||||
|
|
||||||
|
def ask_to_show_current_diff(self, title, msg, allow_revert=True, to_container=None):
|
||||||
|
d = QDialog(self.gui)
|
||||||
|
k = QVBoxLayout(d)
|
||||||
|
d.setWindowTitle(title)
|
||||||
|
k.addWidget(QLabel(msg))
|
||||||
|
d.bb = bb = QDialogButtonBox(QDialogButtonBox.Close, d)
|
||||||
|
k.addWidget(bb)
|
||||||
|
bb.accepted.connect(d.accept)
|
||||||
|
bb.rejected.connect(d.reject)
|
||||||
|
d.b = b = bb.addButton(_('See what &changed'), bb.AcceptRole)
|
||||||
|
b.setIcon(QIcon(I('diff.png'))), b.setAutoDefault(False)
|
||||||
|
bb.button(bb.Close).setDefault(True)
|
||||||
|
if d.exec_() == d.Accepted:
|
||||||
|
self.show_current_diff(allow_revert=allow_revert, to_container=to_container)
|
||||||
|
|
||||||
def compare_book(self):
|
def compare_book(self):
|
||||||
self.commit_all_editors_to_container()
|
self.commit_all_editors_to_container()
|
||||||
c = current_container()
|
c = current_container()
|
||||||
@ -827,6 +842,7 @@ class Boss(QObject):
|
|||||||
fix_all_html(current_container())
|
fix_all_html(current_container())
|
||||||
self.update_editors_from_container()
|
self.update_editors_from_container()
|
||||||
self.set_modified()
|
self.set_modified()
|
||||||
|
self.ask_to_show_current_diff(_('Fixing done'), _('All HTML files fixed'))
|
||||||
|
|
||||||
def pretty_print(self, current):
|
def pretty_print(self, current):
|
||||||
if current:
|
if current:
|
||||||
@ -839,6 +855,7 @@ class Boss(QObject):
|
|||||||
self.update_editors_from_container()
|
self.update_editors_from_container()
|
||||||
self.set_modified()
|
self.set_modified()
|
||||||
QApplication.alert(self.gui)
|
QApplication.alert(self.gui)
|
||||||
|
self.ask_to_show_current_diff(_('Beautified'), _('All files beautified'))
|
||||||
|
|
||||||
def mark_selected_text(self):
|
def mark_selected_text(self):
|
||||||
ed = self.gui.central.current_editor
|
ed = self.gui.central.current_editor
|
||||||
|
Loading…
x
Reference in New Issue
Block a user