Exemple #1
0
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
Exemple #2
0
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
Exemple #3
0
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
Exemple #4
0
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.'))

    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