Commit Graph

188 Commits

Author SHA1 Message Date
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
qu1ck 72f87861bb pcbnew: Add toolbar buttons for action plugins
Allows optional toolbar buttons for action plugins.
2018-08-26 19:39:27 -07:00
Wayne Stambaugh ade3c2b129 Minor Python scripting documentation fixes.
Change the Doxyfile project name from KiCAD to KiCad.  It doesn't look
very good when we don't get the project name capitalization correct.

Clean up trailing whitespace in some of the helper scripts and Doxyfile.
2018-06-12 10:24:59 -04:00
jean-pierre charras ccce376e33 Refinements for commit 986b904
(Add comments and a minor fix)
2018-04-27 16:01:59 +02:00
jean-pierre charras 986b90424b Fix an issue in LoadPlugins(bundlepath=None) python method (Windows specific).
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
2018-04-27 14:04:24 +02:00
Alessandro Gatti f1cf95b8dd scripting: Fix invalid error message syntax.
Fixes: lp:1754758
https://bugs.launchpad.net/kicad/+bug/1754758
2018-03-11 15:09:27 +01:00
jean-pierre charras b11b9b9d0d Fix forgotten change in kicadplugins.i, after changing he class name PYTHON_FOOTPRINT_WIZARDS to PYTHON_FOOTPRINT_WIZARD_LIST
This bug prevent loading Python wizards.
2018-02-04 18:27:32 +01:00
jean-pierre charras 5d8dd7c20f Loading python plugins: make subdir import more tolerant to broken python scripts,
and compatible to subdirs that contains other scripts (like .xsl scripts)
2017-06-24 10:15:51 +02:00
Jean-Samuel Reynaud e40de096bc Fix broken directory names building for python plugins 2017-06-24 07:55:27 +02:00
Jean-Samuel Reynaud 5ef3e5a15d Pcbnew: Add ACTION_PLUGINS class. It allows loading python scripts in footprint editor and run them from the Tools/External Plugins menu
This plugin mechanism is enabled only if option -DKICAD_SCRIPTING_ACTION_MENU=ON (it is off by default)
It imply -DKICAD_SCRIPTING=0N
This is currently for testing purposes only for developers, not yet for users.
2017-01-23 13:27:49 +01:00
jean-pierre charras 4f46f79cf0 dialog_footprint_wizard_list.cpp: allows updating (on request) python modules from this dialog.
This option reloads modules which are more recent than already loaded modules, and load new modules.
2017-01-09 14:44:24 +01:00
jean-pierre charras e6a8294c56 dialog_footprint_wizard_list: add button to show the trace of errors when python scripts wizards failed to load. 2017-01-07 20:43:39 +01:00
jean-pierre charras 76a82dcd3b Dialog footprint wizard selector: better dialog (displays the wizard search path list) and allows double click to select a wizard 2017-01-07 13:39:47 +01:00
jean-pierre charras 56f8e10eb4 Footprint wizards management: Now display the list of not loadable footprint wizards in footprint wizard dialog.
Not loadable wizards are Python scripts having a syntax error or are not compatible scripts due to changes in API.
2017-01-06 20:15:23 +01:00
jean-pierre charras 8e11d9b628 very minor change. 2017-01-04 09:42:32 +01:00
Oliver Walters 66ee44cb1f Footprint Wizards Update 2017-01-03 16:01:47 +01:00
Oliver 636e060c99 A few enhancements from a larger patch, not yet committed, for footprint wizards 2016-12-28 10:26:01 +01:00
Dick Hollenbeck 7311f07eaf SWIG Improvements
*) Extend SWIG support deeper into the BOARD class.
*) Move swig *.i files into a directory identified for SWIG, in preparation
   for a parallel universe involving Phoenix's SIP.
*) Move swig files which will be common to both eeschema and pcbnew into
   common/swig.
*) Sketch out a "common" python module, and plan on dovetailing that into a
   libkicad_shared.{dll,so}
