[Macro] Bit of help for super users :)

Need help, or want to share a macro? Post here!
openBrain
Posts: 3089
Joined: Fri Nov 09, 2018 5:38 pm

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

Post by openBrain » Sun Dec 29, 2019 8:41 pm

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
Posts: 3089
Joined: Fri Nov 09, 2018 5:38 pm

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

Post by openBrain » Wed Jan 01, 2020 12:13 pm

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
Posts: 21407
Joined: Tue Mar 17, 2015 9:14 am

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

Post by chrisb » 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.
openBrain
Posts: 3089
Joined: Fri Nov 09, 2018 5:38 pm

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

Post by openBrain » Wed Jan 01, 2020 5:43 pm

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

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

Post by chrisb » Wed Jan 01, 2020 11:42 pm

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!
openBrain
Posts: 3089
Joined: Fri Nov 09, 2018 5:38 pm

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

Post by openBrain » Thu Jan 02, 2020 10:41 am

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. ;)
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests