Trigger UI update after programmatic UI changes
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Be nice to others! Respect the FreeCAD code of conduct!
Trigger UI update after programmatic UI changes
@chennes
It appears the position of toolbars is stored in the parameter config in "Tux>PersistentToolbars>... per workbench when the toolbar position is changed.
But, when it is changed via macro, the UI doesn't update until FC is restarted.
For instance I am setting the appropriate values in Tux to have the File toolbar be on the left in a post.FCMacro in a pref pack. But, it doesn't change when the pack is applied. (Other pack settings do, for instance the stylesheet and activating the report view and python console.)
It appears the position of toolbars is stored in the parameter config in "Tux>PersistentToolbars>... per workbench when the toolbar position is changed.
But, when it is changed via macro, the UI doesn't update until FC is restarted.
For instance I am setting the appropriate values in Tux to have the File toolbar be on the left in a post.FCMacro in a pref pack. But, it doesn't change when the pack is applied. (Other pack settings do, for instance the stylesheet and activating the report view and python console.)
Star Trek II: The Wrath of Khan: Spock: "...His pattern indicates two-dimensional thinking."
Re: Trigger UI update after programmatic UI changes
That has to do with how exactly those things are handled within the code: many settings are only read in at the time they are needed, and are not re-examined later (or watched for changes) by the handling code. For example, just changing the stored recent files list is not enough to trigger the menu to get rebuilt. I don't know how to trigger the toolbar code to re-read its settings, but you could look at ToolBarManager, which provides a "restoreState" function. I don't think those functions are directly exposed to Python -- I don't know if that is a deliberate design decision, or just something that we haven't gotten around to.
Re: Trigger UI update after programmatic UI changes
Is it possible to flag the restart process that is seen when Addon manager installs/updates a workbench?chennes wrote: ↑Sat Aug 20, 2022 10:39 pm That has to do with how exactly those things are handled within the code: many settings are only read in at the time they are needed, and are not re-examined later (or watched for changes) by the handling code. For example, just changing the stored recent files list is not enough to trigger the menu to get rebuilt. I don't know how to trigger the toolbar code to re-read its settings, but you could look at ToolBarManager, which provides a "restoreState" function. I don't think those functions are directly exposed to Python -- I don't know if that is a deliberate design decision, or just something that we haven't gotten around to.
Star Trek II: The Wrath of Khan: Spock: "...His pattern indicates two-dimensional thinking."
Re: Trigger UI update after programmatic UI changes
You can see the code that does it here: https://github.com/FreeCAD/FreeCAD/blob ... es.py#L106
Re: Trigger UI update after programmatic UI changes
Every workbench calls that? Or does the Addon manager call that when a workbench is installed and the user closes the Addon dialog?chennes wrote: ↑Sat Aug 20, 2022 11:31 pm You can see the code that does it here: https://github.com/FreeCAD/FreeCAD/blob ... es.py#L106
Star Trek II: The Wrath of Khan: Spock: "...His pattern indicates two-dimensional thinking."
Re: Trigger UI update after programmatic UI changes
That's the code the Addon Manager uses to actually restart FreeCAD -- the new workbenches don't really "exist" yet as far as FreeCAD is concerned. So it's not something a WB does, it's something the AM does.
Re: Trigger UI update after programmatic UI changes
Right, so what tells AM that it should pop the restart dialog?
I also realized I was thinking about the wrong point in the process anyway.
What I really want is when a PP is applied to tell the user to see all the changes they need to restart.
Could I pop a dialog from the post.FCMacro?
Speaking of pre and post .FCMacro, can they be .py ?
Star Trek II: The Wrath of Khan: Spock: "...His pattern indicates two-dimensional thinking."
Re: Trigger UI update after programmatic UI changes
@chennes
I deleted my earlier post about this because it looked something I did fixed it...
But, for some reason the PP shows up in AM as in All.
And, when a change is pushed to github, "blob" is added to the url and it can't read the README.
It shows fine in Preferences PP though.
I deleted my earlier post about this because it looked something I did fixed it...
But, for some reason the PP shows up in AM as in All.
And, when a change is pushed to github, "blob" is added to the url and it can't read the README.
It shows fine in Preferences PP though.
Star Trek II: The Wrath of Khan: Spock: "...His pattern indicates two-dimensional thinking."
Re: Trigger UI update after programmatic UI changes
When it installs or updates a workbench, it sets an internal flag to True. Then, when you close the AM, it sees that flag and pops open a dialog. That dialog's OK button triggers a 1 second timer that then triggers the restart using the code I linked.
Yes, that's where I'd do it.Could I pop a dialog from the post.FCMacro?
You mean the extension? No, the code only looks for .FCMacro. That would be easy to change, of course.Speaking of pre and post .FCMacro, can they be .py ?
Re: Trigger UI update after programmatic UI changes
The "blob" is the rendered version of the README, it's supposed to do that. You can take a look at the ProDark preference pack to see what its supposed to look like.