Example #1
0
    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>"))
Example #2
0
    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)
Example #3
0
 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)
Example #4
0
 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',
         'transform_css_rules'
     ])
     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))
Example #5
0
    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)
Example #6
0
    def __init__(self, parent, get_option, get_help, db=None, book_id=None):
        Widget.__init__(self, parent, [
            'use_profile_size', 'paper_size', 'custom_size', 'pdf_hyphenate',
            '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',
            'pdf_page_margin_left', 'pdf_page_margin_top', 'pdf_page_margin_right', 'pdf_page_margin_bottom',
        ])
        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)
Example #7
0
    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)
Example #8
0
    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)
Example #9
0
 def __init__(self, parent, get_option, get_help, db=None, book_id=None):
     Widget.__init__(self, parent, [
         'snb_insert_empty_line', 'snb_dont_indent_first_line',
         'snb_hide_chapter_name', 'snb_full_screen'
     ])
     self.db, self.book_id = db, book_id
     self.initialize_options(get_option, get_help, db, book_id)
Example #10
0
    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)
            x.entered[(QModelIndex)].connect(self.show_desc)
        self.initialize_options(get_option, get_help, db, book_id)
        it = str(self.opt_input_profile.toolTip())
        self.opt_input_profile.setToolTip('<p>' + it.replace('t.', 't.\n<br>'))
        it = str(self.opt_output_profile.toolTip())
        self.opt_output_profile.setToolTip('<p>' +
                                           it.replace('t.', 'ce.\n<br>'))
Example #11
0
    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
Example #12
0
    def __init__(self, parent, get_option, get_help, db=None, book_id=None):
        Widget.__init__(self, parent, OPTIONS['output']['docx'])
        for x in get_option('docx_page_size').option.choices:
            self.opt_docx_page_size.addItem(x)

        self.initialize_options(get_option, get_help, db, book_id)
        self.layout().setFieldGrowthPolicy(self.layout().ExpandingFieldsGrow)
Example #13
0
    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
Example #14
0
    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)
Example #15
0
    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)
Example #16
0
    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_navpoints_only_deepest']
        )
        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.initialize_options(get_option, get_help, db, book_id)
Example #17
0
    def break_cycles(self):
        Widget.break_cycles(self)

        try:
            self.opt_enable_heuristics.stateChanged.disconnect()
            self.opt_unwrap_lines.stateChanged.disconnect()
        except:
            pass
Example #18
0
 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)
Example #19
0
 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)
Example #20
0
 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)
Example #21
0
 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)
Example #22
0
    def break_cycles(self):
        Widget.break_cycles(self)

        try:
            self.opt_enable_heuristics.stateChanged.disconnect()
            self.opt_unwrap_lines.stateChanged.disconnect()
        except:
            pass
Example #23
0
    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()
Example #24
0
    def __init__(self, parent, get_option, get_help, db=None, book_id=None):
        Widget.__init__(self, parent, OPTIONS['output']['pdb'])
        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)
Example #25
0
    def __init__(self, parent, get_option, get_help, db=None, book_id=None):
        Widget.__init__(self, parent, OPTIONS['output']['pdb'])
        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)
Example #26
0
    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()
Example #27
0
    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)
Example #28
0
 def __init__(self, parent, get_option, get_help, db=None, book_id=None):
     Widget.__init__(self, parent, ['debug_pipeline'])
     self.db, self.book_id = db, book_id
     self.initialize_options(get_option, get_help, db, book_id)
     self.connect(self.button_debug_dir, SIGNAL('clicked()'),
                  self.set_debug_dir)
     self.connect(self.button_clear, SIGNAL('clicked()'),
                  self.clear_debug_dir)
Example #29
0
 def __init__(self, parent, get_option, get_help, db=None, book_id=None):
     Widget.__init__(self, parent,
             ['debug_pipeline']
             )
     self.db, self.book_id = db, book_id
     self.initialize_options(get_option, get_help, db, book_id)
     self.button_debug_dir.clicked.connect(self.set_debug_dir)
     self.button_clear.clicked.connect(self.clear_debug_dir)
Example #30
0
 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()
Example #31
0
 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)
Example #32
0
 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)
Example #33
0
 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)
 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)
Example #35
0
 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()
Example #36
0
    def __init__(self, parent, get_option, get_help, db=None, book_id=None):
        Widget.__init__(self, parent, [
            'docx_page_size', 'docx_custom_page_size', 'docx_no_cover', 'docx_no_toc',
        ])
        for x in get_option('docx_page_size').option.choices:
            self.opt_docx_page_size.addItem(x)

        self.initialize_options(get_option, get_help, db, book_id)
        self.layout().setFieldGrowthPolicy(self.layout().ExpandingFieldsGrow)
Example #37
0
 def __init__(self, parent, get_option, get_help, db=None, book_id=None):
     Widget.__init__(self, parent, ['htmlz_css_type', 'htmlz_class_style',
         'htmlz_title_filename'])
     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)
