Need Help with Preference Pack

Post here for help on using FreeCAD's graphical user interface (GUI).
Forum rules
and Helpful information
IMPORTANT: Please click here and read this first, before asking for help

Also, be nice to others! Read the FreeCAD code of conduct!
chrisb
Veteran
Posts: 53786
Joined: Tue Mar 17, 2015 9:14 am

Need Help with Preference Pack

Post by chrisb »

I had an issue with my user config and had to reset it. I would like to move my individual settings to one or more preference packs. While it works well for the predefined preferences, I didn't succeed e.g. with the icon size. Including it in the way below doubles the selection list of the ocon sizes, but doesn't apply the selection.

Can someone guide me through a procedure how to derive from the preferences in the user.cfg those in the preference pack?

Code: Select all

<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<FCParameters>

  <FCParamGroup Name="Root">
    <FCParamGroup Name="BaseApp">
      <FCParamGroup Name="MainWindow">
        <FCParamGroup Name="DockWindows">
          <FCBool Name="Std_SelectionView" Value="0"/>
          <FCBool Name="Std_ComboView" Value="1"/>
          <FCBool Name="Std_ReportView" Value="1"/>
          <FCBool Name="Std_PythonView" Value="0"/>
          <FCBool Name="Std_TreeView" Value="0"/>
          <FCBool Name="Std_PropertyView" Value="0"/>
          <FCBool Name="Std_DAGView" Value="0"/>
        </FCParamGroup>
        <FCParamGroup Name="Toolbars">
          <FCBool Name="File" Value="1"/>
          <FCBool Name="Workbench" Value="1"/>
          <FCBool Name="Macro" Value="0"/>
          <FCBool Name="View" Value="1"/>
          <FCBool Name="Structure" Value="1"/>
          <FCBool Name="Navigation" Value="1"/>
        </FCParamGroup>
      </FCParamGroup>
      <FCParamGroup Name="Preferences">
        <FCParamGroup Name="General">
          <FCInt Name="ToolbarIconSize" Value="16"/>
        </FCParamGroup>
        <FCParamGroup Name="View">
          <FCUInt Name="SketchEdgeColor" Value="4294967295"/>
          <FCUInt Name="SketchVertexColor" Value="4294967295"/>
          <FCUInt Name="EditedEdgeColor" Value="4294967295"/>
          <FCUInt Name="EditedVertexColor" Value="4280680703"/>
          <FCUInt Name="ConstructionColor" Value="56575"/>
          <FCUInt Name="ExternalColor" Value="3425924095"/>
          <FCUInt Name="InvalidSketchColor" Value="4285333759"/>
          <FCUInt Name="FullyConstrainedColor" Value="16711935"/>
          <FCUInt Name="InternalAlignedGeoColor" Value="3688602879"/>
          <FCUInt Name="FullyConstraintElementColor" Value="2161156351"/>
          <FCUInt Name="FullyConstraintConstructionElementColor" Value="1787625471"/>
          <FCUInt Name="FullyConstraintInternalAlignmentColor" Value="3739142399"/>
          <FCUInt Name="FullyConstraintConstructionPointColor" Value="4287987967"/>
          <FCUInt Name="ConstrainedIcoColor" Value="4280680703"/>
          <FCUInt Name="NonDrivingConstrDimColor" Value="2555903"/>
          <FCUInt Name="ConstrainedDimColor" Value="4280680703"/>
          <FCUInt Name="ExprBasedConstrDimColor" Value="4286523135"/>
          <FCUInt Name="DeactivatedConstrDimColor" Value="2139062271"/>
          <FCUInt Name="CursorTextColor" Value="65535"/>
          <FCUInt Name="CursorCrosshairColor" Value="4294967295"/>
          <FCUInt Name="CreateLineColor" Value="3435973887"/>
          <FCBool Name="CornerCoordSystem" Value="1"/>
          <FCBool Name="CheckBoxSelectionCheckBoxes" Value="1"/>
          <FCBool Name="InvertZoom" Value="1"/>
          <FCBool Name="Orthographic" Value="1"/>
          <FCBool Name="Perspective" Value="0"/>
          <FCBool Name="ShowAxisCross" Value="0"/>
          <FCBool Name="ShowFPS" Value="0"/>
          <FCBool Name="ShowNaviCube" Value="1"/>
          <FCBool Name="ShowSelectionBoundingBox" Value="0"/>
          <FCBool Name="UseAutoRotation" Value="1"/>
          <FCBool Name="UseVBO" Value="0"/>
          <FCBool Name="ZoomAtCursor" Value="1"/>
          <FCInt Name="AntiAliasing" Value="0"/>
          <FCInt Name="CornerCoordSystemSize" Value="16"/>
          <FCInt Name="NaviStepByTurn" Value="8"/>
          <FCInt Name="OrbitStyle" Value="1"/>
          <FCInt Name="RenderCache" Value="0"/>
          <FCInt Name="RotationMode" Value="1"/>
          <FCInt Name="SegmentsPerGeometry" Value="50"/>
          <FCFloat Name="BoundingBoxFontSize" Value="10.000000000000"/>
          <FCFloat Name="PickRadius" Value="15.000000000000"/>
          <FCFloat Name="ViewScalingFactor" Value="2.400000000000"/>
          <FCFloat Name="ZoomStep" Value="0.150000000000"/>
          <FCText Name="NavigationStyle">Gui::GestureNavigationStyle</FCText>
          <FCBool Name="EnableBacklight" Value="0"/>
          <FCBool Name="Gradient" Value="1"/>
          <FCBool Name="RandomColor" Value="0"/>
          <FCBool Name="Simple" Value="0"/>
          <FCBool Name="UseBackgroundColorMid" Value="0"/>
          <FCInt Name="BacklightIntensity" Value="100"/>
          <FCInt Name="DefaultShapeTransparency" Value="0"/>
          <FCUInt Name="AnnotationTextColor" Value="4126537215"/>
          <FCUInt Name="BackgroundColor" Value="2291380991"/>
          <FCUInt Name="BackgroundColor2" Value="2678509823"/>
          <FCUInt Name="BackgroundColor3" Value="2897994239"/>
          <FCUInt Name="BackgroundColor4" Value="1869583359"/>
          <FCUInt Name="BacklightColor" Value="4294967295"/>
          <FCUInt Name="BoundingBoxColor" Value="4294967295"/>
          <FCUInt Name="DefaultShapeColor" Value="3435973887"/>
          <FCUInt Name="HighlightColor" Value="3789624575"/>
          <FCUInt Name="SelectionColor" Value="481107199"/>
        </FCParamGroup>
        <FCParamGroup Name="OpenGL">
          <FCBool Name="UseSoftwareOpenGL" Value="1"/>
        </FCParamGroup>
        <FCParamGroup Name="NaviCube">
          <FCBool Name="NaviRotateToNearest" Value="1"/>
          <FCInt Name="CornerNaviCube" Value="1"/>
          <FCInt Name="CubeSize" Value="132"/>
        </FCParamGroup>
        <FCParamGroup Name="TreeView">
          <FCUInt Name="TreeEditColor" Value="4294902015"/>
          <FCUInt Name="TreeActiveColor" Value="3873898495"/>
        </FCParamGroup>
        <FCParamGroup Name="MainWindow">
          <FCBool Name="TiledBackground" Value="0"/>
          <FCText Name="StyleSheet"></FCText>
        </FCParamGroup>
      </FCParamGroup>
    </FCParamGroup>
  </FCParamGroup>

