Skip to content
This repository has been archived by the owner on Mar 17, 2021. It is now read-only.

(doc) document how TaurusValueLineEdit parses quantities #679

Closed
jairomoldes opened this issue Jan 30, 2018 · 3 comments
Closed

(doc) document how TaurusValueLineEdit parses quantities #679

jairomoldes opened this issue Jan 30, 2018 · 3 comments
Milestone

Comments

@jairomoldes
Copy link

It looks like white spaces are interpreted as multiplication sign when editing the value.

To reproduce simply run the default sample code:
(e.g.) python ~/workspace/taurus/lib/taurus/qt/qtgui/input/tauruslineedit.py
and type "2 3" (withouth the quotes) and then enter. You will see that the write value of "sys/tg_test/1/double_scalar" has been change to 6 (2*3)

@cpascual
Copy link
Member

cpascual commented Jan 31, 2018

Confirmed. It comes from the parsing done by pint:

In [1]: from pint import UnitRegistry

In [2]: UR = UnitRegistry()

In [3]: UR.parse_expression('2 3')
Out[3]: 6

In [4]: UR.parse_expression('2 3 m 4 s**-1')
Out[4]: <Quantity(24.0, 'meter / second')>

It seems to me that this is considered a feature, not a bug in pint (see hgrecco/pint#226 and hgrecco/pint#34).
I personally prefer not to implement/maintain/document a custom parser , and so I propose to close this as "wontfix"

@jairomoldes
Copy link
Author

From my point of view this is confusing, but if you all agree that it is acceptable I will not oppose to close it as "wontfix"

@cpascual cpascual added this to the Jul18 milestone Jan 31, 2018
@cpascual
Copy link
Member

cpascual commented Jan 31, 2018

I see your point, but I think that the confusion would be mitigated if we prominently document that the TaurusValueLineEdit will parse its contents using pint's parser (when dealing with numerical models).

S, instead of closing, I'll keep this issue open as a reminder for documenting (I'll change the title accordingly)

@cpascual cpascual changed the title TaurusValueLineEdit: white space interpreted as multiplication (doc) document how TaurusValueLineEdit parses quantities Jan 31, 2018
cpascual pushed a commit to cpascual/taurus that referenced this issue Jul 2, 2018
Add class docstring. Fixes taurus-org#679
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants