Snip macro

Info about new community or project announcements, implemented features, classes, modules or APIs. Might get technical!
PLEASE DO NOT POST HELP REQUESTS OR OTHER DISCUSSIONS HERE!
chrisb
Posts: 19562
Joined: Tue Mar 17, 2015 9:14 am

Re: Snip macro

Postby chrisb » Mon Aug 05, 2019 6:54 am

Values for opacity of 0.5 to 0.6 are best for me and the presets for size and position work wonderful.

I am not quite happy with the place where the parameters are stored, but that may need a more general discussion.
The parameters are almost on top level in Preferences->Snip_Macro at the same level as other system parameters. I would expect them in some general subfolder. Candidates for that are the folder "Addon" - or "Plugins->addon_repository" which both contain directly some parameters.
TheMarkster
Posts: 1061
Joined: Thu Apr 05, 2018 1:53 am

Re: Snip macro

Postby TheMarkster » Mon Aug 05, 2019 6:06 pm

I think you are right. The parameters should not be in BaseApp at all, but rather in Plugins. I need to change that now before too many people install it.

Edit: Done

New version 1.06.

It checks if the parameters exist in BaseApp/Preferences and relocates them to Plugins.

Addon Manager should probably have a mechanism for cleaning up user parameters when uninstalling macros and workbenches. But for that there would need to be a standard place to put them, perhaps Plugins/macro_name would work. Then when the addon manager uninstalls a macro it could also remove any parameter group named Plugins/macro_name. The user could be queried first if a preference group is found. For my workbenches I have them in BaseApp/Preferences/Mod/workbench_name, but I think BaseApp should be reserved only for FreeCAD base and workbenches that come pre-installed.

Perhaps there should be Plugins/Macros and Plugins/Workbenches heirarchy. But I don't think many macros use parameters anyway.

Alternatively, each macro that creates user parameter groups could implement a parameter cleanup function that the Addon manager calls when uninstalling, maybe something like def onUninstall(): and inside there cleanup any parameter groups / folders / files created. But this would require cooperation from macro writers, which would be hit or miss. Better, I think, to just check for a Plugins/macro_name group and remove it if the user wants to when uninstalling. Sometimes it could be the user wants to reinstall, and so wants to keep the settings.

There is no real harm in having orphaned parameters from uninstalled macros/workbenches, but it probably has a performance cost the bigger the user.cfg file becomes. The clutter would also make it more difficult for users to find parameters.
chrisb
Posts: 19562
Joined: Tue Mar 17, 2015 9:14 am

Re: Snip macro

Postby chrisb » Mon Aug 05, 2019 9:46 pm

The old values are even preserved. Today I used the Snip macro for a real forum post!
TheMarkster
Posts: 1061
Joined: Thu Apr 05, 2018 1:53 am

Re: Snip macro

Postby TheMarkster » Tue Aug 06, 2019 5:04 pm

Version 1.07

Can now work with python2/qt4 builds.