You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The ui implementations of requesting user input have a flaw when returning results.
This is due to the validator functions returning a Union of validated input and False . The ui functions then blindly convert the result to a boolean and loop without feedback if a false value is received from the input validator. If a valid input converts to false, then the input is discarded.
I found this happening specifically with user_input_float as 0 or 0.0 are valid floats.
In cmd_line.py
for_inrange(attempts):
# This will change based on the interfaceprint("\a")
ret_val=input(msg)
iftargetisNone:
q.put(ret_val)
returnret_val=target(ret_val, **kwargs)
ifret_val:
q.put(("Result", ret_val))
return
In ui_gui_qt.py
for_inrange(attempts):
# This will change based on the interfaceret_val=self.gui_user_input(msg, None)
iftargetisNoneorret_val=="ABORT_FORCE":
q.put(ret_val)
returnret_val=target(ret_val, **kwargs)
ifret_val:
q.put(("Result", ret_val))
return
example validator target
def_float_validate(entry):
"""Requires float entry"""try:
returnfloat(entry)
exceptValueError:
user_info("Please enter a number")
returnFalse
The text was updated successfully, but these errors were encountered:
The ui implementations of requesting user input have a flaw when returning results.
This is due to the validator functions returning a Union of validated input and False . The ui functions then blindly convert the result to a boolean and loop without feedback if a false value is received from the input validator. If a valid input converts to false, then the input is discarded.
I found this happening specifically with
user_input_float
as 0 or 0.0 are valid floats.In
cmd_line.py
In
ui_gui_qt.py
example validator target
The text was updated successfully, but these errors were encountered: