timothycrosley / streamdeck-ui

A Linux compatible UI for the Elgato Stream Deck.
https://timothycrosley.github.io/streamdeck-ui/
MIT License
1.14k stars 242 forks source link

Support for multiline text #188

Closed makstech closed 2 years ago

makstech commented 2 years ago

In this PR, I've introduced support for multiline text using \n. The idea comes from Bitfocus Companion.
It will be stored as a literal \n (\\n), so that in UI in the input field, it is obvious, instead of appearing as whitespace.

Also, tweaked a bit the vertical centering of text when no icon is set, previously it was a bit offset by a couple of pixels more, now it just does the correct math instead.

A note, on why I'm passing the whole button state to transform_button_text instead of the text right away: The idea is that, at some point, I would like to also implement some dynamic stuff that would use that state as a context.

This is my first time writing actual code on Python, so I am looking forward to your comments/suggestions.

nikdikpik commented 2 years ago

This would be nice

dodgyrabbit commented 2 years ago

Thanks for your pull request and contribution. It turns out this can already be done as shown in #185 However, it's not ideal since its not clear to the user that it's possible. As outlined - I think the solution would be to provide a UI control that is multiline which is more intuitive than special characters. The codebase has also diverged substantially from your request. Again, thanks for sharing, but I'm going to close this one. If you want to create a seperate MR for the docs, that would be great.