Question about wx.CallAfter, wx.App() and zombie process issue.
Do you really need to do export/subprocess/import it in gui-safe thread? I thought you only have to do it when you are actually touching any of wx gui but your plugin doesn’t.
I see. That is actually issue of gui and app logic separation in KiCad. Refresh call should be factored out into whatever the caller of ImportSpecctraSession() is.
Pcbnew does refresh automatically on action script completion so that would just work for your plugins.
I installed the freerouting plugin from git and it does show up as an extra tool button. However, I have two issues:
When I try to invoke the freerouting plugin by clicking on the tool button, I get an error message that python plugins for exporting DSN files and importing SES files are missing, with the recommendation to try the nightly (potentially unstable?) build, which I am not about to do. However, I still can export the layout as a DSN file manually. No biggie, though, because I can start up the freerouting plugin manually.
When I tried to import the DSN into the freerouting plugin (after starting the latter manually from the ‘~/.kicad_plugins’ directory), I got an error message that freerouting found the illegal character “μ”, which I indeed use in a couple of net names. Aren’t today’s environments supposed to be fully UTF-8 compatible?
Information about my KiCAD:
Application: kicad
Version: 5.1.2-f72e74a~84~ubuntu16.04.1, release build
Libraries:
wxWidgets 3.0.2
libcurl/7.47.0 OpenSSL/1.0.2g zlib/1.2.8 libidn/1.32 librtmp/2.3
Platform: Linux 4.15.0-50-generic x86_64, 64 bit, Little endian, wxGTK
Build Info:
wxWidgets: 3.0.2 (wchar_t,wx containers,compatible with 2.8) GTK+ 2.24
Boost: 1.58.0
OpenCASCADE Community Edition: 6.8.0
Curl: 7.47.0
Compiler: GCC 5.4.0 with C++ ABI 1009
I’m trying to use your plug-in, thank you for developing it! However, I found it very difficult to set up the building environment like yours. Is it possible for you to share a docker file for easily set up a KiCAD for your plug-in? Or, is there a way to use your plug-in without building the KiCAD from scratch? Thanks!
Thanks for the quick reply! I do find the Python API in the nightly build, but when I try to export DSN, it always reports False…
The Python console showing below stuff, and my environment is Windows. Any idea about this? Thank you!
$ ‘/c/Program Files/KiCad/bin/python.exe’
Python 2.7.15 (default, Oct 11 2018, 12:09:51) [GCC 8.2.0 64 bit (AMD64)] on win32
Type “help”, “copyright”, “credits” or “license” for more information.
import pcbnew
pcbnew.LoadBoard(“bm3.unrouted.kicad_pcb”)
<pcbnew.BOARD; proxy of <Swig Object of type ‘BOARD *’ at 0x0000000003ff6150> >
Got it. It works on the pcbnew scripting console! Is there a way to make it work on the pure command line environment, like a workaround? I’m looking for a command-line solution that can translate from .kicad_pcb or .brd to .dsn. Originally, I think KiCAD-python can do so, but it seems not…
Currently there is no way to do it from cli only. (Unless you are willing to do what some mad lads at kicon did with launching pcbnew in fake X server and emulating hid events to navigate the ui).
You can file a bug/feature request on launchpad to refactor that API to make it usable without active pcbnew window. Or if you are comfortable with cpp you can fix this method so that it doesn’t need a valid s_PcbEditFrame pointer.