-
Notifications
You must be signed in to change notification settings - Fork 116
Add property to configure the 'not_enabled' css styling for widgets #3591
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add property to configure the 'not_enabled' css styling for widgets #3591
Conversation
kasemir
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The original code always called Styles.update(..., !enabled), so no matter if enabled or not, the style was updated.
Now you have if (children != null && !enabled) ... setStyle which looks like it will apply that style when disabled, but how is the widget ever getting re-enabled? Note that enablement can change while the display is running, so it's not sufficient to disable, also need to be re-enable when the time comes.
|
Thanks for the feedback @kasemir - much appreciated. Yes, that was a good catch - it needs to be able to remove the custom styling when the widget becomes enabled again without having to reload the page. I have updated the code to do so. I've switched around some of the statements to make sure that we handle all cases. I've also surrounded the custom 'not_enabled' styling with comments in the css string signalling the start and end of that styling so that I can ensure that only this bit gets removed from the styling when the widget is enabled. If you could take another look and let me know what you think that would be much appreciated. |
|
The approach with This code includes Instead of patching CSS text, an overall better approach would be staying with a CSS class but change the definition of
It's loaded via
Maybe you can tweak that to update the definition of not_enabled?
|
|
Thanks again for the feedback. Yes, I could add an I did look into trying to update the definition using a CSS class but couldn't find a way to do it or a way to load in a custom CSS file from somewhere outside of the project, which is ideally what we would want. In the and so I can't seem to get direct access to the actual CSS definition at this point to be able to modify it... |
|
In setSceneStyle, we add the path to the bundled csstudio.css. THere's nothing that prevents adding another In there, you can re-define the This would allow each site to overwrite more than just |
Allows users to override the 'not_enabled' styling as well as others used by Phoebus. Introduces a new property that can be set to the path of the CSS file.
|
Hi @kasemir - thanks for the guidance. I've been able to get this working as you described. Not sure why I couldn't before - perhaps I was trying to load it in the wrong place. I've reverted the previous changes and added a new property to the UI core package to allow users to add a custom CSS file. The only other question I have is do we want any error checking when adding the CSS file to the stylesheet? The code does not throw an exception if the file added to the stylesheet does not actually exist. It is essentially just ignored and, for example, the default 'not_enabled' styling from csstudio.css is just used. |
|
Enthusiastic Yay! As for a missing But I think we should have a warning in the log. |
|
Ah that's nice - thanks for the code snippet. I have implemented that as suggested. |
|
Resolved merge conflicts so this should be ready for re-review and merging if all are happy. |
I have implemented the changes required to allow the 'not_enabled' css style to be configured by facilities using a Phoebus property. This would allow users to override the default 40% opacity if this doesn't suit their needs.
This PR addresses the feature request in issue #3590.
Note: if the property is not set then the default styling will be used so current users will see no changes.
Checklist
Testing:
Documentation: