[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:

[Macro] Bit of help for super users :)

Post by openBrain »

Hi all,

Goal of this was to have a macro that can offer some tools to ease life of "super users" that use FC in a non-conventional way (diagnose files posted on the forum, write some python routines to solve issues, ...).
ATM this is very basic. It creates a set of buttons located at the far right of the status bar. Usage will be easily described by the below picture :
FC_SU.png
FC_SU.png (64.52 KiB) Viewed 2603 times
Another feature is to add on all dock widgets a slider that changes font size. The slider appears when a middle click is done on the widget status bar, then disappeared automatically when no action is performed. Below a dummy screencast to demonstrate :
fontSizer.gif
fontSizer.gif (430.89 KiB) Viewed 2720 times
It is now really not polished (no comment in the code, no check to prevent exceptions, ...) but I posted it in this alpha state to get feedback about if some others also find it useful, and what features can be added to improve it. ;)

EDIT : 2019/11/29 : Tree view is handled + right click can be used instead of middle click / Picture above not updated :)
EDIT : 2019/11/29 : Add imports of FreeCAD & FreeCADGui to be sure they are loaded
EDIT : 2019/11/30 : File extension is now '.py' and internal 'run()' function is available to programmatically run it
EDIT : 2019/12/01 : Add auto startup version as ZIP file. To be unzipped in the user 'Mod' folder (keep the including subfolder)
EDIT : 2019/12/04 : Add new tool that allow to change font size in dock widgets
EDIT : 2019/12/05 : Add helper to get full FC info as middle click on the 'C' Combo View toggler
EDIT : 2019/12/08 : Add the visibility 'V' tool / Description here to be updated (in between, please look at same date post in this thread)
EDIT : 2019/12/11 : Fix a PySide compatibility issue with FC 0.18 version
EDIT : 2019/12/13 : Update above description picture
EDIT : 2019/12/29 : Some fixes + increasing classes flexibility + adding new widget type to toggle boolean parameter
EDIT : 2020/01/01 : Bugfix (x2)
Attachments
FC_SU.py
(11.52 KiB) Downloaded 87 times
FC_SU.zip
(3.65 KiB) Downloaded 63 times
Last edited by openBrain on Wed Jan 01, 2020 5:42 pm, edited 13 times in total.
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 »

This is great. Will test when I'm back in front of my machine.
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
User avatar
DeepSOIC
Veteran
Posts: 7896
Joined: Fri Aug 29, 2014 12:45 am
Location: used to be Saint-Petersburg, Russia

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

Post by DeepSOIC »

tree view, please. That's the only one I need, I think.
User avatar
DeepSOIC
Veteran
Posts: 7896
Joined: Fri Aug 29, 2014 12:45 am
Location: used to be Saint-Petersburg, Russia

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

Post by DeepSOIC »

openBrain wrote: Thu Nov 28, 2019 1:34 pm Middle-click = clear
too bad I can't middle-click with touchscreen/touchpad. Anyway, right-click->clear in the corresponding view is good enough.
openBrain
Veteran
Posts: 9041
Joined: Fri Nov 09, 2018 5:38 pm
Contact:

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

Post by openBrain »

DeepSOIC wrote: Fri Nov 29, 2019 4:15 pm tree view, please. That's the only one I need, I think.
Will update as soon as I have a computer available. ;)
In between, I have no doubt that you're skill enough to add it by yourself. By the end of the macro, there is a list that defines the buttons in a (quite) simple way. Just copying how the eg. Property view is handled and adapting it to Tree view should be a matter of seconds. :) After updating, just run again the macro and it will refresh itself.
openBrain
Veteran
Posts: 9041
Joined: Fri Nov 09, 2018 5:38 pm
Contact:

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

Post by openBrain »

DeepSOIC wrote: Fri Nov 29, 2019 4:15 pm tree view, please. That's the only one I need, I think.
DeepSOIC wrote: Fri Nov 29, 2019 4:20 pm too bad I can't middle-click with touchscreen/touchpad. Anyway, right-click->clear in the corresponding view is good enough.
Macro attached to OP update :
* Tree view is handled
* Right click can be used instead of middle click (this is OK as long as right click has non function)
Thx for feedback. ;)
User avatar
DeepSOIC
Veteran
Posts: 7896
Joined: Fri Aug 29, 2014 12:45 am
Location: used to be Saint-Petersburg, Russia

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

Post by DeepSOIC »

Added it to my module of hacks, changed if __name__ == "__main__" thing to be a def run:. Error:

Code: Select all

Traceback (most recent call last):
  File "<string>", line 120, in InitApplications
  File "<string>", line 5, in <module>
  File "C:\Users\EMB\AppData\Roaming\FreeCAD\Mod\DeepConsole\FC_SU.py", line 64, in run
    [custDockToggler, ['Report view','R', Gui.getMainWindow().findChild(QtGui.QTextEdit, 'Report view').clear]],
NameError: name 'Gui' is not defined
I know how to fix, just informing
User avatar
DeepSOIC
Veteran
Posts: 7896
Joined: Fri Aug 29, 2014 12:45 am
Location: used to be Saint-Petersburg, Russia

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

Post by DeepSOIC »

strange, but if I run it from InitGui.py, the only button I get is "D". If run manually, I get more buttons.
openBrain
Veteran
Posts: 9041
Joined: Fri Nov 09, 2018 5:38 pm
Contact:

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

Post by openBrain »

DeepSOIC wrote: Fri Nov 29, 2019 8:15 pm strange, but if I run it from InitGui.py, the only button I get is "D". If run manually, I get more buttons.
I didn't try this kind of things, but it looks like dock widgets aren't yet created when you run the macro in the first case. ;)
openBrain
Veteran
Posts: 9041
Joined: Fri Nov 09, 2018 5:38 pm
Contact:

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

Post by openBrain »

DeepSOIC wrote: Fri Nov 29, 2019 8:10 pm Added it to my module of hacks, changed if __name__ == "__main__" thing to be a def run:. Error:
I know how to fix, just informing
Good to have testers that try advanced things. Will add the imports and update (in few minutes).

For the usage you described, would that help if I set the main instructions in a def run() and change to :

Code: Select all

if __name__ == "__main__":
    run()
:?:
Post Reply