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: 8870
Joined: Sun Mar 02, 2014 4:35 pm

Re: Trigger UI update after programmatic UI changes

Post by drmacro »

chennes wrote: Mon Aug 22, 2022 4:26 pm That is indeed how it is supposed to work: I’m doing some refactoring in that area now, I’ll add a test case.
My first attempt was to get it to add Glass...of course Glass does not fit the required definitions, so it not working is no surprise.

But, I have been unable to get any workbench to be added, lattice, etc.
Star Trek II: The Wrath of Khan: Spock: "...His pattern indicates two-dimensional thinking."
User avatar
chennes
Veteran
Posts: 3883
Joined: Fri Dec 23, 2016 3:38 pm
Location: Norman, OK, USA
Contact:

Re: Trigger UI update after programmatic UI changes

Post by chennes »

Right now you are trying to use Lattice2, but actually the official name of that WB is "Lattice2 Workbench" (with the word Workbench, and a space before it). A dependency has to match the exact contents of the <name> tags of the WB. Can you update your package.xml file and try again?
Chris Hennes
Pioneer Library System
GitHub profile, LinkedIn profile, chrishennes.com
drmacro
Veteran
Posts: 8870
Joined: Sun Mar 02, 2014 4:35 pm

Re: Trigger UI update after programmatic UI changes

Post by drmacro »

chennes wrote: Tue Aug 23, 2022 8:58 pm Right now you are trying to use Lattice2, but actually the official name of that WB is "Lattice2 Workbench" (with the word Workbench, and a space before it). A dependency has to match the exact contents of the <name> tags of the WB. Can you update your package.xml file and try again?
Umm...what you see is the current state of the value. I tried several different workbenches and various versions of the names to no avail. In this case the <name> value was used in previous attempts. I'll look again tomorrow. (But, this won't work anyway for something like Glass. Right?)

The wiki says the canonical name...I don't know the canon is for workbench names. So I tried the ones in the github for the AM. None that I tried were loaded after the PP was applied or when PP was installed
Star Trek II: The Wrath of Khan: Spock: "...His pattern indicates two-dimensional thinking."
User avatar
chennes
Veteran
Posts: 3883
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 the wiki is unclear: what you need is the name in the <name> tags of the WB's package.xml file. So here:
https://github.com/DeepSOIC/Lattice2/bl ... age.xml#L3

In your package.xml, you have:
https://github.com/macdroid53/BasicMech ... ge.xml#L18
Chris Hennes
Pioneer Library System
GitHub profile, LinkedIn profile, chrishennes.com
drmacro
Veteran
Posts: 8870
Joined: Sun Mar 02, 2014 4:35 pm

Re: Trigger UI update after programmatic UI changes

Post by drmacro »

chennes wrote: Tue Aug 23, 2022 9:23 pm Sorry the wiki is unclear: what you need is the name in the <name> tags of the WB's package.xml file. So here:
https://github.com/DeepSOIC/Lattice2/bl ... age.xml#L3

In your package.xml, you have:
https://github.com/macdroid53/BasicMech ... ge.xml#L18
Um...I know what is in my package.xml. That is just the last thing I tried...after trying several different variations and trying other workbenches. It sits there because I gave up at that point.
Star Trek II: The Wrath of Khan: Spock: "...His pattern indicates two-dimensional thinking."
drmacro
Veteran
Posts: 8870
Joined: Sun Mar 02, 2014 4:35 pm

Re: Trigger UI update after programmatic UI changes

Post by drmacro »

chennes wrote: Tue Aug 23, 2022 9:23 pm Sorry the wiki is unclear: what you need is the name in the <name> tags of the WB's package.xml file. So here:
https://github.com/DeepSOIC/Lattice2/bl ... age.xml#L3

In your package.xml, you have:
https://github.com/macdroid53/BasicMech ... ge.xml#L18
I was too curious to wait until the morning...
  • I updated the BasicMech package.xml to specifically what is in the Lattice2 package.xml...I did a copy and paste to assure my terrible typing skills didn't mess it up.
  • I then went to my test machine and removed BasicMech.
  • I restarted FC and re-installed BasicMech via AM (install did not add Lattice2)
  • I restarted FC and, in Preferences applied the PP (Lattice2 still not resident)
I am expecting the <depend> to be fulfilled by adding Lattice2. Am I expecting the wrong result?
Star Trek II: The Wrath of Khan: Spock: "...His pattern indicates two-dimensional thinking."
User avatar
chennes
Veteran
Posts: 3883
Joined: Fri Dec 23, 2016 3:38 pm
Location: Norman, OK, USA
Contact:

Re: Trigger UI update after programmatic UI changes

Post by chennes »

After updating your XML file did you have the Addon Manager recache? I'm now getting a message about that missing dependency. It's the wrong message (so a bug on my part), but I am getting the correct dependency information from your package.xml file.

ETA: Interesting, another bug is that you have to restart FreeCAD (or maybe only the AM?) to get the recached data to accurately reflect the new dependency. Clearly not working as intended there...
Chris Hennes
Pioneer Library System
GitHub profile, LinkedIn profile, chrishennes.com
drmacro
Veteran
Posts: 8870
Joined: Sun Mar 02, 2014 4:35 pm

Re: Trigger UI update after programmatic UI changes

Post by drmacro »

chennes wrote: Tue Aug 23, 2022 11:05 pm After updating your XML file did you have the Addon Manager recache? I'm now getting a message about that missing dependency. It's the wrong message (so a bug on my part), but I am getting the correct dependency information from your package.xml file.

ETA: Interesting, another bug is that you have to restart FreeCAD (or maybe only the AM?) to get the recached data to accurately reflect the new dependency. Clearly not working as intended there...
AM was/is having a problem, on my test machine, in that the progress bar never completes the first time AM is launched after FC is started. But updates are found. There are also messages about refresh taking too long.
Star Trek II: The Wrath of Khan: Spock: "...His pattern indicates two-dimensional thinking."
drmacro
Veteran
Posts: 8870
Joined: Sun Mar 02, 2014 4:35 pm

Re: Trigger UI update after programmatic UI changes

Post by drmacro »

@chennes

It appears that applying a pack does not add Tux/PersistentToolbars/User setings if specified in the PP .cfg file.

Is this a PP thing or because FC doesn't register that toolbar positions have not changed?
Star Trek II: The Wrath of Khan: Spock: "...His pattern indicates two-dimensional thinking."
User avatar
chennes
Veteran
Posts: 3883
Joined: Fri Dec 23, 2016 3:38 pm
Location: Norman, OK, USA
Contact:

Re: Trigger UI update after programmatic UI changes

Post by chennes »

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.

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.
Chris Hennes
Pioneer Library System
GitHub profile, LinkedIn profile, chrishennes.com
Post Reply