Exemplo n.º 1
0
def console_config():
    desc='Settings to control the calibre console'
    c = Config('console', desc)

    c.add_opt('theme', default='native', help='The color theme')
    c.add_opt('scrollback', default=10000,
            help='Max number of lines to keep in the scrollback buffer')

    return c
Exemplo n.º 2
0
def config(defaults=None):
    if defaults is None:
        c = Config('save_to_disk', _('Options to control saving to disk'))
    else:
        c = StringConfig(defaults)

    x = c.add_opt
    x('update_metadata', default=True,
            help=_('Normally, calibre will update the metadata in the saved files from what is'
            ' in the calibre library. Makes saving to disk slower.'))
    x('write_opf', default=True,
            help=_('Normally, calibre will write the metadata into a separate OPF file along with the'
                ' actual e-book files.'))
    x('save_cover', default=True,
            help=_('Normally, calibre will save the cover in a separate file along with the '
                'actual e-book file(s).'))
    x('formats', default='all',
            help=_('Comma separated list of formats to save for each book.'
                ' By default all available formats are saved.'))
    x('template', default=DEFAULT_TEMPLATE,
            help=_('The template to control the filename and directory structure of the saved files. '
                'Default is "%(templ)s" which will save books into a per-author '
                'subdirectory with filenames containing title and author. '
                'Available controls are: {%(controls)s}')%dict(
                    templ=DEFAULT_TEMPLATE, controls=', '.join(sorted(FORMAT_ARGS))))
    x('send_template', default=DEFAULT_SEND_TEMPLATE,
            help=_('The template to control the filename and directory structure of files '
                'sent to the device. '
                'Default is "%(templ)s" which will save books into a per-author '
                'directory with filenames containing title and author. '
                'Available controls are: {%(controls)s}')%dict(
                    templ=DEFAULT_SEND_TEMPLATE, controls=', '.join(FORMAT_ARGS)))
    x('asciiize', default=True,
            help=_('Normally, calibre will convert all non English characters into English equivalents '
                'for the file names. '
                'WARNING: If you turn this off, you may experience errors when '
                'saving, depending on how well the filesystem you are saving '
                'to supports unicode.'))
    x('timefmt', default='%b, %Y',
            help=_('The format in which to display dates. %(day)s - day,'
                ' %(month)s - month, %(mn)s - month number, %(year)s - year. Default is: %(default)s'
                )%dict(day='%d', month='%b', mn='%m', year='%Y', default='%b, %Y'))
    x('send_timefmt', default='%b, %Y',
            help=_('The format in which to display dates. %(day)s - day,'
                ' %(month)s - month, %(mn)s - month number, %(year)s - year. Default is: %(default)s'
                )%dict(day='%d', month='%b', mn='%m', year='%Y', default='%b, %Y'))
    x('to_lowercase', default=False,
            help=_('Convert paths to lowercase.'))
    x('replace_whitespace', default=False,
            help=_('Replace whitespace with underscores.'))
    x('single_dir', default=False,
            help=_('Save into a single directory, ignoring the template'
                ' directory structure'))
    return c
Exemplo n.º 3
0
def console_config():
    desc = 'Settings to control the calibre console'
    c = Config('console', desc)

    c.add_opt('theme', default='native', help='The color theme')
    c.add_opt('scrollback',
              default=10000,
              help='Max number of lines to keep in the scrollback buffer')

    return c
Exemplo n.º 4
0
def _config():
    c = Config('customize')
    c.add_opt('plugins', default={}, help=_('Installed plugins'))
    c.add_opt('filetype_mapping',
              default={},
              help=_('Mapping for filetype plugins'))
    c.add_opt('plugin_customization',
              default={},
              help=_('Local plugin customization'))
    c.add_opt('disabled_plugins', default=set([]), help=_('Disabled plugins'))
    c.add_opt('enabled_plugins', default=set([]), help=_('Enabled plugins'))

    return ConfigProxy(c)
Exemplo n.º 5
0
Arquivo: ui.py Projeto: rakyi/calibre
def _config():
    c = Config('customize')
    c.add_opt('plugins', default={}, help=_('Installed plugins'))
    c.add_opt('filetype_mapping', default={}, help=_('Mapping for filetype plugins'))
    c.add_opt('plugin_customization', default={}, help=_('Local plugin customization'))
    c.add_opt('disabled_plugins', default=set([]), help=_('Disabled plugins'))
    c.add_opt('enabled_plugins', default=set([]), help=_('Enabled plugins'))

    return ConfigProxy(c)
Exemplo n.º 6
0
def _config():  # {{{
    c = Config('gui', 'preferences for the calibre GUI')
    c.add_opt('send_to_storage_card_by_default', default=False,
              help=_('Send file to storage card instead of main memory by default'))
    c.add_opt('confirm_delete', default=False,
              help=_('Confirm before deleting'))
    c.add_opt('main_window_geometry', default=None,
              help=_('Main window geometry'))  # value QVariant.toByteArray
    c.add_opt('new_version_notification', default=True,
              help=_('Notify when a new version is available'))
    c.add_opt('use_roman_numerals_for_series_number', default=True,
              help=_('Use Roman numerals for series number'))
    c.add_opt('sort_tags_by', default='name',
              help=_('Sort tags list by name, popularity, or rating'))
    c.add_opt('match_tags_type', default='any',
              help=_('Match tags by any or all.'))
    c.add_opt('cover_flow_queue_length', default=6,
              help=_('Number of covers to show in the cover browsing mode'))
    c.add_opt('LRF_conversion_defaults', default=[],
              help=_('Defaults for conversion to LRF'))
    c.add_opt('LRF_ebook_viewer_options', default=None,
              help=_('Options for the LRF ebook viewer'))
    c.add_opt('internally_viewed_formats', default=['LRF', 'EPUB', 'LIT',
        'MOBI', 'PRC', 'POBI', 'AZW', 'AZW3', 'HTML', 'FB2', 'PDB', 'RB',
        'SNB', 'HTMLZ', 'KEPUB'], help=_(
            'Formats that are viewed using the internal viewer'))
    c.add_opt('column_map', default=ALL_COLUMNS,
              help=_('Columns to be displayed in the book list'))
    c.add_opt('autolaunch_server', default=False, help=_('Automatically launch content server on application startup'))
    c.add_opt('oldest_news', default=60, help=_('Oldest news kept in database'))
    c.add_opt('systray_icon', default=False, help=_('Show system tray icon'))
    c.add_opt('upload_news_to_device', default=True,
              help=_('Upload downloaded news to device'))
    c.add_opt('delete_news_from_library_on_upload', default=False,
              help=_('Delete news books from library after uploading to device'))
    c.add_opt('separate_cover_flow', default=False,
              help=_('Show the cover flow in a separate window instead of in the main calibre window'))
    c.add_opt('disable_tray_notification', default=False,
              help=_('Disable notifications from the system tray icon'))
    c.add_opt('default_send_to_device_action', default=None,
            help=_('Default action to perform when send to device button is '
                'clicked'))
    c.add_opt('asked_library_thing_password', default=False,
            help='Asked library thing password at least once.')
    c.add_opt('search_as_you_type', default=False,
            help=_('Start searching as you type. If this is disabled then search will '
            'only take place when the Enter or Return key is pressed.'))
    c.add_opt('highlight_search_matches', default=False,
            help=_('When searching, show all books with search results '
            'highlighted instead of showing only the matches. You can use the '
            'N or F3 keys to go to the next match.'))
    c.add_opt('save_to_disk_template_history', default=[],
        help='Previously used Save to Disk templates')
    c.add_opt('send_to_device_template_history', default=[],
        help='Previously used Send to Device templates')
    c.add_opt('main_search_history', default=[],
        help='Search history for the main GUI')
    c.add_opt('viewer_search_history', default=[],
        help='Search history for the ebook viewer')
    c.add_opt('lrf_viewer_search_history', default=[],
        help='Search history for the LRF viewer')
    c.add_opt('scheduler_search_history', default=[],
        help='Search history for the recipe scheduler')
    c.add_opt('plugin_search_history', default=[],
        help='Search history for the plugin preferences')
    c.add_opt('shortcuts_search_history', default=[],
        help='Search history for the keyboard preferences')
    c.add_opt('jobs_search_history', default=[],
        help='Search history for the tweaks preferences')
    c.add_opt('tweaks_search_history', default=[],
        help='Search history for tweaks')
    c.add_opt('worker_limit', default=6,
            help=_(
        'Maximum number of simultaneous conversion/news download jobs. '
        'This number is twice the actual value for historical reasons.'))
    c.add_opt('get_social_metadata', default=True,
            help=_('Download social metadata (tags/rating/etc.)'))
    c.add_opt('overwrite_author_title_metadata', default=True,
            help=_('Overwrite author and title with new metadata'))
    c.add_opt('auto_download_cover', default=False,
            help=_('Automatically download the cover, if available'))
    c.add_opt('enforce_cpu_limit', default=True,
            help=_('Limit max simultaneous jobs to number of CPUs'))
    c.add_opt('gui_layout', choices=['wide', 'narrow'],
            help=_('The layout of the user interface. Wide has the '
                'book details panel on the right and narrow has '
                'it at the bottom.'), default='wide')
    c.add_opt('show_avg_rating', default=True,
            help=_('Show the average rating per item indication in the tag browser'))
    c.add_opt('disable_animations', default=False,
            help=_('Disable UI animations'))

    # This option is no longer used. It remains for compatibility with upgrades
    # so the value can be migrated
    c.add_opt('tag_browser_hidden_categories', default=set(),
            help=_('tag browser categories not to display'))

    c.add_opt
    return ConfigProxy(c)
Exemplo n.º 7
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
Exemplo n.º 8
0
def config(defaults=None):
    desc = _('Options to control the ebook viewer')
    if defaults is None:
        c = Config('viewer', desc)
    else:
        c = StringConfig(defaults, desc)

    c.add_opt('raise_window', ['--raise-window'], default=False,
              help=_('If specified, viewer window will try to come to the '
                     'front when started.'))
    c.add_opt('full_screen', ['--full-screen', '--fullscreen', '-f'], default=False,
              help=_('If specified, viewer window will try to open '
                     'full screen when started.'))
    c.add_opt('remember_window_size', default=False,
        help=_('Remember last used window size'))
    c.add_opt('debug_javascript', ['--debug-javascript'], default=False,
        help=_('Print javascript alert and console messages to the console'))
    c.add_opt('open_at', ['--open-at'], default=None,
        help=_('The position at which to open the specified book. The position is '
            'a location as displayed in the top left corner of the viewer.'))

    return c
Exemplo n.º 9
0
 def _config(cls):
     name = cls._config_base_name()
     c = Config('device_drivers_%s' % name,
                _('settings for device drivers'))
     c.add_opt('format_map',
               default=cls.FORMATS,
               help=_('Ordered list of formats the device will accept'))
     c.add_opt(
         'use_subdirs',
         default=cls.SUPPORTS_SUB_DIRS_DEFAULT,
         help=_(
             'Place files in sub directories if the device supports them'))
     c.add_opt('read_metadata',
               default=True,
               help=_('Read metadata from files on device'))
     c.add_opt('use_author_sort',
               default=False,
               help=_('Use author sort instead of author'))
     c.add_opt('save_template',
               default=cls._default_save_template(),
               help=_('Template to control how books are saved'))
     c.add_opt('extra_customization',
               default=cls.EXTRA_CUSTOMIZATION_DEFAULT,
               help=_('Extra customization'))
     return c
Exemplo n.º 10
0
def _config():  # {{{
    c = Config('gui', 'preferences for the calibre GUI')
    c.add_opt('send_to_storage_card_by_default', default=False,
              help=_('Send file to storage card instead of main memory by default'))
    c.add_opt('confirm_delete', default=False,
              help=_('Confirm before deleting'))
    c.add_opt('main_window_geometry', default=None,
              help=_('Main window geometry'))
    c.add_opt('new_version_notification', default=True,
              help=_('Notify when a new version is available'))
    c.add_opt('use_roman_numerals_for_series_number', default=True,
              help=_('Use Roman numerals for series number'))
    c.add_opt('sort_tags_by', default='name',
              help=_('Sort tags list by name, popularity, or rating'))
    c.add_opt('match_tags_type', default='any',
              help=_('Match tags by any or all.'))
    c.add_opt('cover_flow_queue_length', default=6,
              help=_('Number of covers to show in the cover browsing mode'))
    c.add_opt('LRF_conversion_defaults', default=[],
              help=_('Defaults for conversion to LRF'))
    c.add_opt('LRF_ebook_viewer_options', default=None,
              help=_('Options for the LRF ebook viewer'))
    c.add_opt('internally_viewed_formats', default=['LRF', 'EPUB', 'LIT',
        'MOBI', 'PRC', 'POBI', 'AZW', 'AZW3', 'HTML', 'FB2', 'PDB', 'RB',
        'SNB', 'HTMLZ', 'KEPUB'], help=_(
            'Formats that are viewed using the internal viewer'))
    c.add_opt('column_map', default=ALL_COLUMNS,
              help=_('Columns to be displayed in the book list'))
    c.add_opt('autolaunch_server', default=False, help=_('Automatically launch content server on application startup'))
    c.add_opt('oldest_news', default=60, help=_('Oldest news kept in database'))
    c.add_opt('systray_icon', default=False, help=_('Show system tray icon'))
    c.add_opt('upload_news_to_device', default=True,
              help=_('Upload downloaded news to device'))
    c.add_opt('delete_news_from_library_on_upload', default=False,
              help=_('Delete news books from library after uploading to device'))
    c.add_opt('separate_cover_flow', default=False,
              help=_('Show the cover flow in a separate window instead of in the main calibre window'))
    c.add_opt('disable_tray_notification', default=False,
              help=_('Disable notifications from the system tray icon'))
    c.add_opt('default_send_to_device_action', default=None,
            help=_('Default action to perform when send to device button is '
                'clicked'))
    c.add_opt('asked_library_thing_password', default=False,
            help='Asked library thing password at least once.')
    c.add_opt('search_as_you_type', default=False,
            help=_('Start searching as you type. If this is disabled then search will '
            'only take place when the Enter or Return key is pressed.'))
    c.add_opt('highlight_search_matches', default=False,
            help=_('When searching, show all books with search results '
            'highlighted instead of showing only the matches. You can use the '
            'N or F3 keys to go to the next match.'))
    c.add_opt('save_to_disk_template_history', default=[],
        help='Previously used Save to Disk templates')
    c.add_opt('send_to_device_template_history', default=[],
        help='Previously used Send to Device templates')
    c.add_opt('main_search_history', default=[],
        help='Search history for the main GUI')
    c.add_opt('viewer_search_history', default=[],
        help='Search history for the ebook viewer')
    c.add_opt('viewer_toc_search_history', default=[],
        help='Search history for the ToC in the ebook viewer')
    c.add_opt('lrf_viewer_search_history', default=[],
        help='Search history for the LRF viewer')
    c.add_opt('scheduler_search_history', default=[],
        help='Search history for the recipe scheduler')
    c.add_opt('plugin_search_history', default=[],
        help='Search history for the plugin preferences')
    c.add_opt('shortcuts_search_history', default=[],
        help='Search history for the keyboard preferences')
    c.add_opt('jobs_search_history', default=[],
        help='Search history for the tweaks preferences')
    c.add_opt('tweaks_search_history', default=[],
        help='Search history for tweaks')
    c.add_opt('worker_limit', default=6,
            help=_(
        'Maximum number of simultaneous conversion/news download jobs. '
        'This number is twice the actual value for historical reasons.'))
    c.add_opt('get_social_metadata', default=True,
            help=_('Download social metadata (tags/rating/etc.)'))
    c.add_opt('overwrite_author_title_metadata', default=True,
            help=_('Overwrite author and title with new metadata'))
    c.add_opt('auto_download_cover', default=False,
            help=_('Automatically download the cover, if available'))
    c.add_opt('enforce_cpu_limit', default=True,
            help=_('Limit max simultaneous jobs to number of CPUs'))
    c.add_opt('gui_layout', choices=['wide', 'narrow'],
            help=_('The layout of the user interface. Wide has the '
                'book details panel on the right and narrow has '
                'it at the bottom.'), default='wide')
    c.add_opt('show_avg_rating', default=True,
            help=_('Show the average rating per item indication in the tag browser'))
    c.add_opt('disable_animations', default=False,
            help=_('Disable UI animations'))

    # This option is no longer used. It remains for compatibility with upgrades
    # so the value can be migrated
    c.add_opt('tag_browser_hidden_categories', default=set(),
            help=_('tag browser categories not to display'))

    c.add_opt
    return ConfigProxy(c)
Exemplo n.º 11
0
def _config():  # {{{
    c = Config("gui", "preferences for the calibre GUI")
    c.add_opt(
        "send_to_storage_card_by_default",
        default=False,
        help=_("Send file to storage card instead of main memory by default"),
    )
    c.add_opt("confirm_delete", default=False, help=_("Confirm before deleting"))
    c.add_opt("main_window_geometry", default=None, help=_("Main window geometry"))  # value QVariant.toByteArray
    c.add_opt("new_version_notification", default=True, help=_("Notify when a new version is available"))
    c.add_opt("use_roman_numerals_for_series_number", default=True, help=_("Use Roman numerals for series number"))
    c.add_opt("sort_tags_by", default="name", help=_("Sort tags list by name, popularity, or rating"))
    c.add_opt("match_tags_type", default="any", help=_("Match tags by any or all."))
    c.add_opt("cover_flow_queue_length", default=6, help=_("Number of covers to show in the cover browsing mode"))
    c.add_opt("LRF_conversion_defaults", default=[], help=_("Defaults for conversion to LRF"))
    c.add_opt("LRF_ebook_viewer_options", default=None, help=_("Options for the LRF ebook viewer"))
    c.add_opt(
        "internally_viewed_formats",
        default=[
            "LRF",
            "EPUB",
            "LIT",
            "MOBI",
            "PRC",
            "POBI",
            "AZW",
            "AZW3",
            "HTML",
            "FB2",
            "PDB",
            "RB",
            "SNB",
            "HTMLZ",
        ],
        help=_("Formats that are viewed using the internal viewer"),
    )
    c.add_opt("column_map", default=ALL_COLUMNS, help=_("Columns to be displayed in the book list"))
    c.add_opt("autolaunch_server", default=False, help=_("Automatically launch content server on application startup"))
    c.add_opt("oldest_news", default=60, help=_("Oldest news kept in database"))
    c.add_opt("systray_icon", default=False, help=_("Show system tray icon"))
    c.add_opt("upload_news_to_device", default=True, help=_("Upload downloaded news to device"))
    c.add_opt(
        "delete_news_from_library_on_upload",
        default=False,
        help=_("Delete news books from library after uploading to device"),
    )
    c.add_opt(
        "separate_cover_flow",
        default=False,
        help=_("Show the cover flow in a separate window instead of in the main calibre window"),
    )
    c.add_opt("disable_tray_notification", default=False, help=_("Disable notifications from the system tray icon"))
    c.add_opt(
        "default_send_to_device_action",
        default=None,
        help=_("Default action to perform when send to device button is " "clicked"),
    )
    c.add_opt("asked_library_thing_password", default=False, help="Asked library thing password at least once.")
    c.add_opt(
        "search_as_you_type",
        default=False,
        help=_(
            "Start searching as you type. If this is disabled then search will "
            "only take place when the Enter or Return key is pressed."
        ),
    )
    c.add_opt(
        "highlight_search_matches",
        default=False,
        help=_(
            "When searching, show all books with search results "
            "highlighted instead of showing only the matches. You can use the "
            "N or F3 keys to go to the next match."
        ),
    )
    c.add_opt("save_to_disk_template_history", default=[], help="Previously used Save to Disk templates")
    c.add_opt("send_to_device_template_history", default=[], help="Previously used Send to Device templates")
    c.add_opt("main_search_history", default=[], help="Search history for the main GUI")
    c.add_opt("viewer_search_history", default=[], help="Search history for the ebook viewer")
    c.add_opt("lrf_viewer_search_history", default=[], help="Search history for the LRF viewer")
    c.add_opt("scheduler_search_history", default=[], help="Search history for the recipe scheduler")
    c.add_opt("plugin_search_history", default=[], help="Search history for the plugin preferences")
    c.add_opt("shortcuts_search_history", default=[], help="Search history for the keyboard preferences")
    c.add_opt("jobs_search_history", default=[], help="Search history for the tweaks preferences")
    c.add_opt("tweaks_search_history", default=[], help="Search history for tweaks")
    c.add_opt(
        "worker_limit",
        default=6,
        help=_(
            "Maximum number of simultaneous conversion/news download jobs. "
            "This number is twice the actual value for historical reasons."
        ),
    )
    c.add_opt("get_social_metadata", default=True, help=_("Download social metadata (tags/rating/etc.)"))
    c.add_opt("overwrite_author_title_metadata", default=True, help=_("Overwrite author and title with new metadata"))
    c.add_opt("auto_download_cover", default=False, help=_("Automatically download the cover, if available"))
    c.add_opt("enforce_cpu_limit", default=True, help=_("Limit max simultaneous jobs to number of CPUs"))
    c.add_opt(
        "gui_layout",
        choices=["wide", "narrow"],
        help=_(
            "The layout of the user interface. Wide has the "
            "book details panel on the right and narrow has "
            "it at the bottom."
        ),
        default="wide",
    )
    c.add_opt("show_avg_rating", default=True, help=_("Show the average rating per item indication in the tag browser"))
    c.add_opt("disable_animations", default=False, help=_("Disable UI animations"))

    # This option is no longer used. It remains for compatibility with upgrades
    # so the value can be migrated
    c.add_opt("tag_browser_hidden_categories", default=set(), help=_("tag browser categories not to display"))

    c.add_opt
    return ConfigProxy(c)
