MOBI Output: Remove option to choose masthead font as the font selection control causes crashes on some windows systems

This commit is contained in:
Kovid Goyal 2011-08-03 23:09:42 -06:00
parent 5e2de3f121
commit 7471f00b04
4 changed files with 11 additions and 33 deletions

View File

@ -55,13 +55,6 @@ class MOBIOutput(OutputFormatPlugin):
' specified directory. If the directory already ' ' specified directory. If the directory already '
'exists, it will be deleted.') 'exists, it will be deleted.')
), ),
OptionRecommendation(name='mobi_navpoints_only_deepest',
recommended_value=False,
help=_('When adding navpoints for the chapter-to-chapter'
' navigation on the kindle, use only the lowest level '
'of items in the TOC, instead of items at every level.')
),
OptionRecommendation(name='kindlegen', OptionRecommendation(name='kindlegen',
recommended_value=False, recommended_value=False,
help=('Use kindlegen (must be in your PATH) to generate the' help=('Use kindlegen (must be in your PATH) to generate the'

View File

@ -1710,8 +1710,7 @@ class MobiWriter(object):
''' '''
from calibre.ebooks.oeb.base import TOC from calibre.ebooks.oeb.base import TOC
items = list(self._oeb.toc.iterdescendants()) items = list(self._oeb.toc.iterdescendants())
if self.opts.mobi_navpoints_only_deepest: items = [i for i in items if i.depth == 1]
items = [i for i in items if i.depth == 1]
offsets = {i:self._id_offsets.get(i.href, -1) for i in items if i.href} offsets = {i:self._id_offsets.get(i.href, -1) for i in items if i.href}
items = [i for i in items if offsets[i] > -1] items = [i for i in items if offsets[i] > -1]
items.sort(key=lambda i:offsets[i]) items.sort(key=lambda i:offsets[i])

View File

@ -6,11 +6,9 @@ __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 Qt
from calibre.gui2.convert.mobi_output_ui import Ui_Form from calibre.gui2.convert.mobi_output_ui import Ui_Form
from calibre.gui2.convert import Widget from calibre.gui2.convert import Widget
from calibre.gui2.widgets import FontFamilyModel
font_family_model = None font_family_model = None
@ -26,11 +24,13 @@ class PluginWidget(Widget, Ui_Form):
['prefer_author_sort', 'rescale_images', 'toc_title', ['prefer_author_sort', 'rescale_images', 'toc_title',
'mobi_ignore_margins', 'mobi_toc_at_start', 'mobi_ignore_margins', 'mobi_toc_at_start',
'dont_compress', 'no_inline_toc', 'dont_compress', 'no_inline_toc',
'masthead_font','personal_doc', 'mobi_navpoints_only_deepest'] 'personal_doc']#, 'mobi_navpoints_only_deepest']
) )
from calibre.utils.fonts import fontconfig
self.db, self.book_id = db, book_id self.db, self.book_id = db, book_id
'''
from calibre.utils.fonts import fontconfig
global font_family_model global font_family_model
if font_family_model is None: if font_family_model is None:
font_family_model = FontFamilyModel() font_family_model = FontFamilyModel()
@ -46,9 +46,11 @@ class PluginWidget(Widget, Ui_Form):
self.font_family_model = font_family_model self.font_family_model = font_family_model
self.opt_masthead_font.setModel(self.font_family_model) self.opt_masthead_font.setModel(self.font_family_model)
'''
self.initialize_options(get_option, get_help, db, book_id) self.initialize_options(get_option, get_help, db, book_id)
'''
def set_value_handler(self, g, val): def set_value_handler(self, g, val):
if unicode(g.objectName()) in 'opt_masthead_font': if unicode(g.objectName()) in 'opt_masthead_font':
idx = -1 idx = -1
@ -59,3 +61,4 @@ class PluginWidget(Widget, Ui_Form):
g.setCurrentIndex(idx) g.setCurrentIndex(idx)
return True return True
return False return False
'''

View File

@ -7,7 +7,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>521</width> <width>521</width>
<height>331</height> <height>342</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@ -55,22 +55,12 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="9" column="0" colspan="2"> <item row="8" column="0" colspan="2">
<widget class="QGroupBox" name="groupBox"> <widget class="QGroupBox" name="groupBox">
<property name="title"> <property name="title">
<string>Kindle options</string> <string>Kindle options</string>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout"> <layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="label_2">
<property name="text">
<string>Periodical masthead font:</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="opt_masthead_font"/>
</item>
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout"> <layout class="QHBoxLayout" name="horizontalLayout">
<item> <item>
@ -101,7 +91,7 @@
</layout> </layout>
</widget> </widget>
</item> </item>
<item row="10" column="0"> <item row="9" column="0">
<spacer name="verticalSpacer_2"> <spacer name="verticalSpacer_2">
<property name="orientation"> <property name="orientation">
<enum>Qt::Vertical</enum> <enum>Qt::Vertical</enum>
@ -128,13 +118,6 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="7" column="0" colspan="2">
<widget class="QCheckBox" name="opt_mobi_navpoints_only_deepest">
<property name="text">
<string>Use only &amp;lowest level of items in the TOC for chapter-to-chapter navigation</string>
</property>
</widget>
</item>
</layout> </layout>
</widget> </widget>
<resources/> <resources/>