Need Help on populating user colors with Stylesheet change.

A forum for research and development of the user interface of FreeCAD
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: Need Help on populating user colors with Stylesheet change.

Post by Kunda1 »

chennes wrote: Thu Apr 01, 2021 12:11 am Purely technical coding question for the devs reading this
There was/is an ongoing discussion about this regarding Addons. This would qualify as an addon, per se.
https://github.com/FreeCAD/FreeCAD-addo ... -303949382
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
User avatar
chennes
Veteran
Posts: 3905
Joined: Fri Dec 23, 2016 3:38 pm
Location: Norman, OK, USA
Contact:

Re: Need Help on populating user colors with Stylesheet change.

Post by chennes »

As far as I can find in FreeCAD, we don't have any code that actually parses the metadata.txt file -- just code that scans it for a few key entries. Am I missing something?
Chris Hennes
Pioneer Library System
GitHub profile, LinkedIn profile, chrishennes.com
User avatar
chennes
Veteran
Posts: 3905
Joined: Fri Dec 23, 2016 3:38 pm
Location: Norman, OK, USA
Contact:

Re: Need Help on populating user colors with Stylesheet change.

Post by chennes »

The UI for this is pretty straightforward: here's a first take on it...
Screenshot 2021-04-01 093657.png
Screenshot 2021-04-01 093657.png (78.41 KiB) Viewed 2835 times
ETA: The "Apply" button becomes "Reapply" once a theme has been applied.
Chris Hennes
Pioneer Library System
GitHub profile, LinkedIn profile, chrishennes.com
User avatar
turn211
Posts: 162
Joined: Mon Feb 01, 2021 11:37 pm

Re: Need Help on populating user colors with Stylesheet change.

Post by turn211 »

chennes wrote: Thu Apr 01, 2021 2:41 pm The UI for this is pretty straightforward: here's a first take on it...

Screenshot 2021-04-01 093657.png

ETA: The "Apply" button becomes "Reapply" once a theme has been applied.
Looks good! Any reason we still need the Stylesheet picker?
User avatar
chennes
Veteran
Posts: 3905
Joined: Fri Dec 23, 2016 3:38 pm
Location: Norman, OK, USA
Contact:

Re: Need Help on populating user colors with Stylesheet change.

Post by chennes »

I think so -- certainly at first, not all stylesheets will be wrapped by the Theme. And the action of the theme is to do more than set the stylesheet -- it will be possible to create a theme that doesn't affect the stylesheet at all, but (for example) just sets the colors of the console, or something like that. In this setup, "Theme" is just some arbitrary collection of user preferences.
Chris Hennes
Pioneer Library System
GitHub profile, LinkedIn profile, chrishennes.com
User avatar
turn211
Posts: 162
Joined: Mon Feb 01, 2021 11:37 pm

Re: Need Help on populating user colors with Stylesheet change.

Post by turn211 »

chennes wrote: Thu Apr 01, 2021 6:47 pm I think so -- certainly at first, not all stylesheets will be wrapped by the Theme. And the action of the theme is to do more than set the stylesheet -- it will be possible to create a theme that doesn't affect the stylesheet at all, but (for example) just sets the colors of the console, or something like that. In this setup, "Theme" is just some arbitrary collection of user preferences.
True. I'm trying to wrap my mind around which one overrides the other.
User avatar
turn211
Posts: 162
Joined: Mon Feb 01, 2021 11:37 pm

Re: Need Help on populating user colors with Stylesheet change.

Post by turn211 »

chennes wrote: Thu Apr 01, 2021 6:47 pm I think so -- certainly at first, not all stylesheets will be wrapped by the Theme. And the action of the theme is to do more than set the stylesheet -- it will be possible to create a theme that doesn't affect the stylesheet at all, but (for example) just sets the colors of the console, or something like that. In this setup, "Theme" is just some arbitrary collection of user preferences.
So if a Stylesheet is present in the theme Style Sheet = none ?
User avatar
chennes
Veteran
Posts: 3905
Joined: Fri Dec 23, 2016 3:38 pm
Location: Norman, OK, USA
Contact:

Re: Need Help on populating user colors with Stylesheet change.

Post by chennes »

Think of a Theme as a macro that sets a bunch of preferences (including the stylesheet). So anything you do after you hit apply on the theme still applies, including setting the stylesheet. We're not getting rid of the various preferences options, just giving theme creators an easy way of setting those options all at once.

(Aside: This is a little bit untrue because we have to have a mechanism for a theme to set value in workbenches that haven't been loaded yet, but it gets at the basic idea anyway.)
Chris Hennes
Pioneer Library System
GitHub profile, LinkedIn profile, chrishennes.com
User avatar
turn211
Posts: 162
Joined: Mon Feb 01, 2021 11:37 pm

Re: Need Help on populating user colors with Stylesheet change.

Post by turn211 »

chennes wrote: Thu Apr 01, 2021 7:25 pm Think of a Theme as a macro that sets a bunch of preferences (including the stylesheet). So anything you do after you hit apply on the theme still applies, including setting the stylesheet. We're not getting rid of the various preferences options, just giving theme creators an easy way of setting those options all at once.

(Aside: This is a little bit untrue because we have to have a mechanism for a theme to set value in workbenches that haven't been loaded yet, but it gets at the basic idea anyway.)
Got it. Thanks. Exciting!
User avatar
turn211
Posts: 162
Joined: Mon Feb 01, 2021 11:37 pm

Re: Need Help on populating user colors with Stylesheet change.

Post by turn211 »

chennes wrote: Thu Apr 01, 2021 2:41 pm The UI for this is pretty straightforward: here's a first take on it...
ETA: The "Apply" button becomes "Reapply" once a theme has been applied.
It would be nice to have a Please restart FreeCAD popup after changing themes or Style Sheet as Qss code in ProDark Theme (might be others) cannot update certain elements without restarting (i.e. url link colors)
Post Reply