当前位置: 首页>>代码示例>>Python>>正文


Python Config.add_group方法代码示例

本文整理汇总了Python中calibre.utils.config.Config.add_group方法的典型用法代码示例。如果您正苦于以下问题:Python Config.add_group方法的具体用法?Python Config.add_group怎么用?Python Config.add_group使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在calibre.utils.config.Config的用法示例。


在下文中一共展示了Config.add_group方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: config

# 需要导入模块: from calibre.utils.config import Config [as 别名]
# 或者: from calibre.utils.config.Config import add_group [as 别名]
def config(defaults=None):
    desc = _('Options to customize the ebook viewer')
    if defaults is None:
        c = Config('viewer', desc)
    else:
        c = StringConfig(defaults, desc)

    c.add_opt('remember_window_size', default=False,
        help=_('Remember last used window size'))
    c.add_opt('user_css', default='',
              help=_('Set the user CSS stylesheet. This can be used to customize the look of all books.'))
    c.add_opt('max_fs_width', default=800,
        help=_("Set the maximum width that the book's text and pictures will take"
        " when in fullscreen mode. This allows you to read the book text"
        " without it becoming too wide."))
    c.add_opt('fit_images', default=True,
            help=_('Resize images larger than the viewer window to fit inside it'))
    c.add_opt('hyphenate', default=False, help=_('Hyphenate text'))
    c.add_opt('hyphenate_default_lang', default='en',
            help=_('Default language for hyphenation rules'))
    c.add_opt('remember_current_page', default=True,
            help=_('Save the current position in the document, when quitting'))
    c.add_opt('wheel_flips_pages', default=False,
            help=_('Have the mouse wheel turn pages'))
    c.add_opt('line_scrolling_stops_on_pagebreaks', default=False,
            help=_('Prevent the up and down arrow keys from scrolling past '
                'page breaks'))
    c.add_opt('page_flip_duration', default=0.5,
            help=_('The time, in seconds, for the page flip animation. Default'
                ' is half a second.'))
    c.add_opt('font_magnification_step', default=0.2,
            help=_('The amount by which to change the font size when clicking'
                ' the font larger/smaller buttons. Should be a number between '
                '0 and 1.'))
    c.add_opt('fullscreen_clock', default=False, action='store_true',
            help=_('Show a clock in fullscreen mode.'))
    c.add_opt('fullscreen_pos', default=False, action='store_true',
            help=_('Show reading position in fullscreen mode.'))
    c.add_opt('fullscreen_scrollbar', default=True, action='store_false',
            help=_('Show the scrollbar in fullscreen mode.'))
    c.add_opt('cols_per_screen', default=1)
    c.add_opt('use_book_margins', default=False, action='store_true')
    c.add_opt('top_margin', default=20)
    c.add_opt('side_margin', default=40)
    c.add_opt('bottom_margin', default=20)
    c.add_opt('text_color', default=None)
    c.add_opt('background_color', default=None)

    fonts = c.add_group('FONTS', _('Font options'))
    fonts('serif_family', default='Times New Roman' if iswindows else 'Liberation Serif',
          help=_('The serif font family'))
    fonts('sans_family', default='Verdana' if iswindows else 'Liberation Sans',
          help=_('The sans-serif font family'))
    fonts('mono_family', default='Courier New' if iswindows else 'Liberation Mono',
          help=_('The monospaced font family'))
    fonts('default_font_size', default=20, help=_('The standard font size in px'))
    fonts('mono_font_size', default=16, help=_('The monospaced font size in px'))
    fonts('standard_font', default='serif', help=_('The standard font type'))

    return c
开发者ID:yeyanchao,项目名称:calibre,代码行数:62,代码来源:config.py

示例2: config

