PR 4787 : Preference Packs (a.k.a. "Themes")

Post here if you have re-based and finalised code to integrate into master, which was discussed, agreed to and tested in other forums. You can also submit your PR directly on github.
Post Reply
User avatar
chennes
Posts: 1214
Joined: Fri Dec 23, 2016 3:38 pm
Location: Norman, OK, USA
Contact:

PR 4787 : Preference Packs (a.k.a. "Themes")

Post by chennes »

PR 4787 implements an idea called "preference packs". Parts of these ideas have been discussed previously in: Quoting from the PR description:
This PR adds a system for storing and applying sets of user preferences called "Preference Packs". These are intended to give users the ability to make bulk modifications to their FreeCAD setup by applying one or more of these packs. The packs are designed to be distributable, and to that end this PR introduces a new type of metadata file, "package.xml". Anything that can be stored in the user.cfg file can be stored in a Preference Pack.
This came about while thinking about "Themes" -- it turns out that just having a Qt Stylesheet isn't enough to create a nice-looking unified UI for FreeCAD -- there are many places where colors and fonts, etc. are controlled by user preferences as well. Think of the 3D viewing area background color, or the text colors in the console, for example. So to make a good-looking, functional "Theme", we need some way of distributing both a stylesheet and a set of updated user preferences (to eventually include even things like icons as well).

Beyond themes, there are sets of preferences that control things like how numbers are displayed, or the unit system, that really require setting multiple preferences across multiple workbenches. Someone could write a preference back that changes all of those at once. Or maybe the layout of the various content areas and toolbars optimized for particular display shapes or resolutions. Plus I'm sure many things I'm not even thinking of.

I'm particularly interested in making sure to get feedback on the metadata.xml file before merging, since this will (hopefully, in the long run) improve our addon distribution process, and that affects a lot of people. I'm also interested in knowing which preferences you'd most like to see included in the template files that the system uses to make it easy to save your own custom preference packs (see the "Details" section of the PR for more information on that). Obviously if you're feeling up for a code review, go for that as well!

(Potential) Future work not included in this PR:
  • New section in the AddOn Manager to download these packs
  • The AddOn manager can be modified to provide much more info about addons based on the contents of the metadata.xml file
  • More variables added to the Template files for easier pack creation
  • More things in FreeCAD can be modified to be controlled by (potentially hidden) preferences, allowing customization from a Preference Pack
Chris Hennes
Pioneer Library System
carlopav
Posts: 1959
Joined: Mon Dec 31, 2018 1:49 pm
Location: Venice, Italy

Re: PR 4787 : Preference Packs (a.k.a. "Themes")

Post by carlopav »

@chennes, i Just realized realthunder Is developing something similari in his fork: https://www.patreon.com/posts/2021-09-11-56021237
Perhaps there Is something to get inspiration from :)
follow my experiments on BIM modelling for architecture design
User avatar
chennes
Posts: 1214
Joined: Fri Dec 23, 2016 3:38 pm
Location: Norman, OK, USA
Contact:

Re: PR 4787 : Preference Packs (a.k.a. "Themes")

Post by chennes »

Chris Hennes
Pioneer Library System
carlopav
Posts: 1959
Joined: Mon Dec 31, 2018 1:49 pm
Location: Venice, Italy

Re: PR 4787 : Preference Packs (a.k.a. "Themes")

Post by carlopav »

Wow! Congratulations!
follow my experiments on BIM modelling for architecture design
Syres
Posts: 1254
Joined: Thu Aug 09, 2018 11:14 am

Re: PR 4787 : Preference Packs (a.k.a. "Themes")

Post by Syres »

Thanks for the efforts, for those with dark(er) stylesheets there was a slight downside in that I couldn't easily read the Sketcher DOF message and it took me a little while to narrow down the change required of the Gui--UrlLabel section at the end of the stylesheet which I changed to :

Code: Select all

Gui--UrlLabel {
    color : rgba(100,149,237,255); /* Cornflower blue */
    text-decoration : underline;
}
for anyone else who noticed this.

Am I correct in saying this is the only section that can't be done in the Tools>Edit Parameters??
User avatar
chennes
Posts: 1214
Joined: Fri Dec 23, 2016 3:38 pm
Location: Norman, OK, USA
Contact:

Re: PR 4787 : Preference Packs (a.k.a. "Themes")

Post by chennes »

Syres wrote: Fri Oct 15, 2021 10:46 am Am I correct in saying this is the only section that can't be done in the Tools>Edit Parameters??
I don't know quite what you mean by "the only section" here. You are right that UrlLabel is designed to be styled via the stylesheet, and we don't have a user preference setting to change what that type of Url looks like (either to override the stylesheet, or to control it in the case of no stylesheet). You can see discussion of the changes we're working on to the Sketcher constraint messaging here. I'm certainly open the PRs adjusting the built-in stylesheets for that label, the bits I added were only intended to be placeholders until someone came along and made them look good.
Chris Hennes
Pioneer Library System
Post Reply