style changes
This commit is contained in:
parent
6f65397dfe
commit
c322130dc0
@ -242,7 +242,10 @@ def data(readonly=False):
|
|||||||
"last loaded session."),
|
"last loaded session."),
|
||||||
|
|
||||||
('url-incdec-segments',
|
('url-incdec-segments',
|
||||||
SettingValue(typ.URLSegmentList(), 'path,query'),
|
SettingValue(
|
||||||
|
typ.FlagList(valid_values=typ.ValidValues(
|
||||||
|
'host', 'path', 'query', 'anchor')),
|
||||||
|
'path,query'),
|
||||||
"The URL segments where `:navigate increment/decrement` will "
|
"The URL segments where `:navigate increment/decrement` will "
|
||||||
"search for a number."),
|
"search for a number."),
|
||||||
|
|
||||||
@ -402,12 +405,12 @@ def data(readonly=False):
|
|||||||
"Automatically open completion when typing."),
|
"Automatically open completion when typing."),
|
||||||
|
|
||||||
('download-path-suggestion',
|
('download-path-suggestion',
|
||||||
SettingValue(typ.String(
|
SettingValue(
|
||||||
valid_values=typ.ValidValues(
|
typ.String(valid_values=typ.ValidValues(
|
||||||
('path', "Show only the download path."),
|
('path', "Show only the download path."),
|
||||||
('filename', "Show only download filename."),
|
('filename', "Show only download filename."),
|
||||||
('both', "Show download path and filename."))),
|
('both', "Show download path and filename."))),
|
||||||
'path'),
|
'path'),
|
||||||
"What to display in the download filename input."),
|
"What to display in the download filename input."),
|
||||||
|
|
||||||
('timestamp-format',
|
('timestamp-format',
|
||||||
@ -547,14 +550,14 @@ def data(readonly=False):
|
|||||||
"Behavior when the last tab is closed."),
|
"Behavior when the last tab is closed."),
|
||||||
|
|
||||||
('show',
|
('show',
|
||||||
SettingValue(typ.String(
|
SettingValue(
|
||||||
valid_values=typ.ValidValues(
|
typ.String(valid_values=typ.ValidValues(
|
||||||
('always', "Always show the tab bar."),
|
('always', "Always show the tab bar."),
|
||||||
('never', "Always hide the tab bar."),
|
('never', "Always hide the tab bar."),
|
||||||
('multiple', "Hide the tab bar if only one tab "
|
('multiple', "Hide the tab bar if only one tab "
|
||||||
"is open."),
|
"is open."),
|
||||||
('switching', "Show the tab bar when switching "
|
('switching', "Show the tab bar when switching "
|
||||||
"tabs.")
|
"tabs.")
|
||||||
)), 'always'),
|
)), 'always'),
|
||||||
"When to show the tab bar"),
|
"When to show the tab bar"),
|
||||||
|
|
||||||
|
@ -219,7 +219,7 @@ class MappingType(BaseType):
|
|||||||
def __init__(self, none_ok=False,
|
def __init__(self, none_ok=False,
|
||||||
valid_values=None):
|
valid_values=None):
|
||||||
super().__init__(none_ok)
|
super().__init__(none_ok)
|
||||||
self.valid_values = valid_values;
|
self.valid_values = valid_values
|
||||||
if list(sorted(self.MAPPING)) != list(sorted(self.valid_values)):
|
if list(sorted(self.MAPPING)) != list(sorted(self.valid_values)):
|
||||||
raise ValueError("Mapping {!r} doesn't match valid values "
|
raise ValueError("Mapping {!r} doesn't match valid values "
|
||||||
"{!r}".format(self.MAPPING, self.valid_values))
|
"{!r}".format(self.MAPPING, self.valid_values))
|
||||||
@ -284,6 +284,10 @@ class List(BaseType):
|
|||||||
|
|
||||||
"""Base class for a (string-)list setting."""
|
"""Base class for a (string-)list setting."""
|
||||||
|
|
||||||
|
def __init__(self, none_ok=False, valid_values=None):
|
||||||
|
super().__init__(none_ok)
|
||||||
|
self.valid_values = valid_values
|
||||||
|
|
||||||
def transform(self, value):
|
def transform(self, value):
|
||||||
if not value:
|
if not value:
|
||||||
return None
|
return None
|
||||||
@ -309,6 +313,9 @@ class FlagList(List):
|
|||||||
|
|
||||||
combinable_values = None
|
combinable_values = None
|
||||||
|
|
||||||
|
def __init__(self, none_ok=False, valid_values=None):
|
||||||
|
super().__init__(none_ok, valid_values)
|
||||||
|
|
||||||
def validate(self, value):
|
def validate(self, value):
|
||||||
self._basic_validation(value)
|
self._basic_validation(value)
|
||||||
if not value:
|
if not value:
|
||||||
@ -662,12 +669,12 @@ class ColorSystem(MappingType):
|
|||||||
def __init__(self, none_ok=False):
|
def __init__(self, none_ok=False):
|
||||||
super().__init__(
|
super().__init__(
|
||||||
none_ok,
|
none_ok,
|
||||||
valid_values = ValidValues(
|
valid_values=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.")))
|
||||||
|
|
||||||
MAPPING = {
|
MAPPING = {
|
||||||
'rgb': QColor.Rgb,
|
'rgb': QColor.Rgb,
|
||||||
'hsv': QColor.Hsv,
|
'hsv': QColor.Hsv,
|
||||||
@ -1220,10 +1227,12 @@ class FuzzyUrl(BaseType):
|
|||||||
|
|
||||||
PaddingValues = collections.namedtuple('PaddingValues', ['top', 'bottom',
|
PaddingValues = collections.namedtuple('PaddingValues', ['top', 'bottom',
|
||||||
'left', 'right'])
|
'left', 'right'])
|
||||||
|
|
||||||
|
|
||||||
class Padding(IntList):
|
class Padding(IntList):
|
||||||
|
|
||||||
"""Setting for paddings around elements."""
|
"""Setting for paddings around elements."""
|
||||||
|
|
||||||
def validate(self, value):
|
def validate(self, value):
|
||||||
self._basic_validation(value)
|
self._basic_validation(value)
|
||||||
if not value:
|
if not value:
|
||||||
@ -1346,7 +1355,7 @@ class Position(MappingType):
|
|||||||
def __init__(self, none_ok=False):
|
def __init__(self, none_ok=False):
|
||||||
super().__init__(
|
super().__init__(
|
||||||
none_ok,
|
none_ok,
|
||||||
valid_values = ValidValues('top', 'bottom', 'left', 'right'))
|
valid_values=ValidValues('top', 'bottom', 'left', 'right'))
|
||||||
|
|
||||||
|
|
||||||
class VerticalPosition(BaseType):
|
class VerticalPosition(BaseType):
|
||||||
@ -1410,7 +1419,7 @@ class SelectOnRemove(MappingType):
|
|||||||
def __init__(self, none_ok=False):
|
def __init__(self, none_ok=False):
|
||||||
super().__init__(
|
super().__init__(
|
||||||
none_ok,
|
none_ok,
|
||||||
valid_values = ValidValues(
|
valid_values=ValidValues(
|
||||||
('left', "Select the tab on the left."),
|
('left', "Select the tab on the left."),
|
||||||
('right', "Select the tab on the right."),
|
('right', "Select the tab on the right."),
|
||||||
('previous', "Select the previously selected tab.")))
|
('previous', "Select the previously selected tab.")))
|
||||||
@ -1434,7 +1443,7 @@ class ConfirmQuit(FlagList):
|
|||||||
('downloads', "Show a confirmation if "
|
('downloads', "Show a confirmation if "
|
||||||
"downloads are running"),
|
"downloads are running"),
|
||||||
('never', "Never show a confirmation."))
|
('never', "Never show a confirmation."))
|
||||||
|
|
||||||
def validate(self, value):
|
def validate(self, value):
|
||||||
super().validate(value)
|
super().validate(value)
|
||||||
if not value:
|
if not value:
|
||||||
|
Loading…
Reference in New Issue
Block a user