taurus-org / taurus

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

set Taurus formatter for an schema #1037

Open sergirubio opened 4 years ago

sergirubio commented 4 years ago

We've had many discussions in the past regarding how to apply formatters in Taurus applications.

In the case of Tango schema, it exists an specific formatter for all attributes read using Tango; so the most optimal way could be to set the defaultFormatter at the Schema level.

In this way, all tango://... attributes will apply tangoFormatter while other schemas (eval://...) will ignore it.

It will be also useful to be able to set tangoFormatter as default (or not) for other schemas when needed (e.g. archiving://...).

cpascual commented 4 years ago

The formatter modifies how a value is displayed ( i.e. it belongs to the view / widget). On the other hand, the scheme defines the data source (i.e., the model ) and as such is not the appropriate place for setting the formatter.

The fact that tango mixes both aspects , is IMHO a design flaw (EPICS is better in this regard) that we should avoid in Taurus.

How to format a value is, in general, context-dependent and better decided at the widget level than at model level.

That said, it is feasible that this decision at widget level be taken considering the scheme (@cmft had some proposal along these lines)