[filehandler] use 1.5 property api
This commit is contained in:
parent
fad56640fa
commit
b7db1b9d5a
@ -151,19 +151,12 @@ class FileHandler(metaclass=Singleton):
|
||||
props = []
|
||||
for p in section.props:
|
||||
value = ""
|
||||
if self._file_version < (1, 1, 1):
|
||||
vals = p.values
|
||||
if len(vals) > 1:
|
||||
value += "["
|
||||
value += ",".join(map(str, [v.value for v in vals]))
|
||||
value += "]"
|
||||
else:
|
||||
value = str(vals[0].value)
|
||||
else:
|
||||
vals = p.values
|
||||
value += "["
|
||||
value += ",".join(map(str, [v.value for v in vals]))
|
||||
value += "]"
|
||||
vals = p.values
|
||||
if len(vals) == 0:
|
||||
continue
|
||||
is_bytes = isinstance(vals[0], bytes)
|
||||
val_list = [v.decode() for v in vals] if is_bytes else [str(v) for v in vals]
|
||||
value = val_list[0] if len(val_list) == 1 else "[%s]" % (",".join(map(str, val_list)))
|
||||
if p.unit is not None:
|
||||
value += " " + p.unit
|
||||
props.append(ItemDescriptor(p.name, p.id, value=value, entity_type=NodeType.Property))
|
||||
|
Loading…
Reference in New Issue
Block a user