Make non-specialized config types String. Closes #1103

This commit is contained in:
Patric Schmitz 2015-11-09 09:12:13 +01:00 committed by Patric Schmitz
parent 75f9f2af8d
commit 2a705e2eb6
2 changed files with 101 additions and 179 deletions

View File

@ -209,18 +209,32 @@ def data(readonly=False):
"be used."), "be used."),
('new-instance-open-target', ('new-instance-open-target',
SettingValue(typ.NewInstanceOpenTarget(), 'tab'), SettingValue(typ.String(
valid_values=typ.ValidValues(
('tab', "Open a new tab in the existing "
"window and activate the window."),
('tab-bg', "Open a new background tab in the "
"existing window and activate the "
"window."),
('tab-silent', "Open a new tab in the existing "
"window without activating "
"the window."),
('tab-bg-silent', "Open a new background tab "
"in the existing window "
"without activating the "
"window."),
('window', "Open in a new window.")
)), 'tab'),
"How to open links in an existing instance if a new one is " "How to open links in an existing instance if a new one is "
"launched."), "launched."),
('log-javascript-console', ('log-javascript-console',
SettingValue( SettingValue(typ.String(
typ.String(
valid_values=typ.ValidValues( valid_values=typ.ValidValues(
('none', 'Not displayed'), ('none', 'Not displayed'),
('debug', 'Display in debug mode'), ('debug', 'Display in debug mode'),
('info', 'Display always'))), ('info', 'Display always')
'debug'), )), 'debug'),
"How to log javascript console messages."), "How to log javascript console messages."),
('save-session', ('save-session',
@ -351,7 +365,15 @@ def data(readonly=False):
"Value to send in the `accept-language` header."), "Value to send in the `accept-language` header."),
('referer-header', ('referer-header',
SettingValue(typ.Referer(), 'same-domain'), SettingValue(typ.String(
valid_values=typ.ValidValues(
('always', "Always send."),
('never', "Never send; this is not recommended,"
" as some sites may break."),
('same-domain', "Only send for the same domain."
" This will still protect your privacy, but"
" shouldn't break any sites.")
)), 'same-domain'),
"Send the Referer header"), "Send the Referer header"),
('user-agent', ('user-agent',
@ -385,7 +407,12 @@ def data(readonly=False):
"Automatically open completion when typing."), "Automatically open completion when typing."),
('download-path-suggestion', ('download-path-suggestion',
SettingValue(typ.DownloadPathSuggestion(), 'path'), SettingValue(typ.String(
valid_values=typ.ValidValues(
('path', "Show only the download path."),
('filename', "Show only download filename."),
('both', "Show download path and filename."))),
'path'),
"What to display in the download filename input."), "What to display in the download filename input."),
('timestamp-format', ('timestamp-format',
@ -458,7 +485,13 @@ def data(readonly=False):
"element is focused after page load."), "element is focused after page load."),
('forward-unbound-keys', ('forward-unbound-keys',
SettingValue(typ.ForwardUnboundKeys(), 'auto'), SettingValue(typ.String(
valid_values=typ.ValidValues(
('all', "Forward all unbound keys."),
('auto', "Forward unbound non-alphanumeric "
"keys."),
('none', "Don't forward any keys.")
)), 'auto'),
"Whether to forward unbound keys to the webview in normal mode."), "Whether to forward unbound keys to the webview in normal mode."),
('spatial-navigation', ('spatial-navigation',
@ -508,11 +541,26 @@ def data(readonly=False):
"How new tabs opened explicitly are positioned."), "How new tabs opened explicitly are positioned."),
('last-close', ('last-close',
SettingValue(typ.LastClose(), 'ignore'), SettingValue(typ.String(
valid_values=typ.ValidValues(
('ignore', "Don't do anything."),
('blank', "Load a blank page."),
('startpage', "Load the start page."),
('default-page', "Load the default page."),
('close', "Close the window.")
)), 'ignore'),
"Behavior when the last tab is closed."), "Behavior when the last tab is closed."),
('show', ('show',
SettingValue(typ.TabBarShow(), 'always'), SettingValue(typ.String(
valid_values=typ.ValidValues(
('always', "Always show the tab bar."),
('never', "Always hide the tab bar."),
('multiple', "Hide the tab bar if only one tab "
"is open."),
('switching', "Show the tab bar when switching "
"tabs.")
)), 'always'),
"When to show the tab bar"), "When to show the tab bar"),
('show-switching-delay', ('show-switching-delay',
@ -529,7 +577,12 @@ def data(readonly=False):
"Whether tabs should be movable."), "Whether tabs should be movable."),
('close-mouse-button', ('close-mouse-button',
SettingValue(typ.CloseButton(), 'middle'), SettingValue(typ.String(
valid_values=typ.ValidValues(
('right', "Close tabs on right-click."),
('middle', "Close tabs on middle-click."),
('none', "Don't close tabs using the mouse.")
)), 'middle'),
"On which mouse button to close tabs."), "On which mouse button to close tabs."),
('position', ('position',
@ -737,7 +790,16 @@ def data(readonly=False):
"local urls."), "local urls."),
('cookies-accept', ('cookies-accept',
SettingValue(typ.AcceptCookies(), 'no-3rdparty'), SettingValue(typ.String(
valid_values=typ.ValidValues(
('all', "Accept all cookies."),
('no-3rdparty', "Accept cookies from the same"
" origin only."),
('no-unknown-3rdparty', "Accept cookies from "
"the same origin only, unless a cookie is "
"already set for the domain."),
('never', "Don't accept cookies at all.")
)), 'no-3rdparty'),
"Control which cookies to accept."), "Control which cookies to accept."),
('cookies-store', ('cookies-store',
@ -785,7 +847,12 @@ def data(readonly=False):
"Opacity for hints."), "Opacity for hints."),
('mode', ('mode',
SettingValue(typ.HintMode(), 'letter'), SettingValue(typ.String(
valid_values=typ.ValidValues(
('number', "Use numeric hints."),
('letter', "Use the chars in the hints -> "
"chars setting.")
)), 'letter'),
"Mode to use for hints."), "Mode to use for hints."),
('chars', ('chars',

View File

@ -652,8 +652,8 @@ class ColorSystem(MappingType):
special = True special = True
def __init__(self): def __init__(self):
self.valid_values = \ self.valid_values = ValidValues(
ValidValues(('rgb', "Interpolate in the RGB color system."), ('rgb', "Interpolate in the RGB color system."),
('hsv', "Interpolate in the HSV color system."), ('hsv', "Interpolate in the HSV color system."),
('hsl', "Interpolate in the HSL color system."), ('hsl', "Interpolate in the HSL color system."),
('none', "Don't show a gradient.")) ('none', "Don't show a gradient."))
@ -1090,19 +1090,6 @@ class ShellCommand(BaseType):
return shlex.split(value) return shlex.split(value)
class HintMode(BaseType):
"""Base class for the hints -> mode setting."""
special = True
def __init__(self):
self.valid_values = \
ValidValues(('number', "Use numeric hints."),
('letter', "Use the chars in the hints -> "
"chars setting."))
class Proxy(BaseType): class Proxy(BaseType):
"""A proxy URL or special value.""" """A proxy URL or special value."""
@ -1110,8 +1097,8 @@ class Proxy(BaseType):
special = True special = True
def __init__(self): def __init__(self):
self.valid_values = \ self.valid_values = ValidValues(
ValidValues(('system', "Use the system wide proxy."), ('system', "Use the system wide proxy."),
('none', "Don't use any proxy")) ('none', "Don't use any proxy"))
PROXY_TYPES = { PROXY_TYPES = {
@ -1413,38 +1400,6 @@ class SelectOnRemove(MappingType):
} }
class LastClose(BaseType):
"""Behavior when the last tab is closed."""
special = True
def __init__(self):
self.valid_values = \
ValidValues(('ignore', "Don't do anything."),
('blank', "Load a blank page."),
('startpage', "Load the start page."),
('default-page', "Load the default page."),
('close', "Close the window."))
class AcceptCookies(BaseType):
"""Control which cookies to accept."""
special = True
def __init__(self):
self.valid_values = \
ValidValues(('all', "Accept all cookies."),
('no-3rdparty', "Accept cookies from the same"
" origin only."),
('no-unknown-3rdparty', "Accept cookies from "
"the same origin only, unless a cookie is "
"already set for the domain."),
('never', "Don't accept cookies at all."))
class ConfirmQuit(FlagList): class ConfirmQuit(FlagList):
"""Whether to display a confirmation when the window is closed.""" """Whether to display a confirmation when the window is closed."""
@ -1477,33 +1432,6 @@ class ConfirmQuit(FlagList):
value, "List cannot contain always!") value, "List cannot contain always!")
class ForwardUnboundKeys(BaseType):
"""Whether to forward unbound keys."""
special = True
def __init__(self):
self.valid_values = \
ValidValues(('all', "Forward all unbound keys."),
('auto', "Forward unbound non-alphanumeric "
"keys."),
('none', "Don't forward any keys."))
class CloseButton(BaseType):
"""Mouse button used to close tabs."""
special = True
def __init__(self):
self.valid_values = \
ValidValues(('right', "Close tabs on right-click."),
('middle', "Close tabs on middle-click."),
('none', "Don't close tabs using the mouse."))
class NewTabPosition(BaseType): class NewTabPosition(BaseType):
"""How new tabs are positioned.""" """How new tabs are positioned."""
@ -1511,8 +1439,8 @@ class NewTabPosition(BaseType):
special = True special = True
def __init__(self): def __init__(self):
self.valid_values = \ self.valid_values = ValidValues(
ValidValues(('left', "On the left of the current tab."), ('left', "On the left of the current tab."),
('right', "On the right of the current tab."), ('right', "On the right of the current tab."),
('first', "At the left end."), ('first', "At the left end."),
('last', "At the right end.")) ('last', "At the right end."))
@ -1525,8 +1453,8 @@ class IgnoreCase(Bool):
special = True special = True
def __init__(self): def __init__(self):
self.valid_values = \ self.valid_values = ValidValues(
ValidValues(('true', "Search case-insensitively"), ('true', "Search case-insensitively"),
('false', "Search case-sensitively"), ('false', "Search case-sensitively"),
('smart', "Search case-sensitively if there " ('smart', "Search case-sensitively if there "
"are capital chars")) "are capital chars"))
@ -1547,56 +1475,6 @@ class IgnoreCase(Bool):
super().validate(value) super().validate(value)
class NewInstanceOpenTarget(BaseType):
"""How to open links in an existing instance if a new one is launched."""
special = True
def __init__(self):
self.valid_values = \
ValidValues(('tab', "Open a new tab in the existing "
"window and activate the window."),
('tab-bg', "Open a new background tab in the "
"existing window and activate the "
"window."),
('tab-silent', "Open a new tab in the existing "
"window without activating "
"the window."),
('tab-bg-silent', "Open a new background tab "
"in the existing window "
"without activating the "
"window."),
('window', "Open in a new window."))
class DownloadPathSuggestion(BaseType):
"""How to format the question when downloading."""
special = True
def __init__(self):
self.valid_values = \
ValidValues(('path', "Show only the download path."),
('filename', "Show only download filename."),
('both', "Show download path and filename."))
class Referer(BaseType):
"""Send the Referer header."""
def __init__(self):
self.valid_values = \
ValidValues(('always', "Always send."),
('never', "Never send; this is not recommended,"
" as some sites may break."),
('same-domain', "Only send for the same domain."
" This will still protect your privacy, but"
" shouldn't break any sites."))
class UserAgent(BaseType): class UserAgent(BaseType):
"""The user agent to use.""" """The user agent to use."""
@ -1660,29 +1538,6 @@ class UserAgent(BaseType):
return out return out
class TabBarShow(BaseType):
"""When to show the tab bar."""
def __init__(self):
self.valid_values = \
ValidValues(('always', "Always show the tab bar."),
('never', "Always hide the tab bar."),
('multiple', "Hide the tab bar if only one tab "
"is open."),
('switching', "Show the tab bar when switching "
"tabs."))
class URLSegmentList(FlagList):
"""A list of URL segments."""
def __init__(self, none_ok=False):
super().__init__(none_ok)
self.valid_values = ValidValues('host', 'path', 'query', 'anchor')
class TimestampTemplate(BaseType): class TimestampTemplate(BaseType):
"""A strftime-like template for timestamps. """A strftime-like template for timestamps.