From ccff32e6c108d3d7ce658026ecd66677a5a9f992 Mon Sep 17 00:00:00 2001 From: Andre Basche Date: Sun, 7 May 2023 00:47:08 +0200 Subject: [PATCH] Fix missing program --- pyhon/appliance.py | 7 +++++-- pyhon/parameter/program.py | 5 ++++- setup.py | 2 +- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/pyhon/appliance.py b/pyhon/appliance.py index c2d8cd9..eab3a83 100644 --- a/pyhon/appliance.py +++ b/pyhon/appliance.py @@ -142,8 +142,11 @@ class HonAppliance: if last is None: continue parameters = command_history[last].get("command", {}).get("parameters", {}) - if command.categories and parameters.get("category"): - command.category = parameters.pop("category").split(".")[-1].lower() + if command.categories: + if parameters.get("program"): + command.category = parameters.pop("program").split(".")[-1].lower() + else: + command.category = parameters.pop("category") command = self.commands[name] for key, data in command.settings.items(): if ( diff --git a/pyhon/parameter/program.py b/pyhon/parameter/program.py index 32a3c79..1cf0008 100644 --- a/pyhon/parameter/program.py +++ b/pyhon/parameter/program.py @@ -12,7 +12,10 @@ class HonParameterProgram(HonParameterEnum): def __init__(self, key: str, command: "HonCommand", group: str) -> None: super().__init__(key, {}, group) self._command = command - self._value: str = command.category + if "PROGRAM" in command.category: + self._value: str = command.category.split(".")[-1].lower() + else: + self._value: str = command.category self._programs: Dict[str, "HonCommand"] = command.categories self._typology: str = "enum" diff --git a/setup.py b/setup.py index 4f5c66b..a59b069 100644 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ with open("README.md", "r") as f: setup( name="pyhOn", - version="0.10.1", + version="0.10.2", author="Andre Basche", description="Control hOn devices with python", long_description=long_description,