Get rid of configdata.SECTION_DESC

This commit is contained in:
Florian Bruhin 2017-06-16 10:49:58 +02:00
parent 624c6777ff
commit 82102279bc
3 changed files with 47 additions and 60 deletions

View File

@ -68,60 +68,6 @@ FIRST_COMMENT = r"""
"""
# FIXME:conf where to put those?
SECTION_DESC = {
'general': "General/miscellaneous options.",
'ui': "General options related to the user interface.",
'input': "Options related to input modes.",
'network': "Settings related to the network.",
'completion': "Options related to completion and command history.",
'tabs': "Configuration of the tab bar.",
'storage': "Settings related to cache and storage.",
'content': "Loaded plugins/scripts and allowed actions.",
'hints': "Hinting settings.",
'searchengines': (
"Definitions of search engines which can be used via the address "
"bar.\n"
"The searchengine named `DEFAULT` is used when "
"`general -> auto-search` is true and something else than a URL was "
"entered to be opened. Other search engines can be used by prepending "
"the search engine name to the search term, e.g. "
"`:open google qutebrowser`. The string `{}` will be replaced by the "
"search term, use `{{` and `}}` for literal `{`/`}` signs."),
'aliases': (
"Aliases for commands.\n"
"By default, no aliases are defined. Example which adds a new command "
"`:qtb` to open qutebrowsers website:\n\n"
"`qtb = open https://www.qutebrowser.org/`"),
'colors': (
"Colors used in the UI.\n"
"A value can be in one of the following format:\n\n"
" * `#RGB`/`#RRGGBB`/`#RRRGGGBBB`/`#RRRRGGGGBBBB`\n"
" * An SVG color name as specified in http://www.w3.org/TR/SVG/"
"types.html#ColorKeywords[the W3C specification].\n"
" * transparent (no color)\n"
" * `rgb(r, g, b)` / `rgba(r, g, b, a)` (values 0-255 or "
"percentages)\n"
" * `hsv(h, s, v)` / `hsva(h, s, v, a)` (values 0-255, hue 0-359)\n"
" * A gradient as explained in http://doc.qt.io/qt-5/"
"stylesheet-reference.html#list-of-property-types[the Qt "
"documentation] under ``Gradient''.\n\n"
"A *.system value determines the color system to use for color "
"interpolation between similarly-named *.start and *.stop entries, "
"regardless of how they are defined in the options. "
"Valid values are 'rgb', 'hsv', and 'hsl'.\n\n"
"The `hints.*` values are a special case as they're real CSS "
"colors, not Qt-CSS colors. There, for a gradient, you need to use "
"`-webkit-gradient`, see https://www.webkit.org/blog/175/introducing-"
"css-gradients/[the WebKit documentation]."),
'fonts': (
"Fonts used for the UI, with optional style/weight/size.\n\n"
" * Style: `normal`/`italic`/`oblique`\n"
" * Weight: `normal`, `bold`, `100`..`900`\n"
" * Size: _number_ `px`/`pt`"),
}
DEFAULT_FONT_SIZE = '10pt' if sys.platform == 'darwin' else '8pt'
# FIXME:conf what to do about this?
MONOSPACE = (' xos4 Terminus, Terminus, Monospace, '

View File

@ -9,7 +9,13 @@ aliases:
forbidden: ' '
valtype: Command
none_ok: true
desc: Command aliases FIXME
desc: >-
Aliases for commands.
By default, no aliases are defined. Example which adds a new command `:qtb`
to open qutebrowsers website:
`{qtb: open https://www.qutebrowser.org/}`
auto_search:
type:
@ -83,7 +89,14 @@ searchengines:
name: Dict
keytype: String
valtype: SearchEngineUrl
desc: FIXME
desc: >-
Definitions of search engines which can be used via the address bar.
The searchengine named `DEFAULT` is used when `general -> auto-search` is
true and something else than a URL was entered to be opened. Other search
engines can be used by prepending the search engine name to the search term,
e.g. `:open google qutebrowser`. The string `{}` will be replaced by the
search term, use `{{` and `}}` for literal `{`/`}` signs.
session_default_name:
type:

View File

@ -42,6 +42,8 @@ Config types can do different conversations:
This also validates whether the object is actually correct (type/value).
"""
# FIXME:conf show the type docstrings in the documentation
import re
import shlex
import codecs
@ -741,7 +743,7 @@ class Command(BaseType):
class ColorSystem(MappingType):
"""Color systems for interpolation."""
"""The color system to use for color interpolation."""
def __init__(self, none_ok=False):
super().__init__(
@ -762,7 +764,15 @@ class ColorSystem(MappingType):
class QtColor(BaseType):
"""Base class for QColor."""
"""A color value.
A value can be in one of the following formats:
* `#RGB`/`#RRGGBB`/`#RRRGGGBBB`/`#RRRRGGGGBBBB`
* An SVG color name as specified in
http://www.w3.org/TR/SVG/types.html#ColorKeywords[the W3C specification].
* transparent (no color)
"""
def to_py(self, value):
self._basic_py_validation(value, str)
@ -778,7 +788,20 @@ class QtColor(BaseType):
class QssColor(BaseType):
"""Color used in a Qt stylesheet."""
"""A color value supporting gradients.
A value can be in one of the following formats:
* `#RGB`/`#RRGGBB`/`#RRRGGGBBB`/`#RRRRGGGGBBBB`
* An SVG color name as specified in
http://www.w3.org/TR/SVG/types.html#ColorKeywords[the W3C specification].
* transparent (no color)
* `rgb(r, g, b)` / `rgba(r, g, b, a)` (values 0-255 or percentages)
* `hsv(h, s, v)` / `hsva(h, s, v, a)` (values 0-255, hue 0-359)
* A gradient as explained in
http://doc.qt.io/qt-5/stylesheet-reference.html#list-of-property-types[the Qt documentation]
under ``Gradient''
"""
def to_py(self, value):
self._basic_py_validation(value, str)
@ -800,7 +823,12 @@ class QssColor(BaseType):
class Font(BaseType):
"""Base class for a font value."""
"""A font family, with optional style/weight/size.
* Style: `normal`/`italic`/`oblique`
* Weight: `normal`, `bold`, `100`..`900`
* Size: _number_ `px`/`pt`
"""
font_regex = re.compile(r"""
^(