Make it possible to set options with ! in it.
This is needed for a quit! alias for example. The option was wrongly treated as an inversion even though a value was given.
This commit is contained in:
parent
ea2dba6b38
commit
8c32fb86e2
@ -594,7 +594,7 @@ class ConfigManager(QObject):
|
|||||||
print_val = True
|
print_val = True
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
if optname.endswith('!'):
|
if optname.endswith('!') and value is None:
|
||||||
val = self.get(sectname, optname[:-1])
|
val = self.get(sectname, optname[:-1])
|
||||||
layer = 'temp' if temp else 'conf'
|
layer = 'temp' if temp else 'conf'
|
||||||
if isinstance(val, bool):
|
if isinstance(val, bool):
|
||||||
@ -602,12 +602,12 @@ class ConfigManager(QObject):
|
|||||||
else:
|
else:
|
||||||
raise cmdexc.CommandError(
|
raise cmdexc.CommandError(
|
||||||
"set: Attempted inversion of non-boolean value.")
|
"set: Attempted inversion of non-boolean value.")
|
||||||
else:
|
elif value is not None:
|
||||||
if value is None:
|
|
||||||
raise cmdexc.CommandError(
|
|
||||||
"set: The following arguments are required: value")
|
|
||||||
layer = 'temp' if temp else 'conf'
|
layer = 'temp' if temp else 'conf'
|
||||||
self.set(layer, sectname, optname, value)
|
self.set(layer, sectname, optname, value)
|
||||||
|
else:
|
||||||
|
raise cmdexc.CommandError("set: The following arguments "
|
||||||
|
"are required: value")
|
||||||
except (configexc.Error, configparser.Error) as e:
|
except (configexc.Error, configparser.Error) as e:
|
||||||
raise cmdexc.CommandError("set: {} - {}".format(
|
raise cmdexc.CommandError("set: {} - {}".format(
|
||||||
e.__class__.__name__, e))
|
e.__class__.__name__, e))
|
||||||
|
Loading…
Reference in New Issue
Block a user