Example #38
0
    def restore_defaults(self, get_option):
        Widget.restore_defaults(self, get_option)

        self.save_histories()
        rssb_hist = gprefs['replace_scene_breaks_history']
        for x in self.rssb_defaults:
            if x in rssb_hist:
                del rssb_hist[rssb_hist.index(x)]
        gprefs['replace_scene_breaks_history'] = self.rssb_defaults + gprefs['replace_scene_breaks_history']
        self.load_histories()
Example #39
0
 def __init__(self, parent, get_option, get_help, db=None, book_id=None):
     Widget.__init__(self, parent, ['prefer_metadata_cover'])
     self.db, self.book_id = db, book_id
     self.cover_changed = False
     self.cover_data = None
     if self.db is not None:
         self.initialize_metadata_options()
     self.initialize_options(get_option, get_help, db, book_id)
     self.connect(self.cover_button, SIGNAL("clicked()"), self.select_cover)
     self.comment.hide_toolbars()
Example #40
0
    def restore_defaults(self, get_option):
        Widget.restore_defaults(self, get_option)

        self.save_histories()
        rssb_hist = gprefs['replace_scene_breaks_history']
        for x in self.rssb_defaults:
            if x in rssb_hist:
                del rssb_hist[rssb_hist.index(x)]
        gprefs['replace_scene_breaks_history'] = self.rssb_defaults + gprefs['replace_scene_breaks_history']
        self.load_histories()
Example #41
0
 def __init__(self, parent, get_option, get_help, db=None, book_id=None):
     Widget.__init__(
         self, parent,
         ['htmlz_css_type', 'htmlz_class_style', 'htmlz_title_filename'])
     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)
Example #42
0
 def __init__(self, parent, get_option, get_help, db=None, book_id=None):
     Widget.__init__(self, parent, ['prefer_metadata_cover'])
     self.db, self.book_id = db, book_id
     self.cover_changed = False
     self.cover_data = None
     if self.db is not None:
         self.initialize_metadata_options()
     self.initialize_options(get_option, get_help, db, book_id)
     self.connect(self.cover_button, SIGNAL("clicked()"), self.select_cover)
     self.comment.hide_toolbars()
Example #43
0
 def __init__(self, parent, get_option, get_help, db=None, book_id=None):
     Widget.__init__(self, parent, [
         'dont_split_on_page_breaks', 'flow_size', 'no_default_epub_cover',
         'no_svg_cover', 'epub_inline_toc', 'epub_toc_at_end', 'toc_title',
         'preserve_cover_aspect_ratio', 'epub_flatten'
     ])
     for i in range(2):
         self.opt_no_svg_cover.toggle()
     self.db, self.book_id = db, book_id
     self.initialize_options(get_option, get_help, db, book_id)
    def __init__(self, parent, get_option, get_help, db=None, book_id=None):
        self.db = db  # db is set for conversion, but not default preferences
        self.book_id = book_id  # book_id is set for individual conversion, but not bulk

        Widget.__init__(self, parent, [
            "cde_type_pdoc", "show_kpr_logs", "approximate_pages",
            "number_of_pages_field", "enable_timeout"
        ])

        self.initialize_options(get_option, get_help, db, book_id)
Example #45
0
 def __init__(self, parent, get_option, get_help, db=None, book_id=None):
     Widget.__init__(self, parent,
         ['paragraph_type', 'formatting_type', 'markdown_disable_toc',
          'preserve_spaces', 'txt_in_remove_indents'])
     self.db, self.book_id = db, book_id
     for x in get_option('paragraph_type').option.choices:
         self.opt_paragraph_type.addItem(x)
     for x in get_option('formatting_type').option.choices:
         self.opt_formatting_type.addItem(x)
     self.initialize_options(get_option, get_help, db, book_id)
Example #46
0
 def __init__(self, parent, get_option, get_help, db=None, book_id=None):
     Widget.__init__(self, parent,
             ['dont_split_on_page_breaks', 'flow_size',
                 'no_default_epub_cover', 'no_svg_cover',
                 'preserve_cover_aspect_ratio', 'epub_flatten']
             )
     for i in range(2):
         self.opt_no_svg_cover.toggle()
     self.db, self.book_id = db, book_id
     self.initialize_options(get_option, get_help, db, book_id)
    def __init__(self, parent, get_option, get_help, db=None, book_id=None):
        Widget.__init__(self, parent,
                ['prefer_author_sort', 'toc_title',
                    'mobi_toc_at_start',
                'dont_compress', 'no_inline_toc', 'share_not_sync',
                ]
                )
        self.db, self.book_id = db, book_id

        self.initialize_options(get_option, get_help, db, book_id)
Example #48
0
 def __init__(self, parent, get_option, get_help, db=None, book_id=None):
     Widget.__init__(self, parent,
     ['newline', 'max_line_length', 'force_max_line_length',
     'inline_toc', 'txt_output_formatting', 'keep_links', 'keep_image_references',
     'keep_color', 'txt_output_encoding'])
     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)
 def __init__(self, parent, get_option, get_help, db=None, book_id=None):
     Widget.__init__(self, parent, [
         'paragraph_type', 'formatting_type', 'markdown_disable_toc',
         'preserve_spaces', 'txt_in_remove_indents'
     ])
     self.db, self.book_id = db, book_id
     for x in get_option('paragraph_type').option.choices:
         self.opt_paragraph_type.addItem(x)
     for x in get_option('formatting_type').option.choices:
         self.opt_formatting_type.addItem(x)
     self.initialize_options(get_option, get_help, db, book_id)
