This ensures that when the project or an environment variable is changed
in pcbnew, the Python interpreter is updated to reflect that.
This is a backport version of the master-branch commit, and will not
synchronize any changes to the environment variables if they are made
from frames other tna Pcbnew.
Fixes https://gitlab.com/kicad/code/kicad/issues/5071
You can trigger it before this fix by running Cvpcb when a .kicad_mod file is
incorrectly set as "Legacy" in your footprint table.
(cherry picked from commit e269b5d1b9)
Always check the return value of PyRun_SimpleString() for errors when a
Python script is run and show an error message rather than fail silently.
Enable Python interpreter I/O redirection in debug builds so that script
string errors will be shown when PyRun_SimpleString() is called.
Do not call PyErr_Print() after a PyRun_SimpleString() call failure. It
doesn't do anything useful.
Do not call Py_Finalize() after a PyRun_SimpleString() call failure. It
seems to cause Pcbnew to crash.
(cherry picked from commit 816f6db310)
When moving user user units out of the global, we missed that Python
calls were using it. This re-adds a function to retrieve user units
allowing the python scripts to show users dialogs in their preferred
units.
Phoenix doesn't have the same initialization as wxpython3 and so the
namespace doesn't get the wxApp() initialized to the existing instance.
In python, this is worked around by starting a new wxApp.
Unfortunately, this appears to overwrite the existing global instance
variable. The issue _appears_ to be in Phoenix but for now we work
around it by saving and resetting the instance pointer in the main app.
The downside is that Python likely won't be able to respond to events
from C++
Fixes: lp:1809913
* https://bugs.launchpad.net/kicad/+bug/1809913
When loading the load using the UI, netclasses and net info are
synchronized to the board object after parsing the file. This needs to
happen automatically when loading the board via the Python interface as
well.
Fixes: lp:1806506
* https://bugs.launchpad.net/kicad/+bug/1806506
The implementation relied on the fact that PyString_AsString is returning NULL
for invalid inputs (and causing an error condition), which is then fixed by the
call to FROM_UTF8. Now, we will simply return an empty string if Py_None is
returned by a python fuction, which resemebles the old behaviour of those methods
SEGZONE types were confusingly named PCB_ZONE_T. Zones in pcbnew are
now _only_ PCB_ZONE_AREA_T, so we name segzone types PCB_SEGZONE_T to be
clear.
This also removes processing of the SEGZONEs from connectivity
calculations.
For some obscure (for me) reason, the path separators in bundlepath are seen as escape seq, and the path can be incorrectly handled
(when \n or \r are found in this string).
it happens only for this path, not for other paths in LoadPlugins.
For bundlepath parameter, unix separator is now used.
Fixes: lp:1766879
https://bugs.launchpad.net/kicad/+bug/1766879
pcbnew_action_plug tracks items that were modified within a plugin. In the case of
deletion, the old object is no longer valid. This commit turns off the call to delete
if a plugin is active.
Refresh is used in the python domain to refresh the display with the current
design. If something has changed, board connectivity likely needs rebuilding.
If using GAL canvas, update its display db.