Autoload

A forum for research and development of the user interface of FreeCAD
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
chrisb
Veteran
Posts: 53930
Joined: Tue Mar 17, 2015 9:14 am

Re: Autoload

Post by chrisb »

triplus wrote: Fri Jun 30, 2017 7:34 pm P.S. Need to rename what?
HelloWorld.py -> Autoload_HelloWorld.py
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
triplus
Veteran
Posts: 9471
Joined: Mon Dec 12, 2011 4:45 pm

Re: Autoload

Post by triplus »

chrisb wrote: Fri Jun 30, 2017 9:53 pm
triplus wrote: Fri Jun 30, 2017 7:34 pm P.S. Need to rename what?
HelloWorld.py -> Autoload_HelloWorld.py
There is no need to create HelloWorld.py first. If you plan to add some code to be loaded on FreeCAD start you need to use the Autoload_ prefix in the first place. And as for your other concern. I don't feel it clutters the macro folder to have the module to be loaded there. As i do imagine regular user does want to have it listed in the macro dialog. And to be able to create, delete and edit it at any time from the macro dialog GUI and by using built in code editor. Any other option likely involves more complex workflow to achieve the same result and therefore makes less sense to me. Whoever wants to use more complex option likely won't use Autoload module in the first place and therefore likely isn't the target audience.
chrisb
Veteran
Posts: 53930
Joined: Tue Mar 17, 2015 9:14 am

Re: Autoload

Post by chrisb »

Thanks for the answers, you are probably right.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
fc_tofu
Posts: 653
Joined: Sun Jan 05, 2020 4:56 pm

Re: Autoload

Post by fc_tofu »

triplus wrote: Fri Jun 16, 2017 4:07 pm Autoload.png

Autoload module for FreeCAD.

Provides ability to load more workbenches on FreeCAD start. Such ability can be useful for workbench customization purposes and in combination with modules such as PieMenu, ShortCuts, CommandPanel ...

Code repository:

https://github.com/triplus/Autoload
Thank you, triplus, I use Autoload as a workaround to prevent custom toolbar being erased before loading related workbench.
https://forum.freecadweb.org/viewtopic. ... 05#p364205
And it really worked well.

Based on Autoload 20190227 official release, I made a little revision for UI. I'm not a coder. This revision is for explanation of my suggestion.
1. change menu position under "Tools" (for my own practice)
2. resize dialog window smaller, from 800*450 to 400*400 (for low res monitor)
3. add StatusTip, "Load specified workbenches and macros on startup" (for new users)
fsc_2020-01-30_014818.jpg
fsc_2020-01-30_014818.jpg (131.42 KiB) Viewed 1666 times
fsc_2020-01-30_085349.jpg
fsc_2020-01-30_085349.jpg (44.55 KiB) Viewed 1636 times
Autoload_Gui.py
(7.97 KiB) Downloaded 53 times
Last edited by fc_tofu on Thu Jan 30, 2020 1:01 am, edited 4 times in total.
triplus
Veteran
Posts: 9471
Joined: Mon Dec 12, 2011 4:45 pm

Re: Autoload

Post by triplus »

fc_tofu wrote: Wed Jan 29, 2020 2:57 pm Thank you, triplus, I use Autoload as a workaround to prevent custom toolbar being erased before loading related workbench.

And it really worked well.
You're welcome and good to hear that.
As for the UI, I would like the "Autoload" menu directly put under "&Tools" menu.
There is lot of room left in "&Tools" menu, compared with those giants such as Part/PartDesign/Draft/A2plus menu.
And I dont think the up level "Accessories" menu is a good idea, it only waste mouse click.
It used to work like that, but there are issues involved on some platforms, like macOS, that don't make the Tools menu a viable option anymore. In addition it's not just Autoload module, there are a few more, available in the Addons manager, that utilize the Accessories menu. In the future some functionality will likely get upstreamed, then it should be possible again, to put the Accessories menu under the Tools menu.
Last, how to add tooltip for Autoload, just like those native menu, ie, Tools>Addon Manager.
Any suggestion on what should such tooltip say? Something like "Manage automatic loading of workbenches and macros"?
fc_tofu
Posts: 653
Joined: Sun Jan 05, 2020 4:56 pm

Re: Autoload

Post by fc_tofu »

triplus wrote: Wed Jan 29, 2020 5:38 pm
Any suggestion on what should such tooltip say? Something like "Manage automatic loading of workbenches and macros"?
I change my last post, and give my example. Thank your quick and detailed response.
triplus
Veteran
Posts: 9471
Joined: Mon Dec 12, 2011 4:45 pm

Re: Autoload

Post by triplus »

The part about modifying the location (Tools menu). That likely works on your local setup, but as said and if you will look at the mentioned issue report, it doesn't work cross-platform. You can continue to use that patch locally for sure. As for the tooltip, looks good to me. Any interest in creating a tooltip oriented PR on GitHub?

https://github.com/triplus/Autoload
fc_tofu
Posts: 653
Joined: Sun Jan 05, 2020 4:56 pm

Re: Autoload

Post by fc_tofu »

triplus wrote: Wed Jan 29, 2020 6:53 pm The part about modifying the location (Tools menu). That likely works on your local setup, but as said and if you will look at the mentioned issue report, it doesn't work cross-platform. You can continue to use that patch locally for sure. As for the tooltip, looks good to me. Any interest in creating a tooltip oriented PR on GitHub?

https://github.com/triplus/Autoload
I'm very happy if you adopt any of my suggestions. :D
But, I am not a coder, and dont have GitHub account. So, you should bother to add StatusTip yourself.
BTW, as an unruled common practice, menu text followed by 3 ellipsis dots means to open a dialog.
Here, menu text "Autoload..." would be better than "Autoload". IMHO.

Code: Select all

    pref = QtGui.QAction(mw)
    pref.setText("Autoload...")
    pref.setObjectName("Autoload")
    pref.setStatusTip ("Load specified workbenches and macros on startup")
triplus
Veteran
Posts: 9471
Joined: Mon Dec 12, 2011 4:45 pm

Re: Autoload

Post by triplus »

fc_tofu wrote: Thu Jan 30, 2020 12:34 am But, I am not a coder, and dont have GitHub account.
Never too late to start.
IMHO.
Done.
fc_tofu
Posts: 653
Joined: Sun Jan 05, 2020 4:56 pm

Re: Autoload

Post by fc_tofu »

triplus wrote: Fri Jun 16, 2017 4:07 pm Autoload module for FreeCAD.
Hello, @triplus, sorry to bother you again. Just a tiny issue about sort order.
In Autoload's list, some wb are sorted in different way than FreeCAD workbench menu.

Case 1
GearsWB always appeart on list bottom.
fsc_2020-06-15_235416b.jpg
fsc_2020-06-15_235416b.jpg (34.59 KiB) Viewed 1438 times
Case 2
Part WB appear under Part Design WB
fsc_2020-06-17_151259b2.jpg
fsc_2020-06-17_151259b2.jpg (33.14 KiB) Viewed 1438 times
It seems Autoload's sort order is based on class names of wb. But would it be better to sort in according to "MenuText" name?
And also, what is "<none>" workbench/module? Is it useful to be listed here?

TabBar addon's default list has same issue.

Autoload and TabBar are most used addon in my FC. Thank you very much.
Post Reply