Not loading favorite if base program renamed
This commit is contained in:
parent
44c55c681d
commit
59ca8b6caf
@ -188,18 +188,19 @@ class HonCommandLoader:
|
|||||||
command = favourite.get("command", {})
|
command = favourite.get("command", {})
|
||||||
command_name = command.get("commandName", "")
|
command_name = command.get("commandName", "")
|
||||||
program_name = self._clean_name(command.get("programName", ""))
|
program_name = self._clean_name(command.get("programName", ""))
|
||||||
base: HonCommand = copy(
|
if not (base := self.commands[command_name].categories.get(program_name)):
|
||||||
self.commands[command_name].categories[program_name]
|
continue
|
||||||
)
|
base_command: HonCommand = copy(base)
|
||||||
for data in command.values():
|
for data in command.values():
|
||||||
if isinstance(data, str):
|
if isinstance(data, str):
|
||||||
continue
|
continue
|
||||||
for key, value in data.items():
|
for key, value in data.items():
|
||||||
if parameter := base.parameters.get(key):
|
if parameter := base_command.parameters.get(key):
|
||||||
with suppress(ValueError):
|
with suppress(ValueError):
|
||||||
parameter.value = value
|
parameter.value = value
|
||||||
extra_param = HonParameterFixed("favourite", {"fixedValue": "1"}, "custom")
|
extra_param = HonParameterFixed("favourite", {"fixedValue": "1"}, "custom")
|
||||||
base.parameters.update(favourite=extra_param)
|
base_command.parameters.update(favourite=extra_param)
|
||||||
if isinstance(program := base.parameters["program"], HonParameterProgram):
|
program = base_command.parameters["program"]
|
||||||
|
if isinstance(program, HonParameterProgram):
|
||||||
program.set_value(name)
|
program.set_value(name)
|
||||||
self.commands[command_name].categories[name] = base
|
self.commands[command_name].categories[name] = base_command
|
||||||
|
Loading…
Reference in New Issue
Block a user