Skip to content

Conversation

Spudmn
Copy link
Contributor

@Spudmn Spudmn commented Nov 8, 2022

This is an update to the user.prompt.
It allows up to 3 optional buttons to be displayed. The button text is returned when clicked.
A typical example.
sAnswewr = user.prompt('Is the LED on?',text_input=False,button_1_text="Yes",button_2_text="No",button_3_text="Cancel") Will ask the question 'Is the LED on?' and the user can click "Yes", "No" or "Cancel"


This change is Reviewable

This is an update to the user.prompt.
It allows up to 3 optional buttons to be displayed.
The button text is returned when clicked.
A typical example.
sAnswewr = user.prompt('Is the LED on?',text_input=False,button_1_text="Yes",button_2_text="No",button_3_text="Cancel")
Will ask the question 'Is the LED on?' and the user can click "Yes", "No" or "Cancel"
@mbenabda
Copy link

mbenabda commented Jun 5, 2023

Hi there,

I'm interested in more versatile user inputs as well

Using a jsonschema form description would support more use cases, including this one.

That work has already been done in the spintop-openhtf distribution, that seems not to be under active development anymore
Maybe it would be worth integrating instead of reimplementing ?

Their implementation however has the caveats of not being api-compatible with the current UserInput plug, and breaking the console I/O, so maybe integrate as a FormInputPlug instead

Frontend:
https://gitlab.com/tackv/spintop-openhtf/-/blob/master/src/openhtf/output/web_gui/src/app/plugs/user-input-plug.component.scss
https://gitlab.com/tackv/spintop-openhtf/-/blob/master/src/openhtf/output/web_gui/src/app/plugs/user-input-plug.component.html
https://gitlab.com/tackv/spintop-openhtf/-/blob/master/src/openhtf/output/web_gui/src/app/plugs/user-input-plug.component.ts

Backend:
https://gitlab.com/tackv/spintop-openhtf/-/blob/master/src/openhtf/plugs/user_input.py

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants