Closed mariocaptain closed 3 years ago
Taurus uses the pint module to parse and handle units. See the pint docs for details on syntax for supported units and also on how to define your own units.
From your traces, you are looking for "celsius" and "%". Note that the support of "%" requires a relatively recent version of pint, and also note that by default it is represented as dimensionless. If you want a better support of percent, you can define it yourself, as in the following snippet:
from taurus.qt.qtgui.application import TaurusApplication
from taurus.qt.qtgui.panel import TaurusForm
import sys
app = TaurusApplication(cmd_line_parser=None)
from taurus.core.units import UR
UR.define('percent = 0.01*count = %') # <-- defining percent
w = TaurusForm()
w.setModel(["eval:Q(37, 'celsius')", "eval:Q(99, 'percent')"])
w.show()
sys.exit(app.exec_())
which yields:
Thanks so much @cpascual . In the pint module I found a complete list of all units. Also the snippet for displaying "%" works perfectly. Can't thank you enough! Best, Dave
Hi all, I have been having some hard time displaying attribute units on TaurusForm, with the warnings as below.
As seen, the issue is that my defined attribute units are not recognized. I am not sure if this is related to tango, pytango or taurus but I have been searching the documentations of all the three for a list of recognized units without success. Does such a list exist?
Thanks!