本文整理汇总了Python中calibre.gui2.convert.Widget类的典型用法代码示例。如果您正苦于以下问题:Python Widget类的具体用法?Python Widget怎么用?Python Widget使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Widget类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, parent, get_option, get_help, db=None, book_id=None):
self.__connections = []
Widget.__init__(
self,
parent,
["margin_top", "margin_left", "margin_right", "margin_bottom", "input_profile", "output_profile"],
)
self.db, self.book_id = db, book_id
self.input_model = ProfileModel(input_profiles())
self.output_model = ProfileModel(output_profiles())
self.opt_input_profile.setModel(self.input_model)
self.opt_output_profile.setModel(self.output_model)
for g, slot in self.__connections:
g.selectionModel().currentChanged.connect(slot)
del self.__connections
for x in (self.opt_input_profile, self.opt_output_profile):
x.setMouseTracking(True)
self.connect(x, SIGNAL("entered(QModelIndex)"), self.show_desc)
self.initialize_options(get_option, get_help, db, book_id)
it = unicode(self.opt_input_profile.toolTip())
self.opt_input_profile.setToolTip("<p>" + it.replace("t.", "t.\n<br>"))
it = unicode(self.opt_output_profile.toolTip())
self.opt_output_profile.setToolTip("<p>" + it.replace("t.", "ce.\n<br>"))
示例2: __init__
def __init__(self, parent, get_option, get_help, db=None, book_id=None):
Widget.__init__(self, parent,
['prefer_author_sort', 'toc_title',
'mobi_keep_original_images',
'mobi_ignore_margins', 'mobi_toc_at_start',
'dont_compress', 'no_inline_toc', 'share_not_sync',
'personal_doc', 'mobi_file_type']
)
self.db, self.book_id = db, book_id
'''
from calibre.utils.fonts import fontconfig
global font_family_model
if font_family_model is None:
font_family_model = FontFamilyModel()
try:
font_family_model.families = fontconfig.find_font_families(allowed_extensions=['ttf'])
except:
import traceback
font_family_model.families = []
print 'WARNING: Could not load fonts'
traceback.print_exc()
font_family_model.families.sort()
font_family_model.families[:0] = [_('Default')]
self.font_family_model = font_family_model
self.opt_masthead_font.setModel(self.font_family_model)
'''
self.opt_mobi_file_type.addItems(['old', 'both', 'new'])
self.initialize_options(get_option, get_help, db, book_id)
示例3: __init__
def __init__(self, parent, get_option, get_help, db=None, book_id=None):
Widget.__init__(self, parent,
['enable_heuristics', 'markup_chapter_headings',
'italicize_common_cases', 'fix_indents',
'html_unwrap_factor', 'unwrap_lines',
'delete_blank_paragraphs',
'format_scene_breaks', 'replace_scene_breaks',
'dehyphenate', 'renumber_headings']
)
self.db, self.book_id = db, book_id
self.rssb_defaults = [u'', u'<hr />', u'∗ ∗ ∗', u'• • •', u'♦ ♦ ♦',
u'† †', u'‡ ‡ ‡', u'∞ ∞ ∞', u'¤ ¤ ¤', u'§']
self.initialize_options(get_option, get_help, db, book_id)
self.load_histories()
self.opt_enable_heuristics.stateChanged.connect(self.enable_heuristics)
self.opt_unwrap_lines.stateChanged.connect(self.enable_unwrap)
self.enable_heuristics(self.opt_enable_heuristics.checkState())
try:
self.help_label.setText(self.help_label.text() % localize_user_manual_link(
'https://manual.calibre-ebook.com/conversion.html#heuristic-processing'))
except TypeError:
pass # link already localized
示例4: __init__
def __init__(self, parent, get_option, get_help, db=None, book_id=None):
Widget.__init__(self, parent, [
'override_profile_size', 'paper_size', 'custom_size',
'preserve_cover_aspect_ratio', 'pdf_serif_family', 'unit',
'pdf_sans_family', 'pdf_mono_family', 'pdf_standard_font',
'pdf_default_font_size', 'pdf_mono_font_size', 'pdf_page_numbers',
'pdf_footer_template', 'pdf_header_template', 'pdf_add_toc', 'toc_title',
])
self.db, self.book_id = db, book_id
try:
self.hf_label.setText(self.hf_label.text() % localize_user_manual_link(
'https://manual.calibre-ebook.com/conversion.html#converting-to-pdf'))
except TypeError:
pass # link already localized
for x in get_option('paper_size').option.choices:
self.opt_paper_size.addItem(x)
for x in get_option('unit').option.choices:
self.opt_unit.addItem(x)
for x in get_option('pdf_standard_font').option.choices:
self.opt_pdf_standard_font.addItem(x)
self.initialize_options(get_option, get_help, db, book_id)
self.layout().setFieldGrowthPolicy(self.layout().ExpandingFieldsGrow)
self.template_box.layout().setFieldGrowthPolicy(self.layout().AllNonFixedFieldsGrow)
示例5: __init__
def __init__(self, parent, get_option, get_help, db=None, book_id=None):
Widget.__init__(
self,
parent,
[
"override_profile_size",
"paper_size",
"custom_size",
"preserve_cover_aspect_ratio",
"pdf_serif_family",
"unit",
"pdf_sans_family",
"pdf_mono_family",
"pdf_standard_font",
"pdf_default_font_size",
"pdf_mono_font_size",
"pdf_page_numbers",
"pdf_footer_template",
"pdf_header_template",
"pdf_add_toc",
"toc_title",
],
)
self.db, self.book_id = db, book_id
for x in get_option("paper_size").option.choices:
self.opt_paper_size.addItem(x)
for x in get_option("unit").option.choices:
self.opt_unit.addItem(x)
for x in get_option("pdf_standard_font").option.choices:
self.opt_pdf_standard_font.addItem(x)
self.initialize_options(get_option, get_help, db, book_id)
示例6: __init__
def __init__(self, parent, get_option, get_help, db=None, book_id=None):
Widget.__init__(self, parent, OPTIONS['output']['mobi'])
self.db, self.book_id = db, book_id
self.opt_mobi_file_type.addItems(['old', 'both', 'new'])
self.initialize_options(get_option, get_help, db, book_id)
示例7: __init__
def __init__(self, parent, get_option, get_help, db=None, book_id=None):
Widget.__init__(self, parent,
['change_justification', 'extra_css', 'base_font_size',
'font_size_mapping', 'line_height', 'minimum_line_height',
'embed_font_family', 'embed_all_fonts', 'subset_embedded_fonts',
'smarten_punctuation', 'unsmarten_punctuation',
'disable_font_rescaling', 'insert_blank_line',
'remove_paragraph_spacing',
'remove_paragraph_spacing_indent_size',
'insert_blank_line_size',
'input_encoding', 'filter_css', 'expand_css',
'asciiize', 'keep_ligatures',
'linearize_tables']
)
for val, text in [
('original', _('Original')),
('left', _('Left align')),
('justify', _('Justify text'))
]:
self.opt_change_justification.addItem(text, (val))
self.db, self.book_id = 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()
self.button_font_key.clicked.connect(self.font_key_wizard)
self.opt_remove_paragraph_spacing.toggle()
self.opt_remove_paragraph_spacing.toggle()
self.opt_smarten_punctuation.stateChanged.connect(
lambda state: state != Qt.Unchecked and
self.opt_unsmarten_punctuation.setCheckState(Qt.Unchecked))
self.opt_unsmarten_punctuation.stateChanged.connect(
lambda state: state != Qt.Unchecked and
self.opt_smarten_punctuation.setCheckState(Qt.Unchecked))
self.opt_extra_css.size_hint = QSize(400, 300)
示例8: __init__
def __init__(self, parent, get_option, get_help, db=None, book_id=None):
Widget.__init__(self, parent, OPTIONS['output']['lrf'])
self.db, self.book_id = db, book_id
self.initialize_options(get_option, get_help, db, book_id)
self.opt_header.toggle(), self.opt_header.toggle()
self.opt_render_tables_as_images.toggle()
self.opt_render_tables_as_images.toggle()
示例9: __init__
def __init__(self, parent, get_option, get_help, db=None, book_id=None):
Widget.__init__(self, parent, OPTIONS['output']['fb2'])
self.db, self.book_id = db, book_id
for x in ('toc', 'files', 'nothing'):
self.opt_sectionize.addItem(x)
for x in get_option('fb2_genre').option.choices:
self.opt_fb2_genre.addItem(x)
self.initialize_options(get_option, get_help, db, book_id)
示例10: __init__
def __init__(self, parent, get_option, get_help, db=None, book_id=None):
Widget.__init__(self, parent, ['format', 'inline_toc', 'pdb_output_encoding'])
self.db, self.book_id = db, book_id
for x in get_option('format').option.choices:
self.opt_format.addItem(x)
self.initialize_options(get_option, get_help, db, book_id)
示例11: break_cycles
def break_cycles(self):
Widget.break_cycles(self)
try:
self.opt_enable_heuristics.stateChanged.disconnect()
self.opt_unwrap_lines.stateChanged.disconnect()
except:
pass
示例12: __init__
def __init__(self, parent, get_option, get_help, db=None, book_id=None):
Widget.__init__(self, parent, OPTIONS['input']['comic'])
self.db, self.book_id = db, book_id
for x in get_option('output_format').option.choices:
self.opt_output_format.addItem(x)
self.initialize_options(get_option, get_help, db, book_id)
self.opt_no_process.toggle()
self.opt_no_process.toggle()
示例13: __init__
def __init__(self, parent, get_option, get_help, db=None, book_id=None):
Widget.__init__(self, parent, OPTIONS['output']['txt'])
self.db, self.book_id = db, book_id
for x in get_option('newline').option.choices:
self.opt_newline.addItem(x)
for x in get_option('txt_output_formatting').option.choices:
self.opt_txt_output_formatting.addItem(x)
self.initialize_options(get_option, get_help, db, book_id)
示例14: __init__
def __init__(self, parent, get_option, get_help, db=None, book_id=None):
Widget.__init__(self, parent, OPTIONS['output']['epub'])
for i in range(2):
self.opt_no_svg_cover.toggle()
ev = get_option('epub_version')
self.opt_epub_version.addItems(list(ev.option.choices))
self.db, self.book_id = db, book_id
self.initialize_options(get_option, get_help, db, book_id)
示例15: __init__
def __init__(self, parent, get_option, get_help, db=None, book_id=None):
Widget.__init__(self, parent, OPTIONS['output']['htmlz'])
self.db, self.book_id = db, book_id
for x in get_option('htmlz_css_type').option.choices:
self.opt_htmlz_css_type.addItem(x)
for x in get_option('htmlz_class_style').option.choices:
self.opt_htmlz_class_style.addItem(x)
self.initialize_options(get_option, get_help, db, book_id)