*) Add common/swig/ki_exceptions.i and define a macro HANDLE_EXCEPTIONS()
   which is to be applied to any function which needs C++ to python
   exception translation.
*) Move the test for SWIG tool into top level CMakeLists.txt file for use
   in all python modules beyond pcbnew, i.e. eeschema and common.
*) Add SWIG_MODULE_pcbnew_EXTRA_DEPS which generates a better Makefile, one
   which rebuilds the swig generated *.cxx file when one of its dependencies
   change.
*) Re-architect the board.i file so that it can be split into multiple *.i
   files easily.
*) Make some KIWAY from python progress, in preparation for Modular KiCad
   phase III.
2016-09-20 11:59:43 -04:00
Wayne Stambaugh cbcb3b896b Fix incorrect string translation macros.
* Replace _T() with _() for translatable strings.

* Don't translate debug messages.

* Don't translate copyright symbol.
2016-09-03 12:10:49 -04:00
Dick Hollenbeck e24990146d Pcbnew: major swig fix.
* Switched hashtables.h over to std::undordered_map from boost version.

* Added new macros DECL_VEC_FOR_SWIG() and DECL_MAP_FOR_SWIG() in macros.h.
  These along with future DECL_HASH_FOR_SWIG() unify the declaration to swig
  and C++ so that the resultant type name is common in both languages, and
  the types AGREE.

* Fixed swigging of NETINFO_ITEM and NETINFO_LIST via magic.

* Newly exposed (python wrapped) are: D_PADS, TRACKS (was TRACK_PTRS),
  NETNAME_MAP, NETCODE_MAP, wxString (without constructor purposely, read
  comment in wx.i), MARKERS, ZONE_CONTAINERS, NETCLASSPTR, KICAD_T types.

* std::vector<SOMETHING*> tends to end up named SOMETHINGS in C++ and python.
  Having the name consistent between like types is helpful, and between
  languages.  std::map<> ends up as SOMETHING_MAP.

* NETINFO_LIST::m_netNames and NETINFO_LIST::m_netCodes are now std::map
  instead of hashtables, because swig does not yet support std::unordered_map.

* You can now get to any netclass or net info.   NETNAMES_MAP and NETCODES_MAP
  are traversable basically the same as a python dictionary using a python
  string (not wsString) as the key!  The wxString typemap converts python
  string to wxString before the lookup happens.  Iteration also works.
2016-07-18 13:23:09 -04:00
Dan Cross f5fa6a2148 Fix broken swig import script when using swig >= 3.0.10. 2016-06-20 09:32:59 -04:00
jean-pierre charras 1e7b0f83d9 Fix script fix_swig_imports.py to work with swig version 3.09 2016-06-13 19:50:29 +02:00
jean-pierre charras 6d1e904334 Code cleanup: Remove outdated decimils to/from iu defines and conversion functions (decimils are no more in use since a long time).
Remove convert_from_iu.h file, only used for one define, and containing brokenand duplicate defines. Only convert_to_biu.h is now used.
2016-06-05 13:49:25 +02:00
Strontium c3d3a7a4c8 Scripting: replace PyCrust shell with enhanced PyAlaMode shell. 2015-12-21 09:55:31 -05:00
jean-pierre charras c94a5dd46f Footprint wizard: fixes and enhancements in python scripts. 2015-10-31 12:54:48 +01:00
Bernhard Stegmaier 3f807bdc78 OSX Python scripting plugin path fixes. 2015-10-02 16:07:29 -04:00
Wayne Stambaugh 053458b81a Minor scripting improvements and code cleaning.
* Coding policy fixes in the scripting initialization code missed in my previous commit.
* Remove redundant checks for valid Python library paths in kicadplugins.i.
2015-10-01 20:15:01 -04:00
Wayne Stambaugh 8f99fc0496 Minor Python scripting fixes.
* Actually install the contents of the pcbnew/scripting/plugins directory on
  Windows and Linux
