mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Pull from trunk
This commit is contained in:
commit
6f741dd217
@ -451,7 +451,7 @@ from calibre.devices.iriver.driver import IRIVER_STORY
|
|||||||
from calibre.devices.binatone.driver import README
|
from calibre.devices.binatone.driver import README
|
||||||
from calibre.devices.hanvon.driver import N516, EB511, ALEX, AZBOOKA
|
from calibre.devices.hanvon.driver import N516, EB511, ALEX, AZBOOKA
|
||||||
from calibre.devices.edge.driver import EDGE
|
from calibre.devices.edge.driver import EDGE
|
||||||
from calibre.devices.teclast.driver import TECLAST_K3
|
from calibre.devices.teclast.driver import TECLAST_K3, NEWSMY
|
||||||
from calibre.devices.sne.driver import SNE
|
from calibre.devices.sne.driver import SNE
|
||||||
from calibre.devices.misc import PALMPRE, KOBO, AVANT
|
from calibre.devices.misc import PALMPRE, KOBO, AVANT
|
||||||
from calibre.devices.folder_device.driver import FOLDER_DEVICE_FOR_CONFIG
|
from calibre.devices.folder_device.driver import FOLDER_DEVICE_FOR_CONFIG
|
||||||
@ -531,6 +531,7 @@ plugins += [
|
|||||||
EB511,
|
EB511,
|
||||||
ELONEX,
|
ELONEX,
|
||||||
TECLAST_K3,
|
TECLAST_K3,
|
||||||
|
NEWSMY,
|
||||||
EDGE,
|
EDGE,
|
||||||
SNE,
|
SNE,
|
||||||
ALEX,
|
ALEX,
|
||||||
|
@ -24,6 +24,9 @@ class ANDROID(USBMS):
|
|||||||
# Motorola
|
# Motorola
|
||||||
0x22b8 : { 0x41d9 : [0x216], 0x2d67 : [0x100], 0x41db : [0x216]},
|
0x22b8 : { 0x41d9 : [0x216], 0x2d67 : [0x100], 0x41db : [0x216]},
|
||||||
|
|
||||||
|
# Sony Ericsson
|
||||||
|
0xfce : { 0xd12e : [0x0100]},
|
||||||
|
|
||||||
0x18d1 : { 0x4e11 : [0x0100, 0x226], 0x4e12: [0x0100, 0x226]},
|
0x18d1 : { 0x4e11 : [0x0100, 0x226], 0x4e12: [0x0100, 0x226]},
|
||||||
|
|
||||||
# Samsung
|
# Samsung
|
||||||
|
@ -39,4 +39,17 @@ class TECLAST_K3(USBMS):
|
|||||||
|
|
||||||
return drives
|
return drives
|
||||||
|
|
||||||
|
class NEWSMY(TECLAST_K3):
|
||||||
|
name = 'Newsmy device interface'
|
||||||
|
gui_name = 'Newsmy'
|
||||||
|
description = _('Communicate with the Newsmy reader.')
|
||||||
|
|
||||||
|
FORMATS = ['epub', 'fb2', 'pdb', 'html', 'pdf', 'txt', 'skt']
|
||||||
|
|
||||||
|
VENDOR_NAME = ''
|
||||||
|
WINDOWS_MAIN_MEM = 'NEWSMY'
|
||||||
|
WINDOWS_CARD_A_MEM = 'USBDISK____SD'
|
||||||
|
|
||||||
|
def windows_sort_drives(self, drives):
|
||||||
|
return drives
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ def detect(aBuf):
|
|||||||
ENCODING_PATS = [
|
ENCODING_PATS = [
|
||||||
re.compile(r'<\?[^<>]+encoding=[\'"](.*?)[\'"][^<>]*>',
|
re.compile(r'<\?[^<>]+encoding=[\'"](.*?)[\'"][^<>]*>',
|
||||||
re.IGNORECASE),
|
re.IGNORECASE),
|
||||||
re.compile(r'<meta.*?content=[\'"].*?charset=([^\s\'"]+).*?[\'"].*?>',
|
re.compile(r'''<meta\s+?[^<>]+?content=['"][^'"]*?charset=([-a-z0-9]+)[^'"]*?['"][^<>]*>''',
|
||||||
re.IGNORECASE)
|
re.IGNORECASE)
|
||||||
]
|
]
|
||||||
ENTITY_PATTERN = re.compile(r'&(\S+?);')
|
ENTITY_PATTERN = re.compile(r'&(\S+?);')
|
||||||
|
@ -411,6 +411,18 @@ OptionRecommendation(name='asciiize',
|
|||||||
)
|
)
|
||||||
),
|
),
|
||||||
|
|
||||||
|
OptionRecommendation(name='keep_ligatures',
|
||||||
|
recommended_value=False, level=OptionRecommendation.LOW,
|
||||||
|
help=_('Preserve ligatures present in the input document. '
|
||||||
|
'A ligature is a special rendering of a pair of '
|
||||||
|
'characters like ff, fi, fl et cetera. '
|
||||||
|
'Most readers do not have support for '
|
||||||
|
'ligatures in their default fonts, so they are '
|
||||||
|
'unlikely to render correctly. By default, calibre '
|
||||||
|
'will turn a ligature into the corresponding pair of normal '
|
||||||
|
'characters. This option will preserve them instead.')
|
||||||
|
),
|
||||||
|
|
||||||
OptionRecommendation(name='title',
|
OptionRecommendation(name='title',
|
||||||
recommended_value=None, level=OptionRecommendation.LOW,
|
recommended_value=None, level=OptionRecommendation.LOW,
|
||||||
help=_('Set the title.')),
|
help=_('Set the title.')),
|
||||||
|
@ -18,6 +18,24 @@ convert_entities = functools.partial(entity_to_unicode, exceptions=['quot',
|
|||||||
'apos', 'lt', 'gt', 'amp', '#60', '#62'])
|
'apos', 'lt', 'gt', 'amp', '#60', '#62'])
|
||||||
_span_pat = re.compile('<span.*?</span>', re.DOTALL|re.IGNORECASE)
|
_span_pat = re.compile('<span.*?</span>', re.DOTALL|re.IGNORECASE)
|
||||||
|
|
||||||
|
LIGATURES = {
|
||||||
|
u'\u00c6': u'AE',
|
||||||
|
u'\u00e6': u'ae',
|
||||||
|
u'\u0152': u'OE',
|
||||||
|
u'\u0153': u'oe',
|
||||||
|
u'\u0132': u'IJ',
|
||||||
|
u'\u0133': u'ij',
|
||||||
|
u'\u1D6B': u'ue',
|
||||||
|
u'\uFB00': u'ff',
|
||||||
|
u'\uFB01': u'fi',
|
||||||
|
u'\uFB02': u'fl',
|
||||||
|
u'\uFB03': u'ffi',
|
||||||
|
u'\uFB04': u'ffl',
|
||||||
|
u'\uFB05': u'ft',
|
||||||
|
u'\uFB06': u'st',
|
||||||
|
}
|
||||||
|
|
||||||
|
_ligpat = re.compile(u'|'.join(LIGATURES))
|
||||||
|
|
||||||
def sanitize_head(match):
|
def sanitize_head(match):
|
||||||
x = match.group(1)
|
x = match.group(1)
|
||||||
@ -228,6 +246,9 @@ class HTMLPreProcessor(object):
|
|||||||
else:
|
else:
|
||||||
rules = []
|
rules = []
|
||||||
|
|
||||||
|
if not self.extra_opts.keep_ligatures:
|
||||||
|
html = _ligpat.sub(lambda m:LIGATURES[m.group()], html)
|
||||||
|
|
||||||
end_rules = []
|
end_rules = []
|
||||||
if getattr(self.extra_opts, 'remove_header', None):
|
if getattr(self.extra_opts, 'remove_header', None):
|
||||||
try:
|
try:
|
||||||
|
@ -164,7 +164,10 @@ class CSSFlattener(object):
|
|||||||
body = html.find(XHTML('body'))
|
body = html.find(XHTML('body'))
|
||||||
fsize = self.context.source.fbase
|
fsize = self.context.source.fbase
|
||||||
self.baseline_node(body, stylizer, sizes, fsize)
|
self.baseline_node(body, stylizer, sizes, fsize)
|
||||||
sbase = max(sizes.items(), key=operator.itemgetter(1))[0]
|
try:
|
||||||
|
sbase = max(sizes.items(), key=operator.itemgetter(1))[0]
|
||||||
|
except:
|
||||||
|
sbase = 12.0
|
||||||
self.oeb.logger.info(
|
self.oeb.logger.info(
|
||||||
"Source base font size is %0.05fpt" % sbase)
|
"Source base font size is %0.05fpt" % sbase)
|
||||||
return sbase
|
return sbase
|
||||||
|
@ -6,7 +6,7 @@ __license__ = 'GPL v3'
|
|||||||
__copyright__ = '2009, Kovid Goyal <kovid@kovidgoyal.net>'
|
__copyright__ = '2009, Kovid Goyal <kovid@kovidgoyal.net>'
|
||||||
__docformat__ = 'restructuredtext en'
|
__docformat__ = 'restructuredtext en'
|
||||||
|
|
||||||
from PyQt4.Qt import SIGNAL
|
from PyQt4.Qt import SIGNAL, QVariant
|
||||||
|
|
||||||
from calibre.gui2.convert.look_and_feel_ui import Ui_Form
|
from calibre.gui2.convert.look_and_feel_ui import Ui_Form
|
||||||
from calibre.gui2.convert import Widget
|
from calibre.gui2.convert import Widget
|
||||||
@ -24,8 +24,14 @@ class LookAndFeelWidget(Widget, Ui_Form):
|
|||||||
'linearize_tables',
|
'linearize_tables',
|
||||||
'disable_font_rescaling', 'insert_blank_line',
|
'disable_font_rescaling', 'insert_blank_line',
|
||||||
'remove_paragraph_spacing', 'remove_paragraph_spacing_indent_size','input_encoding',
|
'remove_paragraph_spacing', 'remove_paragraph_spacing_indent_size','input_encoding',
|
||||||
'asciiize']
|
'asciiize', 'keep_ligatures']
|
||||||
)
|
)
|
||||||
|
for val, text in [
|
||||||
|
('original', _('Original')),
|
||||||
|
('left', _('Left align')),
|
||||||
|
('justify', _('Justify text'))
|
||||||
|
]:
|
||||||
|
self.opt_change_justification.addItem(text, QVariant(val))
|
||||||
self.db, self.book_id = db, book_id
|
self.db, self.book_id = db, book_id
|
||||||
self.initialize_options(get_option, get_help, db, book_id)
|
self.initialize_options(get_option, get_help, db, book_id)
|
||||||
self.opt_disable_font_rescaling.toggle()
|
self.opt_disable_font_rescaling.toggle()
|
||||||
@ -35,6 +41,21 @@ class LookAndFeelWidget(Widget, Ui_Form):
|
|||||||
self.opt_remove_paragraph_spacing.toggle()
|
self.opt_remove_paragraph_spacing.toggle()
|
||||||
self.opt_remove_paragraph_spacing.toggle()
|
self.opt_remove_paragraph_spacing.toggle()
|
||||||
|
|
||||||
|
def get_value_handler(self, g):
|
||||||
|
if g is self.opt_change_justification:
|
||||||
|
ans = unicode(g.itemData(g.currentIndex()).toString())
|
||||||
|
return ans
|
||||||
|
return Widget.get_value_handler(self, g)
|
||||||
|
|
||||||
|
def set_value_handler(self, g, val):
|
||||||
|
if g is self.opt_change_justification:
|
||||||
|
for i in range(g.count()):
|
||||||
|
c = unicode(g.itemData(i).toString())
|
||||||
|
if val == c:
|
||||||
|
g.setCurrentIndex(i)
|
||||||
|
break
|
||||||
|
return True
|
||||||
|
|
||||||
def font_key_wizard(self):
|
def font_key_wizard(self):
|
||||||
from calibre.gui2.convert.font_key import FontKeyChooser
|
from calibre.gui2.convert.font_key import FontKeyChooser
|
||||||
d = FontKeyChooser(self, self.opt_base_font_size.value(),
|
d = FontKeyChooser(self, self.opt_base_font_size.value(),
|
||||||
|
@ -31,7 +31,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="2">
|
<item row="1" column="1" colspan="2">
|
||||||
<widget class="QDoubleSpinBox" name="opt_base_font_size">
|
<widget class="QDoubleSpinBox" name="opt_base_font_size">
|
||||||
<property name="suffix">
|
<property name="suffix">
|
||||||
<string> pt</string>
|
<string> pt</string>
|
||||||
@ -63,7 +63,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="1" colspan="2">
|
<item row="2" column="1" colspan="3">
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLineEdit" name="opt_font_size_mapping">
|
<widget class="QLineEdit" name="opt_font_size_mapping">
|
||||||
@ -84,7 +84,7 @@
|
|||||||
<string>...</string>
|
<string>...</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset>
|
<iconset resource="../../../../resources/images.qrc">
|
||||||
<normaloff>:/images/wizard.svg</normaloff>:/images/wizard.svg</iconset>
|
<normaloff>:/images/wizard.svg</normaloff>:/images/wizard.svg</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="iconSize">
|
<property name="iconSize">
|
||||||
@ -107,7 +107,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="2">
|
<item row="3" column="1" colspan="2">
|
||||||
<widget class="QDoubleSpinBox" name="opt_line_height">
|
<widget class="QDoubleSpinBox" name="opt_line_height">
|
||||||
<property name="suffix">
|
<property name="suffix">
|
||||||
<string> pt</string>
|
<string> pt</string>
|
||||||
@ -127,60 +127,50 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="4" column="1" colspan="2">
|
<item row="4" column="1" colspan="3">
|
||||||
<widget class="QLineEdit" name="opt_input_encoding"/>
|
<widget class="QLineEdit" name="opt_input_encoding"/>
|
||||||
</item>
|
</item>
|
||||||
<item row="5" column="0" colspan="3">
|
<item row="5" column="0" colspan="2">
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
<widget class="QCheckBox" name="opt_remove_paragraph_spacing">
|
||||||
|
<property name="text">
|
||||||
|
<string>Remove &spacing between paragraphs</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="5" column="2" colspan="2">
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QCheckBox" name="opt_remove_paragraph_spacing">
|
<widget class="QLabel" name="label_4">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Remove &spacing between paragraphs</string>
|
<string>Indent size:</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<spacer name="horizontalSpacer">
|
<widget class="QDoubleSpinBox" name="opt_remove_paragraph_spacing_indent_size">
|
||||||
<property name="orientation">
|
<property name="toolTip">
|
||||||
<enum>Qt::Horizontal</enum>
|
<string><p>When calibre removes inter paragraph spacing, it automatically sets a paragraph indent, to ensure that paragraphs can be easily distinguished. This option controls the width of that indent.</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeHint" stdset="0">
|
<property name="suffix">
|
||||||
<size>
|
<string> em</string>
|
||||||
<width>40</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
</property>
|
||||||
</spacer>
|
<property name="decimals">
|
||||||
</item>
|
<number>1</number>
|
||||||
<item>
|
</property>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
</widget>
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label_4">
|
|
||||||
<property name="text">
|
|
||||||
<string>Indent size:</string>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QDoubleSpinBox" name="opt_remove_paragraph_spacing_indent_size">
|
|
||||||
<property name="toolTip">
|
|
||||||
<string><p>When calibre removes inter paragraph spacing, it automatically sets a paragraph indent, to ensure that paragraphs can be easily distinguished. This option controls the width of that indent.</string>
|
|
||||||
</property>
|
|
||||||
<property name="suffix">
|
|
||||||
<string> em</string>
|
|
||||||
</property>
|
|
||||||
<property name="decimals">
|
|
||||||
<number>1</number>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="6" column="0">
|
||||||
|
<widget class="QLabel" name="label_5">
|
||||||
|
<property name="text">
|
||||||
|
<string>Text justification:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item row="7" column="0">
|
<item row="7" column="0">
|
||||||
<widget class="QCheckBox" name="opt_linearize_tables">
|
<widget class="QCheckBox" name="opt_linearize_tables">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
@ -188,14 +178,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="9" column="0">
|
<item row="9" column="0" colspan="4">
|
||||||
<widget class="QCheckBox" name="opt_asciiize">
|
|
||||||
<property name="text">
|
|
||||||
<string>&Transliterate unicode characters to ASCII.</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="10" column="0" colspan="3">
|
|
||||||
<widget class="QGroupBox" name="groupBox">
|
<widget class="QGroupBox" name="groupBox">
|
||||||
<property name="title">
|
<property name="title">
|
||||||
<string>Extra &CSS</string>
|
<string>Extra &CSS</string>
|
||||||
@ -207,6 +190,16 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="6" column="2" colspan="2">
|
||||||
|
<widget class="QComboBox" name="opt_change_justification"/>
|
||||||
|
</item>
|
||||||
|
<item row="7" column="1" colspan="3">
|
||||||
|
<widget class="QCheckBox" name="opt_asciiize">
|
||||||
|
<property name="text">
|
||||||
|
<string>&Transliterate unicode characters to ASCII</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item row="8" column="0">
|
<item row="8" column="0">
|
||||||
<widget class="QCheckBox" name="opt_insert_blank_line">
|
<widget class="QCheckBox" name="opt_insert_blank_line">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
@ -214,35 +207,13 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="6" column="0">
|
<item row="8" column="1" colspan="2">
|
||||||
<widget class="QLabel" name="label_5">
|
<widget class="QCheckBox" name="opt_keep_ligatures">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Text justification:</string>
|
<string>Keep &ligatures</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="6" column="2">
|
|
||||||
<widget class="QComboBox" name="opt_change_justification">
|
|
||||||
<property name="currentIndex">
|
|
||||||
<number>2</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>justify</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>left</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>original</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<resources>
|
<resources>
|
||||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
8619
src/calibre/translations/en_AU.po
Normal file
8619
src/calibre/translations/en_AU.po
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
8619
src/calibre/translations/th.po
Normal file
8619
src/calibre/translations/th.po
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user