Replies: 3 comments 9 replies
-
And again Sorry for the late response. In my opinion, allowing to set HTML/CSS classes of widgets from the Python code would violate the current design principle of the SHC widgets: to hide all the web implementation details of the client-side rendering behind a simple Python-only interface. Thus, I'm rather opposed to the idea of adding such a generic attribute. For the concrete use case, in my opinion, it would be more correct to create two button group elements ( |
Beta Was this translation helpful? Give feedback.
-
Considering the data-ids: Unfortuately, I didn't fully understand your usecase. In general: Again, it's currently not intended to directly interact with the client-side implementation details of the web widgets, circumventing the Python API of the widgets. And, as I explained in the other discussion thread, in general, only connectable objects are expected to change or create events during runtime. So I don't really see, how one would need the widget data id in the Python code.¹ However, it may be easily possible to extend the existing widgets to provide a (connectable) API for your usecase or create a simple wrapper widget that allows to dynamically hide other widgets, based on dynamic events from the server. ¹ That said: It's quite easy to retrieve: It's just the Python object id of the |
Beta Was this translation helpful? Give feedback.
-
Buttons (or widgets in general) that work as a link to another page (as a simple navigation widget, or inside the HideRow widgets have been on my mental todo list for a long time, and I always have forgotten to actually implement this. I would suggest to add (at least) a new button descriptor type for this that is not a connectable object, but instead takes a |
Beta Was this translation helpful? Give feedback.
-
I know I can easily create my own widgets. Still it in my eyes it would make sense to make the provided widgets as flexible as possible. We could add an attribute
classes=list[str]
to all widgets in python which would be added as additonal classes or data-tag in html. It would be a lot easier to customize, hide, etc. the widgets via css.Example: I'm using a button group for my heating controls. I want to split the button group between the reset and the on/off button on the left and the up/down buttons on the right to improve usability. Without custom classes or alike it is kind of ugly to identify the correct button in css:
Furthermore it would also be nice to have the id (thus the
data-id
on js side) accessable on the python side. Then you could use it for some special triggers, for example I'm only showing the history graph of a room temperature when you click on it.I know I can implement all this by myself writing my own widgets using the existing tool and framework. But I was wondering whether it wouldn't be a nice general feature for all users. What do you think?
Beta Was this translation helpful? Give feedback.
All reactions