</FCParameters>
My insertion is from Line 26 to line 28, where I inserted this taken from user.cfg:

Code: Select all

        <FCParamGroup Name="General">
          <FCInt Name="ToolbarIconSize" Value="16"/>
        </FCParamGroup>
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
User avatar
chennes
Veteran
Posts: 3868
Joined: Fri Dec 23, 2016 3:38 pm
Location: Norman, OK, USA
Contact:

Re: Need Help with Preference Pack

Post by chennes »

You just have the settings in the wrong group: you're one level too deep, with your new setting in the MainWindow preferences area. It should just be Root->BaseApp->Preferences->General

Code: Select all

<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<FCParameters>

  <FCParamGroup Name="Root">
    <FCParamGroup Name="BaseApp">
      <FCParamGroup Name="Preferences">
        <FCParamGroup Name="General">
          <FCInt Name="ToolbarIconSize" Value="16"/>
        </FCParamGroup>
      </FCParamGroup>
    </FCParamGroup>
  </FCParamGroup>

</FCParameters>
Chris Hennes
Pioneer Library System
GitHub profile, LinkedIn profile, chrishennes.com
User avatar
adrianinsaval
Veteran
Posts: 5534
Joined: Thu Apr 05, 2018 5:15 pm

Re: Need Help with Preference Pack

Post by adrianinsaval »

xml is a pain for manual edits :? wish we used something else.
User avatar
chennes
Veteran
Posts: 3868
Joined: Fri Dec 23, 2016 3:38 pm
Location: Norman, OK, USA
Contact:

Re: Need Help with Preference Pack

Post by chennes »

Maybe someone should write a better GUI for making preference packs 8-) .
Chris Hennes
Pioneer Library System
GitHub profile, LinkedIn profile, chrishennes.com
chrisb
Veteran
Posts: 53786
Joined: Tue Mar 17, 2015 9:14 am

