rvion / CushyStudio

🛋 The AI and Generative Art platform for everyone
https://docs.cushystudio.com/
GNU Affero General Public License v3.0
684 stars 48 forks source link

Add InlineRun Widget #88

Closed ricklove closed 11 months ago

ricklove commented 11 months ago

This has the same value as a form.bool({}), but it returns true only once when it is clicked. It is designed to be used in a run action to run specific parts of code:

Example:

 // ui
previewCrop: form.inlineRun({}),

// run
if (form.previewCrop) {
    graph.PreviewImage({ images: cropped_image })
    await flow.PROMPT()
    return
}

image


This also has a fix to the main button to disable the autorun if it is hit.

CLAassistant commented 11 months ago

CLA assistant check
All committers have signed the CLA.

rvion commented 11 months ago

amazing, thanks ! feel free to reach me on discord anytime so I can share with you what's in the work. next major release is very very soon

rvion commented 11 months ago

Thanks ! 🎉

I'll merge it as-is :)

Side note about future work on this component:

I also want a Button widget; I would have probably made the widget itself generic. Then, to retain the simple form.inlineRun, I would have probably just added an inlineRun entry in the formbuilder on top of the Button entry. the inlineRun would have been a shortcut to build a form.Button with the right labels, onClick, and color, like I did for the regional entry

rvion commented 11 months ago

also, smart way to do incremental run 😄 I had something a bit different planned, but glad you found a nice temp hack !

ricklove commented 11 months ago

Yeah, just wanted to do something simple for now since I wasn't sure what was in the works.