Avoid config -> configmodel circular import.
Avoid the config dependency by using objreg.get('config') instead of config.get.
This commit is contained in:
parent
6cc2095221
commit
6a8b1d51fa
@ -19,8 +19,9 @@
|
|||||||
|
|
||||||
"""Functions that return config-related completion models."""
|
"""Functions that return config-related completion models."""
|
||||||
|
|
||||||
from qutebrowser.config import config, configdata, configexc
|
from qutebrowser.config import configdata, configexc
|
||||||
from qutebrowser.completion.models import base
|
from qutebrowser.completion.models import base
|
||||||
|
from qutebrowser.utils import objreg
|
||||||
|
|
||||||
|
|
||||||
def section():
|
def section():
|
||||||
@ -54,6 +55,7 @@ def option(sectname):
|
|||||||
desc = ""
|
desc = ""
|
||||||
else:
|
else:
|
||||||
desc = desc.splitlines()[0]
|
desc = desc.splitlines()[0]
|
||||||
|
config = objreg.get('config')
|
||||||
val = config.get(sectname, name, raw=True)
|
val = config.get(sectname, name, raw=True)
|
||||||
model.new_item(cat, name, desc, val)
|
model.new_item(cat, name, desc, val)
|
||||||
return model
|
return model
|
||||||
@ -68,6 +70,7 @@ def value(sectname, optname):
|
|||||||
"""
|
"""
|
||||||
model = base.CompletionModel(column_widths=(20, 70, 10))
|
model = base.CompletionModel(column_widths=(20, 70, 10))
|
||||||
cur_cat = model.new_category("Current/Default")
|
cur_cat = model.new_category("Current/Default")
|
||||||
|
config = objreg.get('config')
|
||||||
try:
|
try:
|
||||||
val = config.get(sectname, optname, raw=True) or '""'
|
val = config.get(sectname, optname, raw=True) or '""'
|
||||||
except (configexc.NoSectionError, configexc.NoOptionError):
|
except (configexc.NoSectionError, configexc.NoOptionError):
|
||||||
|
Loading…
Reference in New Issue
Block a user