~ubuntu-branches/debian/sid/calibre/sid

« back to all changes in this revision

Viewing changes to src/calibre/gui2/email.py

  • Committer: Package Import Robot
  • Author(s): Martin Pitt
  • Date: 2014-02-27 07:48:06 UTC
  • mto: This revision was merged to the branch mainline in revision 74.
  • Revision ID: package-import@ubuntu.com-20140227074806-64wdebb3ptosxhhx
Tags: upstream-1.25.0+dfsg
ImportĀ upstreamĀ versionĀ 1.25.0+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
6
6
__copyright__ = '2010, Kovid Goyal <kovid@kovidgoyal.net>'
7
7
__docformat__ = 'restructuredtext en'
8
8
 
9
 
import os, socket, time
 
9
import os, socket, time, textwrap
10
10
from binascii import unhexlify
11
11
from functools import partial
12
12
from threading import Thread
23
23
from calibre.customize.ui import available_input_formats, available_output_formats
24
24
from calibre.ebooks.metadata import authors_to_string
25
25
from calibre.constants import preferred_encoding
26
 
from calibre.gui2 import config, Dispatcher, warning_dialog, error_dialog
 
26
from calibre.gui2 import config, Dispatcher, warning_dialog, error_dialog, gprefs
27
27
from calibre.library.save_to_disk import get_components
28
28
from calibre.utils.config import tweaks, prefs
29
29
from calibre.utils.icu import sort_key
382
382
                        '\n\n' + t + '\n\t' + _('by') + ' ' + a + '\n\n' +
383
383
                        _('in the %s format.') %
384
384
                        os.path.splitext(f)[1][1:].upper())
 
385
                if mi.comments and gprefs['add_comments_to_email']:
 
386
                    from calibre.utils.html2text import html2text
 
387
                    texts[-1] += '\n\n' + _('About this book:') + '\n\n' + textwrap.fill(html2text(mi.comments))
385
388
                prefix = ascii_filename(t+' - '+a)
386
389
                if not isinstance(prefix, unicode):
387
390
                    prefix = prefix.decode(preferred_encoding, 'replace')