Skip to content

New get_formatted_value function to the DeviceProxy

Closes #480

I found useful the idea, that PyTango can provide attribute value already with applied user-formatting nice.

After some discussion, we decided to add a new function to AttributeProxy/DeviceProxy, called get_formatted_value. This function gets attribute config and extract formatting. If the format is empty, or does not start with "%", we try to use some default formatting:

        if attribute_type == CmdArgType.DevFloat:
            attribute_format = "%e"
        elif attribute_type == CmdArgType.DevDouble:
            attribute_format = "%f"
        else:
            attribute_format = "%d"

and tries to apply it to the attribute value. In case of failure to allow Python to do the best, it could with just return f"{attribute_value}"

Edited by Yury Matveyev

Merge request reports

Loading