Trigger UI update after programmatic UI changes

A forum for research and development of the user interface of FreeCAD
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
drmacro
Veteran
Posts: 8977
Joined: Sun Mar 02, 2014 4:35 pm

Re: Trigger UI update after programmatic UI changes

Post by drmacro »

chennes wrote: Wed Aug 24, 2022 4:04 pm Preference Pack application is pretty braindead: there's no complex logic to it, FreeCAD just forms the union of the user's current settings and the settings in the pack. What FreeCAD actually does with that information is another question entirely, though: I don't know much about how the toolbar state is stored.
AFAICT, the toolbar location is added to, and saved, only when a user changes it during a session. It is in the Tux group in the params. So, specifying the groups in PP cfg work only if the specific groups already exist in the Tux section. So, on a fresh start (i.e. if the user.cfg has been removed and thus the Tux section is not populated) it doesn't add what is specified in the Tux section in the PP .cfg.

In the BaseApp section though, if you specify a completely unknown tag it will add it.
FYI, I've hunted down the bugs in the dependency code and am working on resolving them now. I'm hoping to finish that up later today.
Cool!
Star Trek II: The Wrath of Khan: Spock: "...His pattern indicates two-dimensional thinking."
User avatar
chennes
Veteran
Posts: 3904
Joined: Fri Dec 23, 2016 3:38 pm
Location: Norman, OK, USA
Contact:

Re: Trigger UI update after programmatic UI changes

Post by chennes »

drmacro wrote: Wed Aug 24, 2022 4:54 pm AFAICT, the toolbar location is added to, and saved, only when a user changes it during a session.
Yes -- it looks like FreeCAD is reading the config file on startup, and writing it on shutdown, but never looking at the actual config values in between, and it stores the actual locations of the toolbars, not the value of the config value. So as things stand now, to set the position of the toolbars you'll have to use the pre.FCMacro file. I think we should consider changing that behavior internally and making the toolbars actually watch the config values, but that might not be worth the trouble.

I've pushed the fix to the dependency code out to the git depot now, and I've also back ported that fix to the 0.20 branch for inclusion into 0.20.2.
Chris Hennes
Pioneer Library System
GitHub profile, LinkedIn profile, chrishennes.com
drmacro
Veteran
Posts: 8977
Joined: Sun Mar 02, 2014 4:35 pm

Re: Trigger UI update after programmatic UI changes

Post by drmacro »

chennes wrote: Wed Aug 24, 2022 8:50 pm
drmacro wrote: Wed Aug 24, 2022 4:54 pm AFAICT, the toolbar location is added to, and saved, only when a user changes it during a session.
Yes -- it looks like FreeCAD is reading the config file on startup, and writing it on shutdown, but never looking at the actual config values in between, and it stores the actual locations of the toolbars, not the value of the config value. So as things stand now, to set the position of the toolbars you'll have to use the pre.FCMacro file. I think we should consider changing that behavior internally and making the toolbars actually watch the config values, but that might not be worth the trouble.
I was thinking post.FCMcro...doesn't that happen after the <PP>
.cfg is read and paeans are updated?
I've pushed the fix to the dependency code out to the git depot now, and I've also back ported that fix to the 0.20 branch for inclusion into 0.20.2.
If it's in my git pull tomorrow morning I can give it a go.
Star Trek II: The Wrath of Khan: Spock: "...His pattern indicates two-dimensional thinking."
drmacro
Veteran
Posts: 8977
Joined: Sun Mar 02, 2014 4:35 pm

Re: Trigger UI update after programmatic UI changes

Post by drmacro »

@chennes

AM throws this when updates are attempted:

Code: Select all

Traceback (most recent call last):
13:01:58    File "/home/mac/fc-daily-build-occt77/Mod/AddonManager/AddonManager.py", line 1449, in update_all
13:01:58      functools.partial (self.subupdates_succeeded.append, repo)
13:01:58  NameError: name 'repo' is not defined
This is build 30193.

Edit: I see there was an update to AddonManager.py...rebuilding now.

Edit: 30196 same error.
Star Trek II: The Wrath of Khan: Spock: "...His pattern indicates two-dimensional thinking."
User avatar
chennes
Veteran
Posts: 3904
Joined: Fri Dec 23, 2016 3:38 pm
Location: Norman, OK, USA
Contact:

Re: Trigger UI update after programmatic UI changes

Post by chennes »

Sorry, I thought I had tested that, but it turns out those tests don't call that particular function :oops: Fixed (I think!) in git commit 283fec68.
Chris Hennes
Pioneer Library System
GitHub profile, LinkedIn profile, chrishennes.com
drmacro
Veteran
Posts: 8977
Joined: Sun Mar 02, 2014 4:35 pm

Re: Trigger UI update after programmatic UI changes

Post by drmacro »

@chennes

30199 has fixed the repo error.

AM refresh still stalls on the progress bar the first time it is run after FC restart on Manjaro (AUR) build of FC, but completes ok Debian.

Applying a pack with the following in package.xml does not install the depend.:

Code: Select all

  <content>
    <preferencepack>
      <name>BasicMech</name>
      <description>Testing PrefPack for FreeCAD</description>
      <tag>color</tag>
      <tag>dark</tag>
      <tag>mechanical</tag>
      <depend>Lattice2 Workbench</depend>
    </preferencepack>
  </content>