Re: Need Help with Preference Pack

Post by chrisb »

chennes wrote: Tue Aug 09, 2022 5:50 pm You just have the settings in the wrong group: you're one level too deep, with your new setting in the MainWindow preferences area. It should just be Root->BaseApp->Preferences->General
Thanks for responding, but it isn't working, neither standalone as you posted it, nor integrated in my preferences.

After applying the preference pack, the icons stay as before, but the selection list is doubled like this:
Bildschirmfoto 2022-08-10 um 02.02.20.png
Bildschirmfoto 2022-08-10 um 02.02.20.png (105.9 KiB) Viewed 848 times

Code: Select all

OS: macOS 10.16
Word size of FreeCAD: 64-bit
Version: 0.21.29997 (Git)
Build type: Release
Branch: master
Hash: b52967d52ac46eff7c59e74d991f3f5b298944ef
Python 3.10.5, Qt 5.15.4, Coin 4.0.0, Vtk 9.1.0, OCC 7.6.2
Locale: C/Default (C)
Installed mods: 
  * FC_SU
  * FeedsAndSpeeds 0.4.0
  * fcgear 1.0.0
  * fasteners 0.3.51
  * sheetmetal 0.2.56
  * ExplodedAssembly
  * Curves 0.5.4
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
chrisb
Veteran
Posts: 53786
Joined: Tue Mar 17, 2015 9:14 am

Re: Need Help with Preference Pack

Post by chrisb »

adrianinsaval wrote: Tue Aug 09, 2022 5:58 pm xml is a pain for manual edits :? wish we used something else.
I'm not afraid of editing the xml file. But I need to know what I should do.

If I have identified a parameter in the user.cfg, these questions occurred to me
- should I include the whole enclosing "FCParamGroup" with all the other parameters on the same level? Or is it sufficient to include my parameter.
- am I right to include the whole path up to the "Root"?
- can the same FCParamGroup occur multiple times or do I have to integrate new stuff into an already existing one?
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
User avatar
chennes
Veteran
Posts: 3868
Joined: Fri Dec 23, 2016 3:38 pm
Location: Norman, OK, USA
Contact:

Re: Need Help with Preference Pack

Post by chennes »

After applying the pack, can you paste in your user.cfg file? (you can redact as necessary), I just want to see where it's ending up)

To answer your questions:
  • You only need your parameter, not all the others.
  • Yes, you should include the whole path, including root.
  • I'm not sure how the config loader handles having the same group multiple times: I'd guess it will work, but I'm not positive.
Chris Hennes
Pioneer Library System
GitHub profile, LinkedIn profile, chrishennes.com
chrisb
Veteran
Posts: 53786
Joined: Tue Mar 17, 2015 9:14 am

Re: Need Help with Preference Pack

Post by chrisb »

chennes wrote: Wed Aug 10, 2022 2:04 pm After applying the pack, can you paste in your user.cfg file? (you can redact as necessary), I just want to see where it's ending up)
Thanks for looking into this, and thanks for the explanations.

The zip file below contains 4 files:

1) After removing the config and restarting FreeCAD I have to terminate FreeCAD to get a config. userVanilla.cfg is this plain vanilla config.

2) Stopped FreeCAD, removed the config and restarted FreeCAD.
Applied the preference pack that contains only the icon size. This is userAfterPref.cfg. It shows many differences, perhaps due to reordering, so I attach both full configs

After stopping FreeCAD there are again few changes to the config, but they concern macros and toolbars, which seem irrelevant here.

3+4) Stopped FreeCAD, removed the config and restarted FreeCAD.
Applied a working preference pack. This is userWorkingPref.cfg
Didn't stop FreeCAD and applied the preference pack with the icon size. This is userIconAfterOtherPref.cfg.

Most interesting are probably 3 and 4, because they show nearly no differences. (Applying the non working preference pack multiple times changes the font entries to something seemingly sort of random.)
Attachments
user.zip
(12.57 KiB) Downloaded 13 times
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
User avatar
chennes
Veteran
Posts: 3868
Joined: Fri Dec 23, 2016 3:38 pm
Location: Norman, OK, USA
Contact:

Re: Need Help with Preference Pack

Post by chennes »

Are you self-compiled? I have one thing to try, but it will require a source code modification.
Chris Hennes
Pioneer Library System
GitHub profile, LinkedIn profile, chrishennes.com
chrisb
Veteran
Posts: 53786
Joined: Tue Mar 17, 2015 9:14 am

Re: Need Help with Preference Pack

Post by chrisb »

chennes wrote: Thu Aug 11, 2022 9:04 pm Are you self-compiled?
sorry, no.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
Post Reply