Commit Graph

144 Commits

Author SHA1 Message Date
jean-pierre charras 7a7eee86ce kicad_pyshell/__init_py: avoid loading pcbnew module if the board editor is not open.
It happens when opening the python console from Eeschema.
In this case, and on msys2, Pgm() returns a null pointer because the pcbnew
application is not initialized, and the first call to Pgm()
from a python script crashes Kicad
2021-08-15 15:11:07 +02:00
jean-pierre charras eece74efa7 kicad_pyeditor.py: remove useless "import pcbnew" that create issues when created from Eeschema 2021-08-15 12:37:39 +02:00
Seth Hillbrand e87fdf06c1 Wrap GetNewId() for older wxPythons
18.04 and earlier use wxPython 4.0.1 that doesn't have the new Id call.
This wraps the id to use the earlier version if the newer one is not
available

Fixes https://gitlab.com/kicad/code/kicad/issues/8887
2021-07-30 10:36:15 -07:00
Jeff Young 6aaf4413b3 Fix kicad_string.h / string.cpp mismatch.
They don't define a KiCad string class, so the header file name was
somewhat misleading. But the fact that they didn't match definitely
made coding more difficult.
2021-07-29 16:03:25 +01:00
Marek Roszko 7ff9806386 Add skipped pdb copy to kipython 2021-07-15 21:30:59 -04:00
Seth Hillbrand 76a6177eb7 Re-direct help() output to console
Keeps a copy of stdin as well, so that re-assigning this in the python
window does't close the output

Fixes https://gitlab.com/kicad/code/kicad/issues/8047
2021-07-12 16:22:07 -07:00
Wayne Stambaugh 6c3ba1c20b Coverity issue fixes.
Issues #332032, #332086, #332157, and #332171.
2021-07-09 10:56:35 -04:00
Jeff Young 0dfb5fcaf9 Error message cleanup.
wxString::Format is redundant in a wxLogXXX call.
Error messages should generally be translatable.
Error messages should use generally consistent sentence forms.
2021-06-26 22:53:24 +01:00
Jon Evans b611da161e Ensure console can be loaded from Eeschema standalone
PcbNew sets up the correct path as a side-effect of loading
the action plugins.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/8661
2021-06-23 22:43:53 -04:00
Peter Montgomery b4f5b6ef3c Update environment var for Python to allow running from build or install folder 2021-06-15 01:12:45 +00:00
luz paz f968fc8719 Fix source comment / documentation typos 2021-06-09 19:32:58 +00:00
Marek Roszko 0ffabf5e70 Shift the msvc specific pythonhome init 2021-06-08 23:39:22 -04:00
Marek Roszko ab82b01714 Evict the last bits of wx.h 2021-06-07 20:23:27 -04:00
Seth Hillbrand 891e200fc8 Use Python to test for modules (not CPython)
CPython call requires Python 3.8+, so we work around to keep the 3.6
users happy

Fixes https://gitlab.com/kicad/code/kicad/issues/8554
2021-06-07 13:56:31 -07:00
Jon Evans 148ac19386 Fix launching from the build dir after new_python 2021-06-01 21:37:33 -04:00
Marek Roszko 0dbfd28942 Remove unused vars 2021-06-01 18:49:55 -04:00
Marek Roszko 04ab71c47c Tweaks to build 2021-06-01 20:18:24 +00:00
Seth Hillbrand c0bc6b1107 Fix compile errors on MSVC 2021-06-01 20:18:24 +00:00
Seth Hillbrand e050d42658 Re-enable KICAD_SCRIPTING_WXPYTHON
This keeps wxpython behind a build flag for platforms (mingw) that do
not yet support it.
2021-06-01 20:18:24 +00:00
Seth Hillbrand e151130356 Adjust init for Python >=3.6 2021-06-01 20:18:24 +00:00
Seth Hillbrand 11592e6eae Fix scripting window issue not saving settings 2021-06-01 20:18:24 +00:00
Seth Hillbrand bf1437899e Add Python Tool to pcbnew 2021-06-01 20:18:24 +00:00
Seth Hillbrand c7d188a8d0 Centralizing SCRIPTING class 2021-06-01 20:18:24 +00:00
Seth Hillbrand 192fbfd5e5 Finalize Python Frame 2021-06-01 20:18:24 +00:00
Seth Hillbrand 256f259627 Fix PyBind11 _ usage to be compatible with i18n 2021-06-01 20:18:24 +00:00
Seth Hillbrand 81d58bcea9 Working python window 2021-06-01 20:18:24 +00:00
Seth Hillbrand 6fbbba8db3 Adding Python shell KIFACE 2021-06-01 20:18:24 +00:00
Seth Hillbrand f274a00c08 Remove PYTHON_* compile options 2021-06-01 20:18:24 +00:00
qu1ck 75819206a0 Add support for dark theme in plugin icons
Action plugin authors can specify alternative icon path for dark theme.
If it's not specified then standard icon will be used for both light and
dark themes. If neither icon is specified then the default puzzle piece
icon is used.

