diff --git a/src/calibre/gui2/__init__.py b/src/calibre/gui2/__init__.py index ef6f37da8c..ebe877f823 100644 --- a/src/calibre/gui2/__init__.py +++ b/src/calibre/gui2/__init__.py @@ -100,27 +100,31 @@ def available_width(): def extension(path): return os.path.splitext(path)[1][1:].lower() -def warning_dialog(parent, title, msg): +def warning_dialog(parent, title, msg, det_msg=''): d = QMessageBox(QMessageBox.Warning, 'WARNING: '+title, msg, QMessageBox.Ok, parent) + d.setDetailedText(det_msg) d.setIconPixmap(QPixmap(':/images/dialog_warning.svg')) return d -def error_dialog(parent, title, msg): +def error_dialog(parent, title, msg, det_msg=''): d = QMessageBox(QMessageBox.Critical, 'ERROR: '+title, msg, QMessageBox.Ok, parent) + d.setDetailedText(det_msg) d.setIconPixmap(QPixmap(':/images/dialog_error.svg')) return d -def question_dialog(parent, title, msg): +def question_dialog(parent, title, msg, det_msg=''): d = QMessageBox(QMessageBox.Question, title, msg, QMessageBox.Yes|QMessageBox.No, parent) + d.setDetailedText(det_msg) d.setIconPixmap(QPixmap(':/images/dialog_information.svg')) return d -def info_dialog(parent, title, msg): +def info_dialog(parent, title, msg, det_msg=''): d = QMessageBox(QMessageBox.Information, title, msg, QMessageBox.NoButton, parent) + d.setDetailedText(det_msg) d.setIconPixmap(QPixmap(':/images/dialog_information.svg')) return d diff --git a/src/calibre/gui2/device.py b/src/calibre/gui2/device.py index 3541d8105f..1a79631e8a 100644 --- a/src/calibre/gui2/device.py +++ b/src/calibre/gui2/device.py @@ -507,10 +507,10 @@ class DeviceGUI(object): self.status_bar.showMessage(_('Sending email to')+' '+to, 3000) if bad: - bad = '\n'.join('
  • %s
  • '%(i,) for i in bad) + bad = '\n'.join('%s'%(i,) for i in bad) d = warning_dialog(self, _('No suitable formats'), - '

    '+ _('Could not email the following books ' - 'as no suitable formats were found:

    ')%(bad,)) + _('Could not email the following books ' + 'as no suitable formats were found:'), bad) d.exec_() def emails_sent(self, results, remove=[]): @@ -694,12 +694,12 @@ class DeviceGUI(object): self.auto_convert(_auto_ids, on_card, format) if bad: - bad = '\n'.join('
  • %s
  • '%(i,) for i in bad) + bad = '\n'.join('%s'%(i,) for i in bad) d = warning_dialog(self, _('No suitable formats'), _('Could not upload the following books to the device, ' 'as no suitable formats were found. Try changing the output ' 'format in the upper right corner next to the red heart and ' - 're-converting.
    ')%(bad,)) + 're-converting.'), bad) d.exec_() def upload_booklists(self): diff --git a/src/calibre/gui2/main.py b/src/calibre/gui2/main.py index 1d0281ead7..ce8cb418ba 100644 --- a/src/calibre/gui2/main.py +++ b/src/calibre/gui2/main.py @@ -445,14 +445,8 @@ class Main(MainWindow, Ui_MainWindow, DeviceGUI): def change_output_format(self, x): of = unicode(x).strip() if of != prefs['output_format']: - if of not in ('LRF', 'EPUB', 'MOBI'): - warning_dialog(self, 'Warning', - ('

    %s support is still in beta. If you find bugs, ' - 'please report them by opening a ticket.')%of).exec_() prefs.set('output_format', of) - def test_server(self, *args): if self.content_server.exception is not None: error_dialog(self, _('Failed to start content server'), @@ -916,14 +910,14 @@ class Main(MainWindow, Ui_MainWindow, DeviceGUI): callback=callback, single_format=single_format) if failures and single_format is not None: - msg = _('

    Could not save the following books to disk, ' - 'because the %s format is not available for them:

    ' + det_msg += '%s\n'%f[1] warning_dialog(self, _('Could not save some ebooks'), - msg).exec_() + msg, det_msg).exec_() QDesktopServices.openUrl(QUrl('file:'+dir)) else: paths = self.current_view().model().paths(rows) diff --git a/src/calibre/gui2/tools.py b/src/calibre/gui2/tools.py index 230ab9d5f6..8e19519ecc 100644 --- a/src/calibre/gui2/tools.py +++ b/src/calibre/gui2/tools.py @@ -12,6 +12,7 @@ import cPickle, os from PyQt4.Qt import QDialog from calibre.ptempfile import PersistentTemporaryFile +from calibre.gui2 import warning_dialog from calibre.gui2.convert import load_specifics from calibre.gui2.convert.single import NoSupportedInputFormats from calibre.gui2.convert.single import Config as SingleConfig @@ -60,10 +61,12 @@ def convert_single_ebook(parent, db, book_ids, auto_conversion=False, out_format res = [] for id in bad: title = db.title(id, True) - res.append('
  • %s
  • '%title) + res.append('%s'%title) - msg = _('

    Could not convert %d of %d books, because no suitable source format was found.

    ')%(len(res), total, '\n'.join(res)) - warning_dialog(parent, _('Could not convert some books'), msg).exec_() + msg = '%s' % '\n'.join(res) + warning_dialog(parent, _('Could not convert some books'), + _('Could not convert %d of %d books, because no suitable source format was found.' % (len(res), total)), + msg).exec_() return jobs, changed, bad