taurus-org / taurus

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

How to follow tango scheme syntax with configuration? #1078

Closed vallsv closed 4 years ago

vallsv commented 4 years ago

Hi,

I receive this error message.

WARNING:TaurusRootLogger:Model name "tango://foo:20000/bar/keithley/Ic/range?configuration=unit" is supported but not strictly valid. 
It is STRONGLY recommended that you change it to 
strictly follow tango scheme syntax

Is somebody have an idea why?

vallsv commented 4 years ago

I think i have to use tango://foo:20000/bar/keithley/Ic/range#unit. But the result looks to be wrong, it displays the attribute value anyway.

cpascual commented 4 years ago

Yes, selecting the "units" in a model using ?configuration is deprecated since taurus 4. So, instead of the old model name tango://foo:20000/bar/keithley/Ic/range?configuration=unit, in taurus4 you should use a fragment-based selection: tango://foo:20000/bar/keithley/Ic/range#rvalue.units

For example, I can reproduce the warnings with:

python3 -m taurus.qt.qtgui.display.tauruslabel tango://controls02:10000/sys/tg_test/1/short_scalar?configuration=unit

and they disappear with:

python3 -m taurus.qt.qtgui.display.tauruslabel tango://controls02:10000/sys/tg_test/1/short_scalar#rvalue.units

Now, if you are not setting the model explicitly, maybe it is one of the following:

a) your application is reading the model from some old configuration/settings file (.xml , .pck or .ini) b) there is an old widget in your application that automatically appends the ?configuration=unit part to your model (if that widget is part of taurus, then it would be a bug)

vallsv commented 4 years ago

Thanks a lot.

It's better but there is still a problem cause i am relied on useParentModel.

So if my widget uses relative import:

      <string>/range#rvalue.units</string>

The displayed value is just the rvalue.

If i set an absolute value, the displayed value is the unit as expected.

      <string>tango://foo.esrf.fr:20000/bar/keithley/Ic/range#rvalue.units</string>

I know you don't like relative URI, but in case you want to maintain this code, there is maybe a problem around.

cpascual commented 4 years ago

I know you don't like relative URI

oh... to be fair, I do like it, but it just never worked right (precisely in situations like this) ;)

That is why the "useParentModel" API is deprecated since taurus 4.4.0.

but in case you want to maintain this code, there is maybe a problem around.

Strictly speaking, we should keep the "parent model" feature working until we finally make the deprecation effective by removing the feature... but in practice, with the limited resources that we have it is unlikely to get high on our priority list. But of course if someone proposes a PR fixing this we would integrate it. But my recommendation is to better spend the time in refactoring the code to not depend on the parentModel API

cpascual commented 4 years ago

Anyway, since the original question is solved, I close this. Feel free to reopen (or to submit a PR) if you consider that the parentModel support with fragment-based URIs is needed.