slaclab / trace

Live and Archived data plotting tool
https://slaclab.github.io/trace/
3 stars 4 forks source link

[BUG] - ScientificNotationDelegate Validator Denies Valid Input #77

Closed zdomke closed 1 week ago

zdomke commented 1 week ago

Describe the bug

When entering a new scientific notation value for a y-axis' min/max value, the validator will sometimes not allow users to input valid entries. The issue is that for scientific notation, it requires the first part to be a float (e.g. 1.0E7, 5.222e-14).

Expected behavior

The validator should allow numbers in scientific notation in which the base number is whole, rather than just floats. (e.g. 1E7, -16e14)

Steps to Reproduce

  1. Open trace
  2. Navigate to the Axis tab
  3. Click either the Min Range or Max Range cell for an axis
  4. Try entering '1e7' a. Notice it won't let you enter the 'e'
  5. Try entering '1.0e7' a. Notice that it will let you enter the whole string

Possible solution (optional)

Fix the regex in ScientificNotationDelegate.createEditor(). Find a way to make the '.' optional.

My platform

No response

Additional context

Current regex: r"^[+-]?\d(?:.\d(?:[eE][+-]?\d+)?)?$"

zdomke commented 1 week ago

Resolved by PR #78