taurus-org / taurus

Moved to https://gitlab.com/taurus-org/taurus
http://taurus-scada.org
43 stars 46 forks source link

Fix missing precision initialization #1058

Closed cmft closed 4 years ago

cmft commented 4 years ago

Some widgets report 'Invalid format' warning messages for TangoAttributes URIS of Type.Integer.

The precision attribute is not initialized right for integer types.

Fix it.

You can reproduce it with : taurus --log-level=Debug form sys/tg_test/1/long_scalar

cmft commented 4 years ago

Or to be more precise, I would like to understand why taurus --log-level=Debug form 'eval:Q(123)' does not trigger the same issue.

That is true. But in case that you do not set precision to 0 for int values (without mattering for which scheme). The defaultFormatDict is wrong. Cause int and float attributes are represented by Quantities and we are saying that float has precision and int does not.

IMO the bug is not triggered for eval for other reasons (as we see, it is not using Quantity to display the value) but is there.

See:

    defaultFormatDict = {float: "{:.{bc.modelObj.precision}f}",
                         Enum: "{0.name}",
                         Quantity: "{:~.{bc.modelObj.precision}f}"
                         }
cpascual commented 4 years ago

The travis tests are failing for py2qt5, but this is already fixed in develop by #1075 , so I am merging.