studio icon indicating copy to clipboard operation
studio copied to clipboard

[LVGL] Allow live preview of certain widgets with properties set to variables/expressions

Open tylercamp opened this issue 1 year ago • 1 comments

Is your feature request related to a problem? Please describe. I have a Label widget for temperature display with a very large font size, and a typical text size of ~3-4 chars. When I assign its content to a variable/expression, the Label widget expands to ~10x its intended width and makes it harder to iterate on sizing and positioning.

When the content of a Label is assigned to a variable/expression, I'd like to be able to see a "real"/"intended" value for that Label instead of the expression string.

Describe the solution you'd like Any of these approaches would work:

  • (1) Evaluate variables / expressions in-editor based on the Default Values for those variables
  • (2) Add a "Preview Value" field for affected widgets, which only applies in Edit view
    • To prevent confusion, may want to hide this field if the widget value is constant
  • (3) Allow opening the Run view in a new tab within the same window
    • Would be used to show the Edit and Run views simultaneously for live feedback
    • For simpler impl., any changes in the Edit view could cause a state reset/refresh in the Run view
  • (4) Add monitoring of the project file with automatic reload when changes are detected
    • The project could be reopened in a new window, where one window is used for editing and the other is used for preview
    • App would auto-update if changes are detected and there are no unsaved changes in the current instance

(I don't have a preference for any of these options; of course (1) would be most "feature-complete", but I'm ok with whichever option is easiest to implement.)

Some other notes

  • Since this "sizing problem" only affects text-based widgets, this change could just be scoped to those text-based widgets
    • I don't think there are any other widgets whose size can change based on an expression/var-based prop for their "primary value"
  • For approaches which change the Edit view rather than making use of the Run view, it would be useful to have a toggle in the project settings which decides whether to show the expression or the "preview" value

tylercamp avatar Jun 02 '24 17:06 tylercamp

I chose option (2), because it is the easiest option to implement 😉

image

Option (1) is also not that difficult to implement. But, it is more unpredictable than preview value. And you can change the preview value as you want and it won't affect the runtime.

mvladic avatar Jun 02 '24 18:06 mvladic