Fix configmodel nitpicks
This commit is contained in:
parent
f0509d1c26
commit
607c64742c
@ -27,8 +27,8 @@ from qutebrowser.commands import cmdutils
|
|||||||
def option(*, info):
|
def option(*, info):
|
||||||
"""A CompletionModel filled with settings and their descriptions."""
|
"""A CompletionModel filled with settings and their descriptions."""
|
||||||
model = completionmodel.CompletionModel(column_widths=(20, 70, 10))
|
model = completionmodel.CompletionModel(column_widths=(20, 70, 10))
|
||||||
options = ((x.name, x.description, info.config.get_str(x.name))
|
options = ((opt.name, opt.description, info.config.get_str(opt.name))
|
||||||
for x in configdata.DATA.values())
|
for opt in configdata.DATA.values())
|
||||||
model.add_category(listcategory.ListCategory("Options", sorted(options)))
|
model.add_category(listcategory.ListCategory("Options", sorted(options)))
|
||||||
return model
|
return model
|
||||||
|
|
||||||
@ -44,12 +44,12 @@ def value(optname, *_values, info):
|
|||||||
model = completionmodel.CompletionModel(column_widths=(30, 70, 0))
|
model = completionmodel.CompletionModel(column_widths=(30, 70, 0))
|
||||||
|
|
||||||
try:
|
try:
|
||||||
current = str(info.config.get(optname) or '""')
|
current = info.config.get_str(optname) or '""'
|
||||||
except configexc.NoOptionError:
|
except configexc.NoOptionError:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
opt = configdata.DATA[optname]
|
opt = info.config.get_opt(optname)
|
||||||
default = str(opt.default or '""')
|
default = opt.typ.to_str(opt.default)
|
||||||
cur_cat = listcategory.ListCategory("Current/Default",
|
cur_cat = listcategory.ListCategory("Current/Default",
|
||||||
[(current, "Current value"), (default, "Default value")])
|
[(current, "Current value"), (default, "Default value")])
|
||||||
model.add_category(cur_cat)
|
model.add_category(cur_cat)
|
||||||
@ -68,7 +68,7 @@ def bind(key, *, info):
|
|||||||
key: the key being bound.
|
key: the key being bound.
|
||||||
"""
|
"""
|
||||||
model = completionmodel.CompletionModel(column_widths=(20, 60, 20))
|
model = completionmodel.CompletionModel(column_widths=(20, 60, 20))
|
||||||
cmd_text = info.keyconf.get_bindings_for('normal').get(key)
|
cmd_text = info.keyconf.get_command(key, 'normal')
|
||||||
|
|
||||||
if cmd_text:
|
if cmd_text:
|
||||||
cmd_name = cmd_text.split(' ')[0]
|
cmd_name = cmd_text.split(' ')[0]
|
||||||
|
Loading…
Reference in New Issue
Block a user