[Macro] Bit of help for super users :)

Need help, or want to share a macro? Post here!
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
openBrain
Veteran
Posts: 9041
Joined: Fri Nov 09, 2018 5:38 pm
Contact:

Re: [Macro] Bit of help for super users :)

Post by openBrain »

chrisb wrote: Sun Dec 29, 2019 6:28 pm Thanks for working on this. I would like to see the state immediately like I do now. Tooltip help is nice, but not for quick use.
A first try is ready : files updated at OP. ;)
You previously talk to parse a file to get the widgets. This isn't implemented (and I think won't be ATM), but you'll see tuning the tools in the status bar is more than easy.
Everything happens in the definition of the 'custBar' variable (Line 279 of current release).
It is a simple list whose each line is composed of :

Code: Select all

[Tool_Type, [Parameters]]
For your need, I introduced the type 'custParamToggler' that takes as minimal parameters 'Tool_Label, Parameter_Group, Parameter_Name' (look at Line 70 if you're curious :) ).
Thus let's say you want to add a tool button to toggle the previously described parameter, and eg. have it with label 'E', just add in the list of tools :

Code: Select all

,[custParamToggler, ['E', 'User parameter:BaseApp/Preferences/View', 'EnableSelection']]
With correct indentation obviously. The initial comma is needed if the tool isn't the first one in the list. ;)
2 extra things to notice. Firstly you're free to comment/delete any line that displays a tool that you don't want.
Secondly, 'custParamToggler' as any other tools supports middle click and right click functions (if only one is defined, it is attributed to both click types). This is added as extra parameter to the tool definition.
So let's say that you want only Visibility Tool, 'EnableSelection' parameter toggler, then Report view, Python console & Combo view togglers. Moreover, you want to keep a quick access to the Dependency Graph but a dedicated icon is too much and you want to add it as middle/right click on your parameter toggler. 'custBar' will then be like this :

Code: Select all

    custBar = [
        [visibilityTool, []]
        ,[custParamToggler, ['E', 'User parameter:BaseApp/Preferences/View', 'EnableSelection', lambda:Gui.runCommand('Std_ExportGraphviz',0)]]
        ,[custDockToggler, ['Report view','R', Gui.getMainWindow().findChild(QtGui.QTextEdit, 'Report view').clear]]
        ,[custDockToggler, ['Python console', 'Y', Gui.getMainWindow().findChild(QtGui.QPlainTextEdit, 'Python console').onClearConsole]]
        ,[custDockToggler, ['Combo View', 'C', getFCInfo]]
#        ,[custDockToggler, ['Selection view', 'S']]
#        ,[custDockToggler, ['Property view', 'P']]
#        ,[custDockToggler, ['Tree view', 'T']]
#        ,[custCmdRunner, ['D', ['Std_ExportGraphviz',0]]]
    ]
Notice I let 2 examples commented in the code at OP (1st is only parameter toggler, 2nd is parameter toggler with dependency graph on middle/right click).

Hope that help.
openBrain
Veteran
Posts: 9041
Joined: Fri Nov 09, 2018 5:38 pm
Contact:

Re: [Macro] Bit of help for super users :)

Post by openBrain »

Small bugfix available at OP. ;)
chrisb wrote: Sun Dec 29, 2019 6:28 pm Thanks for working on this. I would like to see the state immediately like I do now. Tooltip help is nice, but not for quick use.
@chrisb, did you get some time to test the parameter toggler ?
chrisb
Veteran
Posts: 54150
Joined: Tue Mar 17, 2015 9:14 am

Re: [Macro] Bit of help for super users :)

Post by chrisb »

openBrain wrote: Wed Jan 01, 2020 12:13 pm @chrisb, did you get some time to test the parameter toggler ?
I need some time interval without expected interruptions to try this. Hope to find this interval tonight.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
openBrain
Veteran
Posts: 9041
Joined: Fri Nov 09, 2018 5:38 pm
Contact:

Re: [Macro] Bit of help for super users :)

Post by openBrain »

New bugfix at OP (bug introduced by previous update of the day :?)
chrisb
Veteran
Posts: 54150
Joined: Tue Mar 17, 2015 9:14 am

Re: [Macro] Bit of help for super users :)

Post by chrisb »

chrisb wrote: Wed Jan 01, 2020 3:47 pm
openBrain wrote: Wed Jan 01, 2020 12:13 pm @chrisb, did you get some time to test the parameter toggler ?
I need some time interval without expected interruptions to try this. Hope to find this interval tonight.
Works great! This was much easier than answering some posts :D . I had thought it was much more elementary, and was looking for something to call my own function.
Now I see that everything is ready for my personal needs - and additionally for similar future needs.

Thanks!
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
openBrain
Veteran
Posts: 9041
Joined: Fri Nov 09, 2018 5:38 pm
Contact:

Re: [Macro] Bit of help for super users :)

Post by openBrain »

chrisb wrote: Wed Jan 01, 2020 11:42 pm Works great! This was much easier than answering some posts :D . I had thought it was much more elementary, and was looking for something to call my own function.
Now I see that everything is ready for my personal needs - and additionally for similar future needs.
Excellent. This is great test that it is understandable enough so a user without deep Python knowledge can tune it to its need. ;)
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: [Macro] Bit of help for super users :)

Post by Kunda1 »

What about adding the Macro_Snip macro to this macro ? (To streamline adding screenshots from FC in to the forum)
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
chrisb
Veteran
Posts: 54150
Joined: Tue Mar 17, 2015 9:14 am

Re: [Macro] Bit of help for super users :)

Post by chrisb »

+1
And copying the FreeCAD infos is a good candidate as well.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
openBrain
Veteran
Posts: 9041
Joined: Fri Nov 09, 2018 5:38 pm
Contact:

Re: [Macro] Bit of help for super users :)

Post by openBrain »

Kunda1 wrote: Sun Mar 22, 2020 10:40 pm What about adding the Macro_Snip macro to this macro ? (To streamline adding screenshots from FC in to the forum)
On my side, I'm happy with (even actually I prefer) dedicated applications (I use FlameShot on Linux and GreenShot on Windows). But if there is a need, I'd say "why not ?". :)
Actually I have to find a bit of time to work again on this macro. I'm focusing on trying to fix some bugs in FC now to help prepare the release (with limited success I admit :D ).
chrisb wrote: Mon Mar 23, 2020 1:22 am And copying the FreeCAD infos is a good candidate as well.
:shock: We already did it. :lol:
Kunda1 wrote: Wed Dec 04, 2019 5:45 pm Nice, I wonder if @chrisb would be willing to add the macro he was working on(?) to quickly get the Help > About FreeCAD info in to this macro/wb ?
It's bound to 'C' (Combo View button) middle/right click. ;)
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: [Macro] Bit of help for super users :)

Post by Kunda1 »

openBrain wrote: Mon Mar 23, 2020 9:24 am
Thanks for the reply and all you work ;)
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
Post Reply