# 需要导入模块: from calibre.utils.config import Config [as 别名]
# 或者: from calibre.utils.config.Config import add_group [as 别名]
def config(defaults=None):
    desc = _("Options to customize the ebook viewer")
    if defaults is None:
        c = Config("viewer", desc)
    else:
        c = StringConfig(defaults, desc)

    c.add_opt("remember_window_size", default=False, help=_("Remember last used window size"))
    c.add_opt(
        "user_css",
        default="",
        help=_("Set the user CSS stylesheet. This can be used to customize the look of all books."),
    )
    c.add_opt(
        "max_fs_width",
        default=800,
        help=_(
            "Set the maximum width that the book's text and pictures will take"
            " when in fullscreen mode. This allows you to read the book text"
            " without it becoming too wide."
        ),
    )
    c.add_opt(
        "max_fs_height",
        default=-1,
        help=_(
            "Set the maximum height that the book's text and pictures will take"
            " when in fullscreen mode. This allows you to read the book text"
            " without it becoming too tall. Note that this setting only takes effect in paged mode (which is the default mode)."
        ),
    )
    c.add_opt("fit_images", default=True, help=_("Resize images larger than the viewer window to fit inside it"))
    c.add_opt("hyphenate", default=False, help=_("Hyphenate text"))
    c.add_opt("hyphenate_default_lang", default="en", help=_("Default language for hyphenation rules"))
    c.add_opt("remember_current_page", default=True, help=_("Save the current position in the document, when quitting"))
    c.add_opt("wheel_flips_pages", default=False, help=_("Have the mouse wheel turn pages"))
    c.add_opt(
        "line_scrolling_stops_on_pagebreaks",
        default=False,
        help=_("Prevent the up and down arrow keys from scrolling past " "page breaks"),
    )
    c.add_opt(
        "page_flip_duration",
        default=0.5,
        help=_("The time, in seconds, for the page flip animation. Default" " is half a second."),
    )
    c.add_opt(
        "font_magnification_step",
        default=0.2,
        help=_(
            "The amount by which to change the font size when clicking"
            " the font larger/smaller buttons. Should be a number between "
            "0 and 1."
        ),
    )
    c.add_opt("fullscreen_clock", default=False, action="store_true", help=_("Show a clock in fullscreen mode."))
    c.add_opt("fullscreen_pos", default=False, action="store_true", help=_("Show reading position in fullscreen mode."))
    c.add_opt(
        "fullscreen_scrollbar", default=True, action="store_false", help=_("Show the scrollbar in fullscreen mode.")
    )
    c.add_opt("start_in_fullscreen", default=False, action="store_true", help=_("Start viewer in full screen mode"))
    c.add_opt("show_fullscreen_help", default=True, action="store_false", help=_("Show full screen usage help"))
    c.add_opt("cols_per_screen", default=1)
    c.add_opt("use_book_margins", default=False, action="store_true")
    c.add_opt("top_margin", default=20)
    c.add_opt("side_margin", default=40)
    c.add_opt("bottom_margin", default=20)
    c.add_opt("text_color", default=None)
    c.add_opt("background_color", default=None)
    c.add_opt("show_controls", default=True)

    fonts = c.add_group("FONTS", _("Font options"))
    fonts(
        "serif_family", default="Times New Roman" if iswindows else "Liberation Serif", help=_("The serif font family")
    )
    fonts("sans_family", default="Verdana" if iswindows else "Liberation Sans", help=_("The sans-serif font family"))
    fonts(
        "mono_family", default="Courier New" if iswindows else "Liberation Mono", help=_("The monospaced font family")
    )
    fonts("default_font_size", default=20, help=_("The standard font size in px"))
    fonts("mono_font_size", default=16, help=_("The monospaced font size in px"))
    fonts("standard_font", default="serif", help=_("The standard font type"))
    fonts("minimum_font_size", default=8, help=_("The minimum font size in px"))

    return c
开发者ID:Cykooz,项目名称:calibre,代码行数:87,代码来源:config.py

示例3: config

