fluidd-core / fluidd

Fluidd, the klipper UI.
https://docs.fluidd.xyz
GNU General Public License v3.0
1.35k stars 410 forks source link

feat: adds Prompt Dialog support #1262

Closed pedrolamas closed 8 months ago

pedrolamas commented 8 months ago

Adds support to the prompt dialog commands, based on Octoprint Action Command Prompt.

This feature was requested here, and after discussion with Mainsail devs, we have come to an agreement for an MVP.

The implementation here matches the documentation here, with the exception of action:prompt_button_group_* (these are for now ignored and we just stack all the buttons).

Example 1

Commands:

RESPOND TYPE=command MSG="action:prompt_begin MacroPrompt"
RESPOND TYPE=command MSG="action:prompt_text These are all button colors"
RESPOND TYPE=command MSG="action:prompt_button default|TEST"
RESPOND TYPE=command MSG="action:prompt_button_group_start"
RESPOND TYPE=command MSG="action:prompt_button primary|TEST|primary"
RESPOND TYPE=command MSG="action:prompt_button secondary|TEST|secondary"
RESPOND TYPE=command MSG="action:prompt_button_group_end"
RESPOND TYPE=command MSG="action:prompt_button_group_start"
RESPOND TYPE=command MSG="action:prompt_button info|TEST|info"
RESPOND TYPE=command MSG="action:prompt_button warning|TEST|warning"
RESPOND TYPE=command MSG="action:prompt_button error|TEST|error"
RESPOND TYPE=command MSG="action:prompt_button_group_end"
RESPOND TYPE=command MSG="action:prompt_show"

Result:

image

Example 2

Commands:

RESPOND TYPE=command MSG="action:prompt_begin Question"
RESPOND TYPE=command MSG="action:prompt_text Do you want to cancel the print?"
RESPOND TYPE=command MSG="action:prompt_footer_button continue|RESPOND TYPE=command MSG=action:prompt_end"
RESPOND TYPE=command MSG="action:prompt_footer_button CANCEL|CANCEL_PRINT|error"
RESPOND TYPE=command MSG="action:prompt_show"

Result:

image