summaryrefslogtreecommitdiff
path: root/qutebrowser
diff options
context:
space:
mode:
authorNicholas Schwab <git@nicholas-schwab.de>2021-04-08 17:49:03 +0200
committerNicholas Schwab <git@nicholas-schwab.de>2021-04-08 18:14:35 +0200
commit4bdbdea0946b78d92c3adbb43d03375d1aad63c9 (patch)
treeb2e10ec9266a53e315a9c8a36fa948d5003e11a7 /qutebrowser
parent353bb19cd5e69548f979421d6078f2ea85ad8451 (diff)
downloadqutebrowser-4bdbdea0946b78d92c3adbb43d03375d1aad63c9.tar.gz
qutebrowser-4bdbdea0946b78d92c3adbb43d03375d1aad63c9.zip
Revert all prefix-related commits.
This reverts commits 02a64630aa83e37e47a28a60366e1c65f0eba3ac to 4ff204aecc96d77209a18594a14da96af703c43f.
Diffstat (limited to 'qutebrowser')
-rw-r--r--qutebrowser/config/configdata.py4
-rw-r--r--qutebrowser/config/configdata.yml5
-rw-r--r--qutebrowser/config/configfiles.py23
-rw-r--r--qutebrowser/config/configtypes.py37
4 files changed, 11 insertions, 58 deletions
diff --git a/qutebrowser/config/configdata.py b/qutebrowser/config/configdata.py
index 8e1be5509..ec4efc375 100644
--- a/qutebrowser/config/configdata.py
+++ b/qutebrowser/config/configdata.py
@@ -105,10 +105,6 @@ def _parse_yaml_type(
valid_values = kwargs.get('valid_values', None)
if valid_values is not None:
kwargs['valid_values'] = configtypes.ValidValues(*valid_values)
-
- valid_prefixes = kwargs.get('valid_prefixes', None)
- if valid_prefixes is not None:
- kwargs['valid_prefixes'] = configtypes.ValidPrefixes(*valid_prefixes)
else:
_raise_invalid_node(name, 'type', node)
diff --git a/qutebrowser/config/configdata.yml b/qutebrowser/config/configdata.yml
index 3e84f2e61..9ceb84173 100644
--- a/qutebrowser/config/configdata.yml
+++ b/qutebrowser/config/configdata.yml
@@ -1917,7 +1917,7 @@ statusbar.widgets:
type:
name: List
valtype:
- name: PrefixOrString
+ name: StatusbarWidget
valid_values:
- url: "Current page URL."
- scroll: "Percentage of the current page position like `10%`."
@@ -1927,8 +1927,7 @@ statusbar.widgets:
- tabs: "Current active tab, e.g. `2`."
- keypress: "Display pressed keys when composing a vi command."
- progress: "Progress bar for the current page loading."
- valid_prefixes:
- - text: "A text widget. Add your own text as content."
+ - text: "A text widget. Currently hard coded content."
none_ok: true
default: ['keypress', 'url', 'scroll', 'history', 'tabs', 'progress']
desc: List of widgets displayed in the statusbar.
diff --git a/qutebrowser/config/configfiles.py b/qutebrowser/config/configfiles.py
index 78991b5ec..f8566e2d0 100644
--- a/qutebrowser/config/configfiles.py
+++ b/qutebrowser/config/configfiles.py
@@ -788,15 +788,6 @@ class ConfigPyWriter:
yield self._line("config.load_autoconfig(False)")
yield ''
- def _gen_valid_list(self, head: str, valid_list) -> Iterator[str]:
- yield self._line(head)
- for val in valid_list:
- try:
- desc = valid_list.descriptions[val]
- yield self._line("# - {}: {}".format(val, desc))
- except KeyError:
- yield self._line("# - {}".format(val))
-
def _gen_options(self) -> Iterator[str]:
"""Generate the options part of the config."""
for pattern, opt, value in self._options:
@@ -810,13 +801,13 @@ class ConfigPyWriter:
valid_values = opt.typ.get_valid_values()
if valid_values is not None and valid_values.generate_docs:
- yield from self._gen_valid_list('# Valid Values: \n', valid_values)
-
- valid_prefixes = opt.typ.get_valid_prefixes()
- if valid_prefixes is not None and valid_prefixes.generate_docs:
- yield from self._gen_valid_list(
- '# Valid Prefixes (separator is {}): \n'.format(
- valid_prefixes.separator), valid_prefixes)
+ yield self._line("# Valid values:")
+ for val in valid_values:
+ try:
+ desc = valid_values.descriptions[val]
+ yield self._line("# - {}: {}".format(val, desc))
+ except KeyError:
+ yield self._line("# - {}".format(val))
if pattern is None:
yield self._line('c.{} = {!r}'.format(opt.name, value))
diff --git a/qutebrowser/config/configtypes.py b/qutebrowser/config/configtypes.py
index 55fc36e83..4439cd4f4 100644
--- a/qutebrowser/config/configtypes.py
+++ b/qutebrowser/config/configtypes.py
@@ -142,24 +142,6 @@ class ValidValues:
self.descriptions == other.descriptions)
-class ValidPrefixes(ValidValues):
-
- def __init__(self, *values, separator: str = ':', **kwargs):
- super().__init__(*values, **kwargs)
- self.separator = separator
-
- def __contains__(self, item) -> bool:
- return any(map(lambda x: item.startswith(x + self.separator), self.values))
-
- def __repr__(self) -> str:
- return utils.get_repr(self, values=self.values, separator=self.separator,
- descriptions=self.descriptions)
-
- def __eq__(self, other: object) -> bool:
- assert (isinstance(other, ValidPrefixes))
- return super().__eq__(other) and self.separator == other.separator
-
-
class BaseType:
"""A type used for a setting value.
@@ -181,7 +163,6 @@ class BaseType:
self._completions = completions
self.none_ok = none_ok
self.valid_values: Optional[ValidValues] = None
- self.valid_prefixes: Optional[ValidPrefixes] = None
def get_name(self) -> str:
"""Get a name for the type for documentation."""
@@ -191,10 +172,6 @@ class BaseType:
"""Get the type's valid values for documentation."""
return self.valid_values
- def get_valid_prefixes(self) -> Optional[ValidPrefixes]:
- """Get the type's valid prefixes for documentation."""
- return self.valid_prefixes
-
def _basic_py_validation(
self, value: Any,
pytype: Union[type, Tuple[type, ...]]) -> None:
@@ -532,9 +509,6 @@ class List(BaseType):
def get_valid_values(self) -> Optional[ValidValues]:
return self.valtype.get_valid_values()
- def get_valid_prefixes(self) -> Optional[ValidPrefixes]:
- return self.valtype.get_valid_prefixes()
-
def from_str(self, value: str) -> Optional[ListType]:
self._basic_str_validation(value)
if not value:
@@ -640,9 +614,6 @@ class ListOrValue(BaseType):
def get_valid_values(self) -> Optional[ValidValues]:
return self.valtype.get_valid_values()
- def get_valid_prefixes(self) -> Optional[ValidPrefixes]:
- return self.valtype.get_valid_prefixes()
-
def from_str(self, value: str) -> Any:
try:
return self.listtype.from_str(value)
@@ -2027,17 +1998,13 @@ class UrlPattern(BaseType):
raise configexc.ValidationError(value, str(e))
-class PrefixOrString(String):
+class StatusbarWidget(String):
"""A Widget for the status bar.
Allows some predefined widgets and custom text-widgets via text:$CONTENT."""
- def __init__(self, *, valid_prefixes: ValidPrefixes = None, **kwargs):
- super().__init__(**kwargs)
- self.valid_prefixes = valid_prefixes
-
def _validate_valid_values(self, value: str) -> None:
- if value in self.valid_prefixes:
+ if value.startswith("text:"):
return
super()._validate_valid_values(value)