def polish(self, action, name): self.commit_all_editors_to_container() with BusyCursor(): self.add_savepoint(name) try: report = tweak_polish(current_container(), {action: True}) except: self.rewind_savepoint() raise self.apply_container_update_to_gui() from calibre.ebooks.markdown import markdown report = markdown('# %s\n\n' % self.current_metadata.title + '\n\n'.join(report), output_format='html4') d = QDialog(self.gui) d.l = QVBoxLayout() d.setLayout(d.l) d.e = QTextBrowser(d) d.l.addWidget(d.e) d.e.setHtml(report) d.bb = QDialogButtonBox(QDialogButtonBox.Close) d.l.addWidget(d.bb) d.bb.rejected.connect(d.reject) d.bb.accepted.connect(d.accept) d.resize(600, 400) d.exec_()
def polish(self, action, name): self.commit_all_editors_to_container() with BusyCursor(): self.add_savepoint(name) try: report = tweak_polish(current_container(), {action: True}) except: self.rewind_savepoint() raise self.apply_container_update_to_gui() from calibre.ebooks.markdown import markdown report = markdown("# %s\n\n" % self.current_metadata.title + "\n\n".join(report), output_format="html4") d = QDialog(self.gui) d.l = QVBoxLayout() d.setLayout(d.l) d.e = QTextBrowser(d) d.l.addWidget(d.e) d.e.setHtml(report) d.bb = QDialogButtonBox(QDialogButtonBox.Close) d.l.addWidget(d.bb) d.bb.rejected.connect(d.reject) d.bb.accepted.connect(d.accept) d.resize(600, 400) d.exec_()
def show_report(changed, title, report, parent, show_current_diff): report = format_report(title, report) d = QDialog(parent) d.l = QVBoxLayout() d.setLayout(d.l) d.e = QTextBrowser(d) d.l.addWidget(d.e) d.e.setHtml(report) d.bb = QDialogButtonBox(QDialogButtonBox.Close) if changed: b = d.b = d.bb.addButton(_('See what &changed'), d.bb.AcceptRole) b.setIcon(QIcon(I('diff.png'))), b.setAutoDefault(False) b.clicked.connect(partial(show_current_diff, allow_revert=True)) d.bb.button(d.bb.Close).setDefault(True) d.l.addWidget(d.bb) d.bb.rejected.connect(d.reject) d.bb.accepted.connect(d.accept) d.resize(600, 400) d.exec_()
def polish(self, action, name): if not self.check_dirtied(): return self.add_savepoint(name) try: report = tweak_polish(current_container(), {action:True}) except: self.rewind_savepoint() raise self.apply_container_update_to_gui() from calibre.ebooks.markdown import markdown report = markdown('# %s\n\n'%self.current_metadata.title + '\n\n'.join(report), output_format='html4') d = QDialog(self.gui) d.l = QVBoxLayout() d.setLayout(d.l) d.e = QTextBrowser(d) d.l.addWidget(d.e) d.e.setHtml(report) d.bb = QDialogButtonBox(QDialogButtonBox.Close) d.l.addWidget(d.bb) d.bb.rejected.connect(d.reject) d.bb.accepted.connect(d.accept) d.resize(600, 400) d.exec_()