# 需要导入模块: from calibre.utils.config import Config [as 别名]
# 或者: from calibre.utils.config.Config import add_group [as 别名]
def config(defaults=None):
    desc = _('Options to customize the ebook viewer')
    if defaults is None:
        c = Config('viewer', desc)
    else:
        c = StringConfig(defaults, desc)

    c.add_opt('remember_window_size', default=False,
        help=_('Remember last used window size'))
    c.add_opt('user_css', default='',
              help=_('Set the user CSS stylesheet. This can be used to customize the look of all books.'))
    c.add_opt('max_fs_width', default=800,
        help=_("Set the maximum width that the book's text and pictures will take"
        " when in fullscreen mode. This allows you to read the book text"
        " without it becoming too wide."))
    c.add_opt('max_fs_height', default=-1,
        help=_("Set the maximum height that the book's text and pictures will take"
        " when in fullscreen mode. This allows you to read the book text"
        " without it becoming too tall. Note that this setting only takes effect in paged mode (which is the default mode)."))
    c.add_opt('fit_images', default=True,
            help=_('Resize images larger than the viewer window to fit inside it'))
    c.add_opt('hyphenate', default=False, help=_('Hyphenate text'))
    c.add_opt('hyphenate_default_lang', default='en',
            help=_('Default language for hyphenation rules'))
    c.add_opt('search_online_url', default='https://www.google.com/search?q={text}',
              help=_('The URL to use when searching for selected text online'))
    c.add_opt('remember_current_page', default=True,
            help=_('Save the current position in the document, when quitting'))
    c.add_opt('copy_bookmarks_to_file', default=True,
            help=_('Copy bookmarks to the ebook file for easy sharing, if possible'))
    c.add_opt('wheel_flips_pages', default=False,
            help=_('Have the mouse wheel turn pages'))
    c.add_opt('wheel_scroll_fraction', default=100,
            help=_('Control how much the mouse wheel scrolls by in flow mode'))
    c.add_opt('line_scroll_fraction', default=100,
            help=_('Control how much the arrow keys scroll by in flow mode'))
    c.add_opt('tap_flips_pages', default=True,
            help=_('Tapping on the screen turns pages'))
    c.add_opt('line_scrolling_stops_on_pagebreaks', default=False,
            help=_('Prevent the up and down arrow keys from scrolling past '
                'page breaks'))
    c.add_opt('page_flip_duration', default=0.5,
            help=_('The time, in seconds, for the page flip animation. Default'
                ' is half a second.'))
    c.add_opt('font_magnification_step', default=0.2,
            help=_('The amount by which to change the font size when clicking'
                ' the font larger/smaller buttons. Should be a number between '
                '0 and 1.'))
    c.add_opt('fullscreen_clock', default=False, action='store_true',
            help=_('Show a clock in fullscreen mode.'))
    c.add_opt('fullscreen_pos', default=False, action='store_true',
            help=_('Show reading position in fullscreen mode.'))
    c.add_opt('fullscreen_scrollbar', default=True, action='store_false',
            help=_('Show the scrollbar in fullscreen mode.'))
    c.add_opt('start_in_fullscreen', default=False, action='store_true',
              help=_('Start viewer in full screen mode'))
    c.add_opt('show_fullscreen_help', default=True, action='store_false',
              help=_('Show full screen usage help'))
    c.add_opt('cols_per_screen', default=1)
    c.add_opt('cols_per_screen_portrait', default=1)
    c.add_opt('cols_per_screen_landscape', default=1)
    c.add_opt('cols_per_screen_migrated', default=False, action='store_true')
    c.add_opt('use_book_margins', default=False, action='store_true')
    c.add_opt('top_margin', default=20)
    c.add_opt('side_margin', default=40)
    c.add_opt('bottom_margin', default=20)
    c.add_opt('text_color', default=None)
    c.add_opt('background_color', default=None)
    c.add_opt('show_controls', default=True)

    fonts = c.add_group('FONTS', _('Font options'))
    fonts('serif_family', default='Times New Roman' if iswindows else 'Liberation Serif',
          help=_('The serif font family'))
    fonts('sans_family', default='Verdana' if iswindows else 'Liberation Sans',
          help=_('The sans-serif font family'))
    fonts('mono_family', default='Courier New' if iswindows else 'Liberation Mono',
          help=_('The monospaced font family'))
    fonts('default_font_size', default=20, help=_('The standard font size in px'))
    fonts('mono_font_size', default=16, help=_('The monospaced font size in px'))
    fonts('standard_font', default='serif', help=_('The standard font type'))
    fonts('minimum_font_size', default=8, help=_('The minimum font size in px'))

    oparse = c.parse

    def parse():
        ans = oparse()
        if not ans.cols_per_screen_migrated:
            ans.cols_per_screen_portrait = ans.cols_per_screen_landscape = ans.cols_per_screen
        return ans
    c.parse = parse

    return c
开发者ID:AEliu,项目名称:calibre,代码行数:94,代码来源:config.py


注:本文中的calibre.utils.config.Config.add_group方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。