Plugin Loader

Have some feature requests, feedback, cool stuff to share, or want to know where FreeCAD is going? This is the place.
Forum rules
Be nice to others! Read the FreeCAD code of conduct!
User avatar
microelly2
Posts: 4447
Joined: Tue Nov 12, 2013 4:06 pm
Contact:

Plugin Loader

Postby microelly2 » Wed Apr 15, 2015 12:30 pm

bn_634.png
bn_634.png (16.52 KiB) Viewed 11572 times
The use of a makefile and git may be not always the easiest way for endusers of FreeCAD
to add current versions of extra software to their official installation.

I have started to beautify my installer to make it usable by the community.
Its not a big thing but comfortable to have selected software up to date.

this is the first version (still for linux) http://youtu.be/O89SkZh36Xg

The ideas:

The configuration of the plugin loader is a local file
and maintained by the end user
It is in a simple syntax (yaml). The yaml Parser is part of the libpack
and can so be used for this.


For each software package there is a description
with name, internet-soure, local destination directory and all information we later need too (checksum, dependencies etc. ). yaml is very powerful to map such requirements.

All these Packages can be selected in a GUI and installed/replaced on the local machine.
If there will be a common understanding of version numbering
the process can become automated too
(may be to read the last commit of the git-masterbranch or use a special timestamp file)

Please let me know what you think about the idea
and what conventions should be pay attention to.

What must be discussed:
Where to store addons
namespace conventions
version numbering
..?

the script: https://github.com/microelly2/freecad-pluginloader
Attachments
bn_635.png
bn_635.png (64.25 KiB) Viewed 11572 times
dubstar-04
Posts: 393
Joined: Mon Mar 04, 2013 8:41 pm
Location: Manchester, UK
Contact:

Re: Plugin Loader

Postby dubstar-04 » Wed Apr 15, 2015 3:11 pm

This is a great idea, I really like what Kodi (xbmc) did with the add-on architecture allowing binary addons too.

http://kodi.wiki/view/Add-on_manager
User avatar
yorik
Site Admin
Posts: 11577
Joined: Tue Feb 17, 2009 9:16 pm
Location: São Paulo, Brazil
Contact:

Re: Plugin Loader

Postby yorik » Wed Apr 15, 2015 3:49 pm

Excellent, microelly! This is simple and efficient... What is the use of the "plugins" folder? I mean why not install them directly in the "Mod" folder? Is it so you can keep versions?

What I would change in your script:

- change your hard-coded '/usr/lib/freecad/...' with FreeCAD.ConfigGet("UserAppData"), this would allow the script to work on non-linux platforms, and also doesn't require admin permissions
- add a button or a link next to each plugin, that sends to a web page (the github repo?), so the user can learn what the plugin does

Later on, this could also be extended to install big macros such as WorkPlane... Very good!
User avatar
saso
Posts: 1337
Joined: Fri May 16, 2014 1:14 pm
Contact:

Re: Plugin Loader

Postby saso » Wed Apr 15, 2015 3:53 pm

This indeed already looks quite nice!

I was also thinking a bit more about it since our last discussion and personally I think I would go to sort of design it in the way the linux update system usually works. There is a list of repositories, in our case this could be the github links, we could have a few of the popular there by default and users could add more on there own. And then things would simply get installed and updated from it.

Personally I would prefer that at least at the beginning nothing would be done automatically, so that user would have to enable an "repository" before the fist install and then confirm before installing each update.

And I guess same as on linux we could also have it work from gui and from console. There is probably even the possibility to add some type of certification / signing for integrity control (remember ed25519.py in our discussion on bugticket about debian dxf files download?) :)
Last edited by saso on Wed Apr 15, 2015 4:03 pm, edited 4 times in total.
User avatar
saso
Posts: 1337
Joined: Fri May 16, 2014 1:14 pm
Contact:

Re: Plugin Loader

Postby saso » Wed Apr 15, 2015 3:57 pm

yorik wrote:What is the use of the "plugins" folder? I mean why not install them directly in the "Mod" folder?
On newer versions of Windows this would probably need administrator rights, since it is under the ..\Program Files folder, while writing things under ..\User does not.
User avatar
microelly2
Posts: 4447
Joined: Tue Nov 12, 2013 4:06 pm
Contact:

Re: Plugin Loader

Postby microelly2 » Sun Apr 19, 2015 8:26 pm

Thank you all for the comments. I have used the week to add some (I hope) useful details: Menu bar integration, more freedom for the destination directory

The plugin folder is only a working concept where to place programs.
Workbenches can be placed into the global or local Mod Folder.

My idea is to have for every plugin a separate directory. Macros can be mapped this way: myMacroy.FCmacro --> plugins/myMacro/myMacro.py
complex Macros like the Workfeature Macro will get their own space plugin/Workfeature with all files and subdir structure

The changelog/commit log date can be used to descide where an update is requiered.
The display of additional information is no technical problem, some attributes are already defined author, descrition, infom, history
It is possible to add menu entries to get the module run (if its not a workbench with its own menu and toolbars)

open problems/todos:
how to automatic initialize the plugin manager (create the menubar entry on startup) the Mod/Init.py cannot be used because the FreeCADGui seems not to be accessable at the time, when this file is executed. :?
naming conventions
port to windows - I can do it
port to mac
add macro support

demo: https://youtu.be/Xf4tDGO6pbg
User avatar
microelly2
Posts: 4447
Joined: Tue Nov 12, 2013 4:06 pm
Contact:

Re: Plugin Loader

Postby microelly2 » Sun Apr 26, 2015 10:38 am

The plugin installer can now install the well known extensions:

bolts library,
workfeature macro,
drawing dim workbench and
assembly2 workbench
drawing symbol library
exploded Assembly Animation workbench

There are still some (I hope small and solvable) problems with updating the menu bar

https://youtu.be/2ysYy_ihoq0

for windows and macos the yaml file must be modified and should work too.
the parts library needs only a small modification

macros which are stored in zip form can be integrated, but still no idea to integrate the plain text embedded macros from
http://www.freecadweb.org/wiki/index.ph ... os_recipes :?
User avatar
yorik
Site Admin
Posts: 11577
Joined: Tue Feb 17, 2009 9:16 pm
Location: São Paulo, Brazil
Contact:

Re: Plugin Loader

Postby yorik » Sun Apr 26, 2015 8:29 pm

Excellent work microelly!
Indeed integrating macros could be a bit of work, but it might be a good opportunity to do something better than the current wiki page. Maybe start a github macros repository?
User avatar
microelly2
Posts: 4447
Joined: Tue Nov 12, 2013 4:06 pm
Contact:

Re: Plugin Loader

Postby microelly2 » Sun Apr 26, 2015 9:36 pm

yorik wrote: Maybe start a github macros repository?
Yes, I think its a good idea to have some conventions and version control.
I have started to integrate the next macros, so i can see what all can happen.
User avatar
yorik
Site Admin
Posts: 11577
Joined: Tue Feb 17, 2009 9:16 pm
Location: São Paulo, Brazil
Contact:

Re: Plugin Loader

Postby yorik » Sun Apr 26, 2015 9:43 pm

Okay, I started a repo: https://github.com/FreeCAD/FreeCAD-macros
I'll copy/paste a couple of macros from the wiki so we can test...