HOWTO: Register a python plugin inside pcbnew Tools menu


#61

As already said, this is the most likely cause. I am also on Win platform and I have to put the plugins in the same folder in order for them to work.

According to Python Plugin Development for Pcbnew, ~/.kicad_plugins (note it is ~/.kicad_plugins and not ~/kicad_plugins) is the correct locations, but you might try putting them in /usr/share/kicad/scripting/plugins/.

Looking at Kicad source code lines 175-194 there are a few possible locations. If you try them all and report back the results it would be phenomenal.

Bear in mind if you started KiCad, and only then created folder and copied plugin, the plugin will not be visible until you restart KiCad (not only pcbnew, but whole KiCad).

But if someone using Linux chimes in, you should take his advice more seriously.

@Higreg
Have you heard of KICAD_PATH environment variable? Can we use it as a pointer to user folder with plugins, the same way we are using other enviroment variables?


#62

Yes, I put it into ~/.kicad_plugins as you can see from my screenshot.
/usr/share/kicad/ doesn’t exist on my machine, so I assumed it was the wrong path.

But the hint about the installation path was a good hint. After some more fiddling I found out where this path is on OSX: /Applications/Kicad/kicad.app/Contents/SharedSupport/scripting/plugins/
If I put the plugin folders there like this, it works finally:

  • /Applications/Kicad/kicad.app/Contents/SharedSupport/scripting/plugins/pluginA/pluginA.py
  • /Applications/Kicad/kicad.app/Contents/SharedSupport/scripting/plugins/pluginA/__init__.py
  • /Applications/Kicad/kicad.app/Contents/SharedSupport/scripting/plugins/pluginB/pluginB.py
  • /Applications/Kicad/kicad.app/Contents/SharedSupport/scripting/plugins/pluginB/__init__.py

(note that it doesn’t work for me if I put the python files into the fodler directly, they have to go into a subfolder)


#63

I had not heard of KICAD_PATH, but it seems like it should work fine based on that source code!


#64

Hi @jsreynaud
do you think it would be a chance to add an icon to the action Plugin code, beside the name
self.name = "Add date on PCB" self.icon ="my nice icon here.svg"

It would be great if this could be added for the v5 release…
ActionPlugin has become quite popular :smiley:


#65

I don’t think new features will be added to v5 as kicad is in feature freeze.

And according to nick the pyhton plugin stuff might still be considered experimental.

See last comment in https://bugs.launchpad.net/kicad/+bug/1526064

The devdocs says: “This option is disabled by default. Please note that this option is highly experimental and can cause Pcbnew to crash if Python scripts create an invalid object state within Pcbnew.”


#66

I know, but still I’m asking if this option could be added… if disabled by default it wouldn’t affect users at all, but it will help who will like to use this featured plugin…