mirror of
https://github.com/Andre0512/pyhOn.git
synced 2024-12-22 18:55:32 +00:00
Not loading favorite if base program renamed
This commit is contained in:
parent
0c1670733f
commit
6cdac99ce8
|
@ -187,18 +187,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 a new issue