Example #50
0
    def __init__(self, parent, get_option, get_help, db=None, book_id=None):
        Widget.__init__(self, parent, [
            'docx_page_size', 'docx_custom_page_size', 'docx_no_cover', 'docx_no_toc',
            'docx_page_margin_left', 'docx_page_margin_top', 'docx_page_margin_right',
            'docx_page_margin_bottom', 'preserve_cover_aspect_ratio',
        ])
        for x in get_option('docx_page_size').option.choices:
            self.opt_docx_page_size.addItem(x)

        self.initialize_options(get_option, get_help, db, book_id)
        self.layout().setFieldGrowthPolicy(self.layout().ExpandingFieldsGrow)
Example #51
0
    def __init__(self, parent, get_option, get_help, db=None, book_id=None):
        Widget.__init__(self, parent, ['paper_size', 'custom_size',
            'orientation', 'preserve_cover_aspect_ratio'])
        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('orientation').option.choices:
            self.opt_orientation.addItem(x)

        self.initialize_options(get_option, get_help, db, book_id)
    def __init__(self, parent, get_option, get_help, db=None, book_id=None):
        """Initialize KePub input configuration."""
        Widget.__init__(
            self,
            parent,
            OPTIONS["input"].get("epub", tuple()) + ("strip_kobo_spans", ),
        )

        if book_id:
            self._icon = QIcon(I("forward.png"))  # noqa: F821 - calibre
        self.initialize_options(get_option, get_help, db, book_id)
Example #53
0
 def __init__(self, parent, get_option, get_help, db=None, book_id=None):
     Widget.__init__(self, parent,
     ['newline', 'max_line_length', 'force_max_line_length',
     'inline_toc', 'txt_output_formatting', 'keep_links', 'keep_image_references',
     'keep_color', 'txt_output_encoding'])
     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)
Example #54
0
 def __init__(self, parent, get_option, get_help, db=None, book_id=None):
     Widget.__init__(self, parent, OPTIONS['pipe']['structure_detection'])
     self.db, self.book_id = db, book_id
     for x in ('pagebreak', 'rule', 'both', 'none'):
         self.opt_chapter_mark.addItem(x)
     self.initialize_options(get_option, get_help, db, book_id)
     self.opt_chapter.set_msg(_('Detect &chapters at (XPath expression):'))
     self.opt_page_breaks_before.set_msg(_('Insert &page breaks before '
         '(XPath expression):'))
     self.opt_start_reading_at.set_msg(
             _('Start &reading at (XPath expression):'))
    def __init__(self, parent, get_option, get_help, db=None, book_id=None):
        self.db = db  # db is set for conversion, but not default preferences
        self.book_id = book_id  # book_id is set for individual conversion, but not bulk

        # todo webtoon
        # Widget.__init__(self, parent, ["manga", "webtoon", "margins", "no_greyscale", "max_width", "max_height", "gamma"])
        Widget.__init__(self, parent, [
            "manga", "margins", "no_greyscale", "max_width", "max_height",
            "gamma"
        ])
        self.initialize_options(get_option, get_help, db, book_id)
 def __init__(self, parent, get_option, get_help, db=None, book_id=None):
     # A near-direct copy of calibre.gui2.convert.epub_output.PluginWidget#__init__
     Widget.__init__(self, parent, ['dont_split_on_page_breaks', 'flow_size',
                                    'no_default_epub_cover', 'no_svg_cover',
                                    'epub_inline_toc', 'epub_toc_at_end', 'toc_title',
                                    'preserve_cover_aspect_ratio', 'epub_flatten',
                                    'kepub_hyphenate', 'kepub_replace_lang',
                                    'kepub_clean_markup'])
     for i in range(2):
         self.opt_no_svg_cover.toggle()
     self.db, self.book_id = db, book_id
     self.initialize_options(get_option, get_help, db, book_id)
Example #57
0
    def break_cycles(self):
        Widget.break_cycles(self)

        def d(x):
            try:
                x.disconnect()
            except:
                pass

        d(self.sr_search)

        self.sr_search.break_cycles()
Example #58
0
 def __init__(self, parent, get_option, get_help, db=None, book_id=None):
     Widget.__init__(self, parent, OPTIONS['pipe']['metadata'])
     self.db, self.book_id = db, book_id
     self.cover_changed = False
     self.cover_data = None
     if self.db is not None:
         self.initialize_metadata_options()
     self.initialize_options(get_option, get_help, db, book_id)
     self.cover_button.clicked.connect(self.select_cover)
     self.comment.hide_toolbars()
     self.cover.cover_changed.connect(self.change_cover)
     self.series.currentTextChanged.connect(self.series_changed)