mirror of
https://github.com/Andre0512/pyhOn.git
synced 2024-12-22 18:55:32 +00:00
cut and lower program keys
This commit is contained in:
parent
fe4f6e766e
commit
fc8c92d538
|
@ -2,12 +2,12 @@ from pyhon.parameter import HonParameterFixed, HonParameterEnum, HonParameterRan
|
||||||
|
|
||||||
|
|
||||||
class HonCommand:
|
class HonCommand:
|
||||||
def __init__(self, name, attributes, connector, device, multi=None, category=""):
|
def __init__(self, name, attributes, connector, device, multi=None, program=""):
|
||||||
self._connector = connector
|
self._connector = connector
|
||||||
self._device = device
|
self._device = device
|
||||||
self._name = name
|
self._name = name
|
||||||
self._multi = multi or {}
|
self._multi = multi or {}
|
||||||
self._category = category
|
self._program = program
|
||||||
self._description = attributes.get("description", "")
|
self._description = attributes.get("description", "")
|
||||||
self._parameters = self._create_parameters(attributes.get("parameters", {}))
|
self._parameters = self._create_parameters(attributes.get("parameters", {}))
|
||||||
self._ancillary_parameters = self._create_parameters(attributes.get("ancillaryParameters", {}))
|
self._ancillary_parameters = self._create_parameters(attributes.get("ancillaryParameters", {}))
|
||||||
|
|
|
@ -92,9 +92,10 @@ class HonDevice:
|
||||||
commands[command] = HonCommand(command, attr, self._connector, self)
|
commands[command] = HonCommand(command, attr, self._connector, self)
|
||||||
elif "parameters" in attr[list(attr)[0]]:
|
elif "parameters" in attr[list(attr)[0]]:
|
||||||
multi = {}
|
multi = {}
|
||||||
for category, attr2 in attr.items():
|
for program, attr2 in attr.items():
|
||||||
cmd = HonCommand(command, attr2, self._connector, self, multi=multi, category=category)
|
program = program.split(".")[-1].lower()
|
||||||
multi[category] = cmd
|
cmd = HonCommand(command, attr2, self._connector, self, multi=multi, program=program)
|
||||||
|
multi[program] = cmd
|
||||||
commands[command] = cmd
|
commands[command] = cmd
|
||||||
self._commands = commands
|
self._commands = commands
|
||||||
|
|
||||||
|
|
|
@ -93,7 +93,7 @@ class HonParameterEnum(HonParameter):
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def values(self):
|
def values(self):
|
||||||
return [str(value) for value in self._values]
|
return sorted([str(value) for value in self._values])
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def value(self):
|
def value(self):
|
||||||
|
@ -111,7 +111,7 @@ class HonParameterProgram(HonParameterEnum):
|
||||||
def __init__(self, key, command):
|
def __init__(self, key, command):
|
||||||
super().__init__(key, {})
|
super().__init__(key, {})
|
||||||
self._command = command
|
self._command = command
|
||||||
self._value = command._category
|
self._value = command._program
|
||||||
self._values = command._multi
|
self._values = command._multi
|
||||||
self._typology = "enum"
|
self._typology = "enum"
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue