PersistentToolbars

Need help, or want to share a macro? Post here!
User avatar
sgrogan
Posts: 3005
Joined: Wed Oct 22, 2014 5:02 pm

Re: PersistentToolbars

Postby sgrogan » Wed Aug 17, 2016 10:19 pm

triplus wrote:Changelog:

Restore toolbars for default workbench on FreeCAD start

I just updated and this works as expected on Win.
I suggest that this is added to "https://github.com/FreeCAD/FreeCAD-addons"
Maybe this can also serve as a test for @Mandeep_Singh's work on the plugin manager.
I will definitely advertise this, as it comes up quite frequently in the forum.
Thanks triplus very nice feature.
triplus
Posts: 4866
Joined: Mon Dec 12, 2011 4:45 pm

Re: PersistentToolbars

Postby triplus » Thu Aug 18, 2016 1:22 pm

sgrogan wrote:
triplus wrote:Changelog:

Restore toolbars for default workbench on FreeCAD start

I just updated and this works as expected on Win.
I suggest that this is added to "https://github.com/FreeCAD/FreeCAD-addons"
Maybe this can also serve as a test for @Mandeep_Singh's work on the plugin manager.
I will definitely advertise this, as it comes up quite frequently in the forum.
Thanks triplus very nice feature.


You're welcome and yes for sure it can be added there. What is the procedure to do that?
User avatar
sgrogan
Posts: 3005
Joined: Wed Oct 22, 2014 5:02 pm

Re: PersistentToolbars

Postby sgrogan » Thu Aug 18, 2016 10:18 pm

triplus wrote:You're welcome and yes for sure it can be added there. What is the procedure to do that?

I think you can either ask Yorik here in the forum or open an issue at the FreeCAD-addons repo requesting inclusion. It would be good to find a way to help Yorik with this. I saw your post in http://forum.freecadweb.org/viewtopic.php?f=10&t=15926&start=20#p134609 I trust Yorik's judgement explicitly, but as the number of addons increases it places a even greater burden on him. A way to pre-screen these requests before submitting to yorik would be valuable IMHO. This is of course what you have done, but inexplicably there hasn't been much traffic? The functionality is often requested on the forum.
triplus
Posts: 4866
Joined: Mon Dec 12, 2011 4:45 pm

Re: PersistentToolbars

Postby triplus » Thu Aug 18, 2016 11:06 pm

sgrogan wrote:I think you can either ask Yorik here in the forum or open an issue at the FreeCAD-addons repo requesting inclusion.


I see. I guess i will wait a bit to see if any issues will be reported by FreeCAD users in the following days. If not i will probably open a request on GitHub for inclusion.

It would be good to find a way to help Yorik with this. I saw your post in http://forum.freecadweb.org/viewtopic.php?f=10&t=15926&start=20#p134609 I trust Yorik's judgement explicitly, but as the number of addons increases it places a even greater burden on him. A way to pre-screen these requests before submitting to yorik would be valuable IMHO. This is of course what you have done, but inexplicably there hasn't been much traffic? The functionality is often requested on the forum.


From code audit perspective i think we are pushing the limit. That is by using Git submodules likely only parts of code need to be looked at. Probably involving FreeCAD users to test upstream code before updating corresponding Git submodule could work out.

I am not sure to be honest and in the end i guess we will just have to wait and see. But first thing to sort out is i guess to have a package manager regular FreeCAD users will frequently use with ease.
Raph82
Posts: 8
Joined: Mon Feb 09, 2015 2:07 pm

Re: PersistentToolbars

Postby Raph82 » Fri Aug 19, 2016 2:09 pm

Thanks Triplus, your mod brings a very user friendly functionality!
I'm using it!
mario52
Posts: 1845
Joined: Wed May 16, 2012 2:13 pm

Re: PersistentToolbars

Postby mario52 » Sat Aug 20, 2016 10:10 am

hi
Thanks really convenient

