Draft Snap toolbar persistence

Have some feature requests, feedback, cool stuff to share, or want to know where FreeCAD is going? This is the place.
Forum rules
Be nice to others! Read the FreeCAD code of conduct!
triplus
Veteran
Posts: 9471
Joined: Mon Dec 12, 2011 4:45 pm

Draft Snap toolbar persistence

Post by triplus »

I noticed this in the past as if i remember correctly Draft Snap toolbar showed up in Lattice WB. At that time i didn’t pay much attention to this but during my work on TabBar i noticed the following behaviour:

Draft WB -> Draft Snap toolbar disabled in View -> Toolbars menu. If i click on any tool on Draft creation tools Draft Snap toolbar is enabled automatically.

Question. Would any functionality be lost if Draft Snap toolbar would respect the setting in View -> Toolbars menu instead?
User avatar
yorik
Founder
Posts: 13664
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels
Contact:

Re: Draft Snap toolbar persistence

Post by yorik »

triplus wrote:Question. Would any functionality be lost if Draft Snap toolbar would respect the setting in View -> Toolbars menu instead?
No, you just could not modify the draft snaps...
triplus
Veteran
Posts: 9471
Joined: Mon Dec 12, 2011 4:45 pm

Re: Draft Snap toolbar persistence

Post by triplus »

yorik wrote:
triplus wrote:Question. Would any functionality be lost if Draft Snap toolbar would respect the setting in View -> Toolbars menu instead?
No, you just could not modify the draft snaps...
I looked in the Draft Settings and i see there actually is a setting that controls this behaviour. I unchecked the Show Draft Snap toolbar setting and set View -> Toolbars -> Draft Snap to off. After i could use the tool from Draft creation tools toolbar and Draft Snap toolbar was not enabled automatically anymore!

That is good news but there is one more issue involved. After i switch to another workbench and back Snap Draft toolbar is enabled again and it doesn't persist in off state. Therefore i guess this could count as a bug? I didn't investigate the code but probably the logic implemented to determine what toolbars belong to the workbench and the way you turn on/off the setting for the toolbar are in slight conflict. That is probably the reason i found Draft Snap toolbar in Lattice WB.

And there is one more question i have why isn't Utilities toolbar listed in View -> Toolbars. It looks like this was done intentionally?
User avatar
yorik
Founder
Posts: 13664
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels
Contact:

Re: Draft Snap toolbar persistence

Post by yorik »

triplus wrote:why isn't Utilities toolbar listed in View -> Toolbars. It looks like this was done intentionally?
I think only toolbars added by the standard WB mechanism are there... Since this toolbar is a bit special (the buttons must stay presssed), I did it directly from pyside, so it doesn't appear there. I don't think it is possible ATM.
triplus
Veteran
Posts: 9471
Joined: Mon Dec 12, 2011 4:45 pm

Re: Draft Snap toolbar persistence

Post by triplus »

yorik wrote:
triplus wrote:why isn't Utilities toolbar listed in View -> Toolbars. It looks like this was done intentionally?
I think only toolbars added by the standard WB mechanism are there... Since this toolbar is a bit special (the buttons must stay presssed), I did it directly from pyside, so it doesn't appear there. I don't think it is possible ATM.
I see. Thanks for the insight. ATM i guess this isn't all that important but as i stumble on something i rather ask if it's not clear to me what is going on.

As for putting the toolbar in toolbars menu i guess it might be possible as i guess 3rd Party module PCB has the same type of toolbars and they are listed in the toolbars menu. But it is true the setting doesn't persist for them when switching workbench.
triplus
Veteran
Posts: 9471
Joined: Mon Dec 12, 2011 4:45 pm

Re: Draft Snap toolbar persistence

Post by triplus »

Hi Yorik.

This won't happen anytime soon but eventually i would like for snap toolbar commands to work with my modules. Are you OK with me looking into this and make the needed changes in Draft WB in the future?

P.S. If yes when i will have something i will consult with you first to see if you are OK with the changes made.
User avatar
yorik
Founder
Posts: 13664
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels
Contact:

Re: Draft Snap toolbar persistence

Post by yorik »

sure, go ahead...
triplus
Veteran
Posts: 9471
Joined: Mon Dec 12, 2011 4:45 pm

Re: Draft Snap toolbar persistence

Post by triplus »

triplus
Veteran
Posts: 9471
Joined: Mon Dec 12, 2011 4:45 pm

Re: Draft Snap toolbar persistence

Post by triplus »

OK i started working on this and the first thing i did is i made commands from Draft Snap toolbar reusable:
PieMenu.png
PieMenu.png (18.97 KiB) Viewed 2352 times
I did explore different possibilities on how to create standard FreeCAD toolbar out of it. But some things are missing ATM and i came to a conclusion it isn't possible to achieve such goal in straightforward fashion. Therefore i just changed the current Draft Snap toolbar to allow commands from it to be reused. In addition i reset the toolbar/toolbutton size to default values:
BeforeAfter.png
BeforeAfter.png (27.72 KiB) Viewed 2352 times
The size change proposal is optional and it is not needed for command reuse purposes. Change can be reverted if decided current behaviour is more desirable.

https://github.com/FreeCAD/FreeCAD/pull/671
triplus
Veteran
Posts: 9471
Joined: Mon Dec 12, 2011 4:45 pm

Re: Draft Snap toolbar persistence

Post by triplus »

WhatsThis command should now work on Draft Snap toolbar commands:

https://github.com/FreeCAD/FreeCAD/pull/962
Post Reply