Exemplo n.º 12
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
Exemplo n.º 13
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
Exemplo n.º 14
0
def config(defaults=None):
    from calibre.utils.config import Config, StringConfig
    desc = _('Control email delivery')
    c = Config('smtp',desc) if defaults is None else StringConfig(defaults,desc)
    c.add_opt('from_')
    c.add_opt('accounts', default={})
    c.add_opt('subjects', default={})
    c.add_opt('aliases', default={})
    c.add_opt('tags', default={})
    c.add_opt('relay_host')
    c.add_opt('relay_port', default=25)
    c.add_opt('relay_username')
    c.add_opt('relay_password')
    c.add_opt('encryption', default='TLS', choices=['TLS', 'SSL'])
    return c
Exemplo n.º 15
0
def server_config(defaults=None):
    desc=_('Settings to control the calibre content server')
    c = Config('server', desc) if defaults is None else StringConfig(defaults, desc)

    c.add_opt('port', ['-p', '--port'], default=8080,
              help=_('The port on which to listen. Default is %default'))
    c.add_opt('timeout', ['-t', '--timeout'], default=120,
              help=_('The server timeout in seconds. Default is %default'))
    c.add_opt('thread_pool', ['--thread-pool'], default=30,
              help=_('The max number of worker threads to use. Default is %default'))
    c.add_opt('password', ['--password'], default=None,
              help=_('Set a password to restrict access. By default access is unrestricted.'))
    c.add_opt('username', ['--username'], default='calibre',
              help=_('Username for access. By default, it is: %default'))
    c.add_opt('develop', ['--develop'], default=False,
              help='Development mode. Server automatically restarts on file changes and serves code files (html, css, js) from the file system instead of calibre\'s resource system.')
    c.add_opt('max_cover', ['--max-cover'], default='600x800',
              help=_('The maximum size for displayed covers. Default is %default.'))
    c.add_opt('max_opds_items', ['--max-opds-items'], default=30,
            help=_('The maximum number of matches to return per OPDS query. '
            'This affects Stanza, WordPlayer, etc. integration.'))
    c.add_opt('max_opds_ungrouped_items', ['--max-opds-ungrouped-items'],
            default=100,
            help=_('Group items in categories such as author/tags '
                'by first letter when there are more than this number '
                'of items. Default: %default. Set to a large number '
                'to disable grouping.'))
    c.add_opt('url_prefix', ['--url-prefix'], default='',
              help=_('Prefix to prepend to all URLs. Useful for reverse'
                  'proxying to this server from Apache/nginx/etc.'))

    return c
Exemplo n.º 16
0
def config(defaults=None):
    desc = _("Options to control the ebook viewer")
    if defaults is None:
        c = Config("viewer", desc)
    else:
        c = StringConfig(defaults, desc)

    c.add_opt(
        "raise_window",
        ["--raise-window"],
        default=False,
        help=_("If specified, viewer window will try to come to the " "front when started."),
    )
    c.add_opt(
        "full_screen",
        ["--full-screen", "--fullscreen", "-f"],
        default=False,
        help=_("If specified, viewer window will try to open " "full screen when started."),
    )
    c.add_opt("remember_window_size", default=False, help=_("Remember last used window size"))
    c.add_opt(
        "debug_javascript",
        ["--debug-javascript"],
        default=False,
        help=_("Print javascript alert and console messages to the console"),
    )
    c.add_opt(
        "open_at",
        ["--open-at"],
        default=None,
        help=_(
            "The position at which to open the specified book. The position is "
            "a location as displayed in the top left corner of the viewer."
        ),
    )
    c.add_opt(
        "continue_reading", ["--continue"], default=False, help=_("Continue reading at the previously opened book")
    )

    return c