* Move the test for existence of a directory before adding it to the Python
  system library paths when loading the Python plugins.
2015-09-30 16:14:59 -04:00
jean-pierre charras 7808b2e240 Fix in KIWAY_PLAYER::ShowModal: the top level windows children of the KIWAY_PLAYER Modal frame are now enabled (previously were disabled). It fix some issues for instance with the aui toolbar when moved, and the dialog open when starting the footprint wizard frame. Perhaps explain a few other bugs.
footprint wizard frame: now shows messages from footprints python scripts. Especially usefull when a parameter is incorrect. Fix also an other issue (IO error) with some scripts which were usint the print command to output messages (now they use the nes message window.
2015-09-05 14:10:54 +02:00
jean-pierre charras 4a56ee42c5 Footprint wizard: Fix IO exception error in python scripts which happens sometimes, due to the fact these scripts printed messages to a console, but when Pcbnew is not run from a console, there is no IO channel to read these messages.
The fix is not perfect (still no IO channel to read these messages) ,  but it works better.
Also, fix erroneous comments in code, and cleanup code.
2015-09-02 15:55:36 +02:00
jean-pierre charras 204eb49ce5 Minor enhancement in python console: remove margins around the client area. simplify code. 2015-08-24 20:32:56 +02:00
jean-pierre charras 718053376d forgotten python_scripting.cpp fix. 2015-07-09 18:51:08 +02:00
jean-pierre charras 01ae08a9a9 Remove the call to wxversion.py on winbuilder, because it does not work (not found, even when exists), ans it is not useful. Avoid crashes when wxPython scripting layer is not loaded, on kicad exit, and when trying to open the py console. 2015-07-09 18:44:23 +02:00
Wayne Stambaugh c288d200fb Minor wxPython scripting improvements.
* Wrap Pgm().OnPgmExit() changes in APP_SINGLE_TOP to build conditionally
  when KICAD_SCRIPTING_WXPYTHON is enabled.
* Check the result of loading the correct wxPython version during
  initialization.
2015-06-27 15:05:26 -04:00
jean-pierre charras 4daf9039db Eeschema: Fix a very old bug relative to the tool to load power parts:
Previously, only the lib named "power" was used (and therefore power parts defined in other libs not shown).
Now, all power parts can be loaded from any library.
Also, when loading power parts from the chose component dialog or the lib viewer, libs and parts are filtered:  only power parts and libs containing power parts are listed.
Hotkeys: move a few global strings in the files where ther are actually used (and make them local.) and code cleaning.
Fix a few other minor issues.
2015-04-16 17:26:51 +02:00
jean-pierre charras 4bab8dde65 Fix some minor coverity warnings. Fix a bug in pcad2kicad plugin. Scripting: map BASE_SET. Rename some python bom scripts with better names. Fix erroneous comments and add comments 2015-03-02 09:28:49 +01:00
Mark Roszko 3c42764563 Fix snprintf usage. 2015-02-22 18:56:38 -05:00
Wayne Stambaugh 69553d6fa3 wxPython find and version loading fixes. (fixes lp:1408060)
* Add test to CMakeLists.txt to verify wxPython is installed when
  KICAD_SCRIPTING_WXPYTHON=ON.
* Add test to make sure wxPython version major and minor numbers match
  the version of wxWidgets found.
* Add code to set the correct version of wxPython to the python scripting
  initialization code.
* Minor code simplification in Pcbnew KIFACE main window creation.
2015-02-14 19:23:54 -05:00
unknown 8876fdf4af Misc minor fixes (Fix some minor compil warnings). 2015-01-18 12:49:32 +01:00
jean-pierre charras 6a19315557 Fix compat with swig 3.03 2015-01-04 08:19:04 +01:00
jean-pierre charras f3765a32d8 Fix minor issues. Fix some outdated and broken BOM python scripts. Add info in BOM python scripts.
BOM dialog: remove a not very useful button, and merge its function with an other (not perfect, need more work)
Add message box to show info added in BOM python scripts (See scripts/bom-in-python/README-bom.txt about this info)
2014-12-03 17:22:06 +01:00
jean-pierre charras f877a1159e Fix python scripting issue (EDA_RECT not mapped) 2014-11-08 14:30:39 +01:00
jean-pierre charras f55a436d58 map class CPolyLine (used in zones) in Python. 2014-11-06 16:27:22 +01:00
Wayne Stambaugh f86eb756af Source license, coding policy, and documentation fixes.
* Add more missing source code licenses.
* Fix coding policy violations (tabs and trailing white space) in Python
  scripting code.
* Add stable release policy to full documentation build.
2014-10-28 15:43:12 -04:00
jean-pierre charras 7b13463302 change malformed comments in kicad.i 2014-10-22 13:16:20 +02:00
jean-pierre charras c237838d00 python scripting: refinement for UTF8 class (from Miguel Ángel Ajo Pelayo) add __str__ method, usefull to print a UTF8 string.
Kicad manager: fix issues in file watcher: changes (adding/removing files)  in project folder not seen by Kicad manager (perhaps due to changes in internal wxWidgets code between 2.9.5 and 3.0).
2014-10-21 18:34:51 +02:00
jean-pierre charras f23bb59cd1 Python scripting: make UTF8 class accessible by python scripts. Add python method GetChars() to UTF8 class to get its char buffer.
See scripts/test_kicad_plugin.py for example.
2014-10-18 10:18:14 +02:00
jean-pierre charras e6274f70b0 BOARD::Add(): fix an issue for tracks: parent not set (could be an issue only in python scripts, because the parent is set by the constructor)
*.i : fix coding style issues.
python method: add BOARD_ITEM Duplicate, which is a wrapper to Clone(). ( defined as Cast_to_BOARD_ITEM(selt.Clone()).Cast() )
update some .py examples.
2014-10-02 19:09:32 +02:00
jean-pierre charras eb396a5e88 Fix footprint wizard issues. Fix export vrml incorrect Z position of items. 2014-07-02 15:08:28 +02:00
Jean-Samuel Reynaud 47b5bdcd47 Fix a mismatch between method signature in scripting/python_scripting.cpp and scripting/python_scripting.h 2014-03-28 07:27:58 -05:00
jean-pierre charras 34c593916c Pcbnew: Fix bug #1296649 (Text on flipped modules incorrectly placed).
Dialog Freeroute: if freeroute.jar is find in kicad binaries, it is run as a standard java application, not as web applcation
Very minor other fixes
FPC_(SMD_type)_footprintwizard.py wizard finished.
2014-03-27 18:45:05 +01:00
jean-pierre charras fd2afec6f5 Remove some fully outdated code (#pragma, from Henner Zeller's report, and some other things) 2014-02-18 12:41:53 +01:00
Marco Serantoni fb9e5b94ca [MacOSX] support for plugins in the bundle 2014-02-15 11:01:27 +01:00
Miguel Angel Ajo bbcd2c61d6 BOARD saving test 2014-02-09 00:21:47 +01:00
Povilas Kanapickas 7f12513c7e Remove some uses of using namespace std. 2013-12-13 10:27:30 -06:00
jean-pierre charras 8caef8f8b1 Make footprint wizards compatible with FPID changes (MODULE::SetLibRef changed to MODULE::SetFPID) 2013-11-01 16:29:50 +01:00
Wayne Stambaugh 0f4ba09545 Pcbnew footprint library table fixes.
* Make footprint viewer work properly with library table.
* Fix bug in Eagle plugin when enumerating footprints.
* Add missing P-CAD plugin from footprint library table editing dialog.
* Fix bug in FOOTPRINT_INFO::LoadLibraries when error occur loading footprints
  from libraries.
2013-09-21 20:28:02 -04:00