Star Trek II: The Wrath of Khan: Spock: "...His pattern indicates two-dimensional thinking."
User avatar
chennes
Veteran
Posts: 3904
Joined: Fri Dec 23, 2016 3:38 pm
Location: Norman, OK, USA
Contact:

Re: Trigger UI update after programmatic UI changes

Post by chennes »

drmacro wrote: Fri Aug 26, 2022 12:15 pm Applying a pack with the following in package.xml does not install the depend.:
We may be talking at cross-purposes here: the Addon Manager should be installing that dependency when you install the Addon containing the Preference Pack (and it does for me). Applying a preference pack doesn't do anything with dependencies.
Chris Hennes
Pioneer Library System
GitHub profile, LinkedIn profile, chrishennes.com
drmacro
Veteran
Posts: 8977
Joined: Sun Mar 02, 2014 4:35 pm

Re: Trigger UI update after programmatic UI changes

Post by drmacro »

chennes wrote: Fri Aug 26, 2022 6:58 pm
drmacro wrote: Fri Aug 26, 2022 12:15 pm Applying a pack with the following in package.xml does not install the depend.:
We may be talking at cross-purposes here: the Addon Manager should be installing that dependency when you install the Addon containing the Preference Pack (and it does for me). Applying a preference pack doesn't do anything with dependencies.
Tried both...

Why do I always see:

Code: Select all

Previous cache process interrupted , restating
when AM is started?

And the lower left of the AM dialog always says starting up.

Ok, the second time I launched AM it completed it's startup processes and then when I installed the PP, it asked about the depend.

But, it says Lattice2 can't be installed automatically. How does one know that about a workbench?
Star Trek II: The Wrath of Khan: Spock: "...His pattern indicates two-dimensional thinking."
User avatar
chennes
Veteran
Posts: 3904
Joined: Fri Dec 23, 2016 3:38 pm
Location: Norman, OK, USA
Contact:

Re: Trigger UI update after programmatic UI changes

Post by chennes »

It's lying, it installed it automatically for me! Can you post a screenshot of that error message?
Chris Hennes
Pioneer Library System
GitHub profile, LinkedIn profile, chrishennes.com
drmacro
Veteran
Posts: 8977
Joined: Sun Mar 02, 2014 4:35 pm

Re: Trigger UI update after programmatic UI changes

Post by drmacro »

Here are a few things on the machine where this occurs, Manjaro with FC installed from AUR:

Start FC, run AM:
AMStall.png
AMStall.png (29.47 KiB) Viewed 972 times
Second AM run (and subsequent runs) completes but show this when started:
Secondrun.png
Secondrun.png (9.4 KiB) Viewed 972 times
And when FC is shutdown it goes zombie:
Zombie.png
Zombie.png (22.64 KiB) Viewed 972 times
And the zombies show as these processes:

Code: Select all

ps -aux | grep FreeCAD                                                                                                                              ✔ 
mac         3110 13.3 15.5 3904844 1253488 pts/2 Sl+  07:30   2:24 FreeCAD
mac         5085  0.0  0.7 460656 60416 pts/2    S+   07:32   0:00 /usr/lib/qt/libexec/QtWebEngineProcess --type=zygote --no-zygote-sandbox --application-name=FreeCAD --webengine-schemes=qrc:sLV --lang=en
mac         5086  0.0  0.7 460656 60576 pts/2    S+   07:32   0:00 /usr/lib/qt/libexec/QtWebEngineProcess --type=zygote --application-name=FreeCAD --webengine-schemes=qrc:sLV --lang=en
mac         5088  0.0  0.1 460656 14252 pts/2    S+   07:32   0:00 /usr/lib/qt/libexec/QtWebEngineProcess --type=zygote --application-name=FreeCAD --webengine-schemes=qrc:sLV --lang=en
mac         6508 22.6 12.0 3677832 969456 ?      Sl   07:42   1:18 /usr/bin/FreeCAD
mac         6530  0.0  0.7 460656 62724 ?        S    07:42   0:00 /usr/lib/qt/libexec/QtWebEngineProcess --type=zygote --no-zygote-sandbox --application-name=FreeCAD --webengine-schemes=qrc:sLV --lang=en
mac         6531  0.0  0.7 460656 62888 ?        S    07:42   0:00 /usr/lib/qt/libexec/QtWebEngineProcess --type=zygote --application-name=FreeCAD --webengine-schemes=qrc:sLV --lang=en
mac         6533  0.0  0.1 460656 14164 ?        S    07:42   0:00 /usr/lib/qt/libexec/QtWebEngineProcess --type=zygote --application-name=FreeCAD --webengine-schemes=qrc:sLV --lang=en
mac         7338  0.0  0.0   6524  2448 pts/3    S+   07:48   0:00 grep FreeCAD
But, on my Debian machine where I run FC from the <build>/bin directroy, the PP installs, installs the depend and no AM first run oddities.

So, why would running from an installed version of FC make a difference?
Star Trek II: The Wrath of Khan: Spock: "...His pattern indicates two-dimensional thinking."
Post Reply