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

« back to all changes in this revision

Viewing changes to src/calibre/gui2/tweak_book/editor/__init__.py

  • Committer: Package Import Robot
  • Author(s): Martin Pitt
  • Date: 2014-05-14 18:17:50 UTC
  • mto: This revision was merged to the branch mainline in revision 75.
  • Revision ID: package-import@ubuntu.com-20140514181750-efj1wymey2vb4cao
Tags: upstream-1.36.0+dfsg
ImportĀ upstreamĀ versionĀ 1.36.0+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
6
6
__license__ = 'GPL v3'
7
7
__copyright__ = '2013, Kovid Goyal <kovid at kovidgoyal.net>'
8
8
 
9
 
from PyQt4.Qt import QTextCharFormat
 
9
from PyQt4.Qt import QTextCharFormat, QFont
10
10
 
11
11
from calibre.ebooks.oeb.base import OEB_DOCS, OEB_STYLES
12
12
from calibre.ebooks.oeb.polish.container import guess_type
16
16
        return 'html'
17
17
    if mime in OEB_STYLES:
18
18
        return 'css'
19
 
    if mime in {guess_type('a.opf'), guess_type('a.ncx'), guess_type('a.xml'), 'application/oebps-page-map+xml'}:
 
19
    if mime in {guess_type('a.svg'), guess_type('a.opf'), guess_type('a.ncx'), guess_type('a.xml'), 'application/oebps-page-map+xml'}:
20
20
        return 'xml'
21
21
    if mime.startswith('text/'):
22
22
        return 'text'
41
41
        QTextCharFormat.__init__(self, *args)
42
42
        self.setProperty(SYNTAX_PROPERTY, True)
43
43
 
 
44
    def __repr__(self):
 
45
        return 'SyntaxFormat(id=%s, color=%s, italic=%s, bold=%s)' % (
 
46
            id(self), self.foreground().color().name(), self.fontItalic(), self.fontWeight() >= QFont.DemiBold)
 
47
    __str__ = __repr__
 
48
 
 
49