Exemple #1
0
 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_()
Exemple #2
0
    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_()
Exemple #3
0
 def show_report(self, book_title, book_id, fmts, job, report):
     from calibre.ebooks.markdown import markdown
     self.current_log = job.details
     self.setWindowTitle(_('Polishing of %s')%book_title)
     self.view.setText(markdown('# %s\n\n'%book_title + report,
                                output_format='html4'))
     self.bb.button(self.bb.Close).setFocus(Qt.OtherFocusReason)
     self.backup_msg.setVisible(bool(fmts))
     if fmts:
         m = ngettext('The original file has been saved as %s.',
                  'The original files have been saved as %s.', len(fmts))%(
             _(' and ').join('ORIGINAL_'+f for f in fmts)
                  )
         self.backup_msg.setText(m + ' ' + _(
             'If you polish again, the polishing will run on the originals.')%(
             ))
Exemple #4
0
 def show_report(self, book_title, book_id, fmts, job, report):
     from calibre.ebooks.markdown import markdown
     self.current_log = job.details
     self.setWindowTitle(_('Polishing of %s')%book_title)
     self.view.setText(markdown('# %s\n\n'%book_title + report,
                                output_format='html4'))
     self.bb.button(self.bb.Close).setFocus(Qt.OtherFocusReason)
     self.backup_msg.setVisible(bool(fmts))
     if fmts:
         m = ngettext('The original file has been saved as %s.',
                  'The original files have been saved as %s.', len(fmts))%(
             _(' and ').join('ORIGINAL_'+f for f in fmts)
                  )
         self.backup_msg.setText(m + ' ' + _(
             'If you polish again, the polishing will run on the originals.')%(
             ))
Exemple #5
0
 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_()
Exemple #6
0
def format_report(title, report):
    from calibre.ebooks.markdown import markdown
    report = [force_unicode(line) for line in report]
    return markdown('# %s\n\n'%force_unicode(title) + '\n\n'.join(report), output_format='html4')
Exemple #7
0
def format_report(title, report):
    from calibre.ebooks.markdown import markdown
    report = [force_unicode(line) for line in report]
    return markdown('# %s\n\n'%force_unicode(title) + '\n\n'.join(report), output_format='html4')
Exemple #8
0
def format_report(title, report):
    from calibre.ebooks.markdown import markdown
    return markdown('# %s\n\n'%title + '\n\n'.join(report), output_format='html4')
Exemple #9
0
def format_report(title, report):
    from calibre.ebooks.markdown import markdown
    return markdown('# %s\n\n' % title + '\n\n'.join(report),
                    output_format='html4')