← Back to team overview

kicad-developers team mailing list archive

Better organizing of Python plugins using subdirectories

 

Hey guys,
With my current work on python plugins for pcbnew, I noticed that you
quickly want to go ahead and divide up your plugin into multiple
subfiles (e.g. test_plugin.py, test_plugin_main_dialog.py, etc..)

Right now, KiCad loads the python files from the hardcoded folders (one
of them being ~/.kicad_plugins however it does not do it recursively.
Thus it is not possible to organize the files in a subdirectory (e.g.
test_plugin/).

Another thing that I noticed (but did not confirm yet) is, that action
plugins need actually have "action_" prepended to the .py file in order
for them to load properly so that they are shown in the pcbnew menu.
This is also on purpose right?

I guess my proposal for a _consistent_ handling of python plugins in the
future might be either
1) Make test_plugin/ subfolder and place all files into this
subdirectory. KiCad recursively loads all plugins in the hardcoded
directories

2) Make test_plugin/ subfolder and place all files into this
subdirectory. When the user wants to use a plugin, he needs to create a
relative link in the hardcoded directory to the corresponding entry-file
in the test_plugin/ sub-directory.

I am currently leaning towards the 2nd solution. But in order for it to
be user friendly (also to those who arent computer savvy), each plugin
needs some kind of installer to perform the copying and linking. I guess
this solution is also more "linuxy" since I have seen this technique in
a lot of different applications (e.g. munin plugins).

What are your thoughts on that?


Follow ups