Exemplo n.º 17
0
 def _config(cls):
     name = cls._config_base_name()
     c = Config('device_drivers_%s' % name, _('settings for device drivers'))
     c.add_opt('format_map', default=cls.FORMATS,
             help=_('Ordered list of formats the device will accept'))
     c.add_opt('use_subdirs', default=cls.SUPPORTS_SUB_DIRS_DEFAULT,
             help=_('Place files in sub directories if the device supports them'))
     c.add_opt('read_metadata', default=True,
             help=_('Read metadata from files on device'))
     c.add_opt('use_author_sort', default=False,
             help=_('Use author sort instead of author'))
     c.add_opt('save_template', default=cls._default_save_template(),
             help=_('Template to control how books are saved'))
     c.add_opt('extra_customization',
             default=cls.EXTRA_CUSTOMIZATION_DEFAULT,
             help=_('Extra customization'))
     return c
Exemplo n.º 18
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
Exemplo n.º 19
0
def _config():
    c = Config("customize")
    c.add_opt("plugins", default={}, help=_("Installed plugins"))
    c.add_opt("filetype_mapping", default={}, help=_("Mapping for filetype plugins"))
    c.add_opt("plugin_customization", default={}, help=_("Local plugin customization"))
    c.add_opt("disabled_plugins", default=set([]), help=_("Disabled plugins"))
    c.add_opt("enabled_plugins", default=set([]), help=_("Enabled plugins"))

    return ConfigProxy(c)
Exemplo n.º 20
0
def config(defaults=None):
    from calibre.utils.config import Config, StringConfig
    desc = _('Control email delivery')
    c = Config('smtp', desc) if defaults is None else StringConfig(
        defaults, desc)
    c.add_opt('from_')
    c.add_opt('accounts', default={})
    c.add_opt('subjects', default={})
    c.add_opt('aliases', default={})
    c.add_opt('tags', default={})
    c.add_opt('relay_host')
    c.add_opt('relay_port', default=25)
    c.add_opt('relay_username')
    c.add_opt('relay_password')
    c.add_opt('encryption', default='TLS', choices=['TLS', 'SSL'])
    return c
Exemplo n.º 21
0
def server_config(defaults=None):
    desc = _('Settings to control the calibre content server')
    c = Config('server', desc) if defaults is None else StringConfig(
        defaults, desc)

    c.add_opt('port', ['-p', '--port'],
              default=8080,
              help=_('The port on which to listen. Default is %default'))
    c.add_opt('timeout', ['-t', '--timeout'],
              default=120,
              help=_('The server timeout in seconds. Default is %default'))
    c.add_opt(
        'thread_pool', ['--thread-pool'],
        default=30,
        help=_('The max number of worker threads to use. Default is %default'))
    c.add_opt(
        'password', ['--password'],
        default=None,
        help=
        _('Set a password to restrict access. By default access is unrestricted.'
          ))
    c.add_opt('username', ['--username'],
              default='calibre',
              help=_('Username for access. By default, it is: %default'))
    c.add_opt(
        'develop', ['--develop'],
        default=False,
        help=
        'Development mode. Server automatically restarts on file changes and serves code files (html, css, js) from the file system instead of calibre\'s resource system.'
    )
    c.add_opt(
        'max_cover', ['--max-cover'],
        default='600x800',
        help=_('The maximum size for displayed covers. Default is %default.'))
    c.add_opt('max_opds_items', ['--max-opds-items'],
              default=30,
              help=_('The maximum number of matches to return per OPDS query. '
                     'This affects Stanza, WordPlayer, etc. integration.'))
    c.add_opt('max_opds_ungrouped_items', ['--max-opds-ungrouped-items'],
              default=100,
              help=_('Group items in categories such as author/tags '
                     'by first letter when there are more than this number '
                     'of items. Default: %default. Set to a large number '
                     'to disable grouping.'))
    c.add_opt('url_prefix', ['--url-prefix'],
              default='',
              help=_('Prefix to prepend to all URLs. Useful for reverse'
                     'proxying to this server from Apache/nginx/etc.'))

    return c