How to display a value with its format
|
|
---|---|
Hi, Is there a function or method that formats a value into a string according to the format? I get the value of an attribute in the following way.
The display format of the value is given as follows.
I didn't find in the documentation (PyTango API) a function that formats a string according to this format (to obtain "2.70" in this case). Of course I can code it, but I would like to use a Python API function. Thank you for reading my request! |
|
|
---|---|
Hi JC I don't see anything like that in PyTango. Where do you think we should add it? A method on AttributeProxy? A general utility function? Please propose some options with the function/method signature, and expected behaviour. Taurus has that kind of thing built in for GUIs, but it would be nice to have in PyTango as well. Regards, Anton |
|
|
---|---|
Hi Anton, Thank you for your prompt response. I will code a solution and propose it in the GitLab project (pytango) if possible (?). Can I propose such a GitLab ticket in order to have a discussion and a follow-up? I don't see yet if this would be a feature in AttributeProxy or a general utility function. It is also about capturing the wrong formatting according to the type of data… Best regards, Jean-Christophe. |
|
|
---|---|
Yes, please create an issue in the GitLab project with your proposal(s). You may find some clues in the Taurus code. E.g., https://gitlab.com/taurus-org/taurus/-/blob/5.1.3/lib/taurus/core/tango/util/tango_taurus.py#L183 /Anton |
|
|
---|---|
Hi Anton, I created the ticket Issue #480 (Format a value with the format string spectification). In the meantime, for my own needs I have developed a very simple function that only takes the float format into account. Best, Jean-Christophe |
|
|
---|---|
Hi Jean-Christophe Thanks, I saw your nicely detailed proposal. The PyTango developers are focused on the 9.4.0 release at the moment, but once that is done we can look into this proposal. /Anton |