mirror of
https://github.com/tiqi-group/pydase.git
synced 2025-04-21 00:40:01 +02:00
fix: serializing enum properties
This commit is contained in:
parent
bdbb79e131
commit
06bf5fb539
@ -309,16 +309,6 @@ class DataService(rpyc.Service, AbstractDataService):
|
|||||||
"readonly": True,
|
"readonly": True,
|
||||||
"value": running_task_info,
|
"value": running_task_info,
|
||||||
}
|
}
|
||||||
elif isinstance(getattr(self.__class__, key, None), property):
|
|
||||||
prop: property = getattr(self.__class__, key)
|
|
||||||
result[key] = {
|
|
||||||
"type": type(value).__name__,
|
|
||||||
"value": value
|
|
||||||
if not isinstance(value, u.Quantity)
|
|
||||||
else {"magnitude": value.m, "unit": str(value.u)},
|
|
||||||
"readonly": prop.fset is None,
|
|
||||||
"doc": get_attribute_doc(prop),
|
|
||||||
}
|
|
||||||
elif isinstance(value, Enum):
|
elif isinstance(value, Enum):
|
||||||
result[key] = {
|
result[key] = {
|
||||||
"type": "Enum",
|
"type": "Enum",
|
||||||
@ -340,6 +330,11 @@ class DataService(rpyc.Service, AbstractDataService):
|
|||||||
"doc": get_attribute_doc(value),
|
"doc": get_attribute_doc(value),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if isinstance(getattr(self.__class__, key, None), property):
|
||||||
|
prop: property = getattr(self.__class__, key)
|
||||||
|
result[key]["readonly"] = prop.fset is None
|
||||||
|
result[key]["doc"] = get_attribute_doc(prop)
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
def update_DataService_attribute(
|
def update_DataService_attribute(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user