Fixes #7984
2021-03-24 21:59:30 +00:00
jean-pierre charras 49ce32b403 Fix a minor python2/python3 compatibility issue on MSW 2021-03-03 18:42:51 +01:00
jean-pierre charras 959c2f18ab Fix python encode( 'UTF-8' ) error
Fixes #7650
https://gitlab.com/kicad/code/kicad/issues/7650
2021-02-22 09:43:52 +01:00
Seth Hillbrand 5354780904 Fix Linux/Python3 issue with plugins
Strings are not always encoded, so we get exceptions when trying to
double-decode.  Just keep strings as-in in this case
2021-02-21 11:22:43 -08:00
jean-pierre charras 8beeb368d2 Scripting: Fix missing utf8 to unicode string conversion in swig file
So non ASCII7 chars in .py filenames were non working, especially on Windows.
Fixes #5507
https://gitlab.com/kicad/code/kicad/issues/5507
2021-02-21 11:38:10 +01:00
Jon Evans ec334f172b Fix some issues with reloading of action plugins
First issue: the C++ action plugins list should be cleared so that any
plugins that fail to reload do not hang around on the toolbar.
This is fixed on the C++ side.

Second issue: inner dependencies of plugins that are modules were not
reloaded before, which broke reloading for many plugin examples out there.
This is fixed on the Python side by keeping track of dependencies and
clearing them out before reloading a module (unfortunately there doesn't
seem to be a way to do this in the standard library)

Fixes https://gitlab.com/kicad/code/kicad/-/issues/7245
2021-02-20 11:19:33 -05:00
Marek Roszko 30ba3aa240 Get python loading the new "user scripting" paths 2021-01-28 23:45:53 -05:00
Seth Hillbrand 45ca1709bb Unify scripting dirs and open user-based
This consolidates python scripting in two locations: the system-wide
package-based location and the user configuration location.  It also
updates the "Show Scripting Folder" action to open the user
configuration location instead of the package-based one.

Fixes https://gitlab.com/kicad/code/kicad/issues/5652

Fixes https://gitlab.com/kicad/code/kicad/issues/5115
2020-09-16 20:09:23 -07:00
Seth Hillbrand 5ca23e3e5c Fix missing quote in git_libngspice 2020-06-30 05:46:11 -07:00
Andrew D'Addesio b48a6274e6 Fetch ngspice over https 2020-06-25 02:07:31 +00:00
Dimitris Tassopoulos 9b4b85bb7d Added an option to use a configurable number of cores for make
Signed-off-by: Dimitris Tassopoulos <dimtass@gmail.com>
2020-04-06 12:51:16 +00:00
Jon Evans e59a3d981e Implement a new settings framework across all of KiCad
CHANGED: Settings are now stored in versioned sub-directories
ADDED: First-run dialog for migrating settings from a previous version
CHANGED: Settings are now stored as JSON files instead of wxConfig-style INI files
CHANGED: Color settings are now all stored in a separate settings file
CHANGED: The symbol editor and footprint editor now have their own settings files
CHANGED: Color settings are no longer exposed through BOARD object
CHANGED: Page layout editor now uses Eeschema's color scheme

Settings are now managed through a central SETTINGS_MANAGER held by PGM_BASE.
Existing settings will be migrated from the wxConfig format on first run of each application.
Per-application settings are now stored in one class for each application.
2020-02-19 23:44:56 -05:00
Ian McInerney 57253b7a3c Update ngspice build script to new version 2019-12-21 23:34:38 +00:00
Ian McInerney 6186dd5c51 Update ngspice build tool script to ngspice-30 2019-07-10 09:17:34 -04:00
Ian McInerney 59b729c731 pcbnew: Fix reload of python plugins in python 3
Update the reload function call to be python3 compatible along with
simplifying the load function to unify the loading of simple and
complex plugins.

Fixes: lp:1828595
* https://bugs.launchpad.net/kicad/+bug/1828595
2019-05-28 17:14:34 -07:00
Mark 5685174808 Fix for SWIG 4.0.0 2019-05-10 13:22:28 -04:00
Seth Hillbrand b6565079ee Updating icon build paths
Icon build scripts required relative paths. Updating to account for new
depth.
2019-02-14 14:58:04 -08:00
Seth Hillbrand ad77863668 Cleanup build script locations
Some developer scripts ended up in the demonstration scripts directory
that was bundled with builds.  This moves them to the build_tools
directory and updates the associated Documentation

Fixes: lp:1815891
* https://bugs.launchpad.net/kicad/+bug/1815891
2019-02-14 14:44:55 -08:00
Thomas Pointhuber 310e3f5eb9 Add Python3 compability to scripting/build_tools/extract_docstrings.py
Fixes: lp:1815737
* https://bugs.launchpad.net/kicad/+bug/1815737
2019-02-13 09:16:43 -08:00
Thomas Pointhuber 7365cb8e52 Get Exception handling working with Python 3
The old way to get the full stacktrace was incorrect, and does not work
with Python 3:
https://stackoverflow.com/questions/3702675/how-to-print-the-full-traceback-without-halting-the-program#comment84297600_33723119
2018-10-19 09:59:06 +02:00
Thomas Pointhuber 88d04f3bcb Get Action Plugins working with Python 3, fix some unicode string errors 2018-10-19 09:59:06 +02:00
Thomas Pointhuber de7b362695 Rewrite some code to work on Python 2.7 and 3+ 2018-10-19 09:59:03 +02:00