mario
Windows 10
Maybe you need a special feature, go into Macros_recipes and Code_snippets. My macros on Gist.github
pablogil
Posts: 505
Joined: Wed Nov 26, 2014 3:19 pm
Location: Badajoz (Spain)
Contact:

Re: PersistentToolbars

Postby pablogil » Sun Aug 28, 2016 11:27 am

Hi @triplus,

I have found what seems to be a bug: I have set Part Design as my default FreeCAD workbench, so when I open FreeCAD it loads this one; if I close FreeCAD while on Draft workbench, the next time I open FreeCAD it loads that way:
part_design.png
part_design.png (96.25 KiB) Viewed 298 times

Parameter editor value for Part Design/Top reads:

Code: Select all

True.,.TabBar.,.True.,.File.,.View.,.Shortcuts.,.True.,.Part Design.,.Sketcher constraints.,.True.,.Sketcher tools.,.Sketcher geometries


Is anything wrong?
Thanks
Dark and Light stylesheets v2.0 to theme your FreeCAD UI, more information here
triplus
Posts: 4866
Joined: Mon Dec 12, 2011 4:45 pm

Re: PersistentToolbars

Postby triplus » Sun Aug 28, 2016 1:01 pm

Hi @pablogil and thanks for the detailed report.

As draftToolBar position wasn't yet configured it's considered to be a New toolbar to PersistentToolbars. Therefore it's on the top for user to notice it and to set its position accordingly. Now as for what is draftToolBar doing in PartDesign workbench. Some background on this. There are 4 toolbars that i am aware of that i guess we can call Python based toolbars. By default FreeCAD provides 2 in Draft/Arch. Such toolbars have their own mechanism to enable/disable them on workbench activation/deactivation. Therefore mechanism to store/restore toolbar position for such toolbars need to do that manually for them as it doesn't work "by default" compared to the rest of the toolbars.

Now i tested your use case and for me draftToolBar doesn’t show up in PartDesign. Therefore there must be some additional condition we yet have to discover. I was thinking you might have Draft/Arch module set as Autoload module in TabBar? In my tests i don't get the result you get but this is the only thing i can think of that could lead to such result.

P.S. As likely Draft/Arch workbench needs to be loaded before PartDesign workbench to get such results.
triplus
Posts: 4866
Joined: Mon Dec 12, 2011 4:45 pm

Re: PersistentToolbars

Postby triplus » Wed Mar 01, 2017 12:05 am

I have been working on PersistentToolbars in parallel with other FreeCAD related projects in the past weeks. I won't have much time in the following days therefore i decided to share the plan. I will first update the code on my GitHub (this or next weekend) and after it can be evaluated if the functionality should be upstreamed.

Testing and feedback will be welcomed.

There was one mayor issue and that is currently FreeCAD manages things like workbench toolbar visibility on C++ level. PersistentToolbars in addition manage toolbar position on workbench level (Python). I tried everything i could think of first on the PersistentToolbars level. After i changed the code on C++ level to let PersistentToolbars do most of the work. Nothing worked as toolbars and toolbar area flickered too much when changing workbench. In the end i discovered hidden toolbars form a grid in toolbar area and you must make sure to manage hidden toolbar position in addition to visible toolbar position. I choose the approach to always sort visible ones first and in addition move the hidden ones after them. That results in hidden toolbars when made visible to not pop up all over the visible toolbar area in unexpected places before positioned. In addition usually that doesn't results in expanding the toolbar area unnecessarily.

I decided to share this information if at some point in the future somebody else will be working on this to have some reference.
User avatar
kkremitzki
Posts: 326
Joined: Thu Mar 03, 2016 9:52 pm
Location: Texas

Re: PersistentToolbars

Postby kkremitzki » Wed Mar 01, 2017 2:44 am

Thanks for your work on this. Hopefully it can be upstreamed into your Tux module because it increases the usability of FreeCAD a lot. So far I've had pretty good performance but if you want more testing of a dev branch I'd be glad to.