Commit Graph

257 Commits

Author SHA1 Message Date
Seth Hillbrand cf6b18ec7e Remove escaped double-quotes
For some reason, escaped double quotes in wxString::Format cause issues
on Mac.  We can replace them with single quotes in most places without
loss of clarity
2021-11-03 17:03:14 -07:00
Asuki Kono 762cd5a32f Add PLACE_FILE_EXPORTER to swig to call in python 2021-11-03 16:32:05 +00:00
Jon Evans 5475303ec2 Allow loading secondary boards from Python
Fixes https://gitlab.com/kicad/code/kicad/-/issues/9271
2021-10-24 14:06:38 -04:00
jean-pierre charras 0bdb424215 FootprintWizardBase.py: fix Arc building due to recent code changes.
Add a arc_test wizard (only to test arcs in fp).
2021-10-22 10:07:31 +02:00
qu1ck 09a2701136 Fix arc angle calculation and python API for it
1. It's impossible to use methods that modify parameters in swig so
I extend it in wrapper
2. Simplify GetArcAngle() and fix the bug where it lies about 360
degree arc to be 0 degrees.
2021-10-20 10:38:42 +00:00
qu1ck 6db0216dd4 Bring back python compatibility constants for SHAPE_T
They were removed in a41944020d
and that broke a lot of stuff.
2021-10-17 03:21:47 -07:00
Seth Hillbrand 57d0cbcefa Fix python QA 2021-10-15 13:50:36 -07:00
Jeff Young a41944020d Push most of PCB_SHAPE impl down in to EDA_SHAPE. 2021-10-15 12:45:43 +01:00
Seth Hillbrand 9a8d1246cc We don't keep a CHANGELOG.TXT
Direct interested readers to AUTHORS.TXT instead.
2021-10-05 19:46:53 -07:00
Seth Hillbrand 548e5f49bd Clean up unused variable usage
Unused variables in function calls can be commented out.  Unused
return variables get a new routine `ignore_unused()` that silences the
warnings with zero overhead.
2021-10-05 10:00:30 -07:00
Mike Williams 1b0c274e22 Python: Copy board iterables to prevent segfaults
Python code like:
for track in board.GetTracks():
  board.Remove(track)

Would delete tracks in the the underlying m_tracks while iterating over
it.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/5192
2021-09-24 19:40:46 +00:00
Mike Williams 16ec6fbec4 Plugins: Fix QR code generator shape exception
Fixes https://gitlab.com/kicad/code/kicad/-/issues/9079
2021-09-22 11:15:26 -04:00
qu1ck 0f7c0e3872 PCM implementation 2021-08-27 21:11:47 +00:00
qu1ck 78ab69027d Add 3rdparty/plugins to plugin search 2021-08-27 21:11:47 +00:00
Jeff Young e6ca9837a2 Clear numbers from non-numberable pads and don't run DRC on them.
This was also the last straw on the misnamed PAD::GetName() and
PAD::SetName(), which are now PAD::GetNumber() and PAD::SetNumber().

Fixes https://gitlab.com/kicad/code/kicad/issues/9017
2021-08-24 01:03:06 +01:00
Jeff Young baab2e6119 Attempt to fix SWIG issue. 2021-08-23 22:04:31 +01:00
Wayne Stambaugh 46b959c3e3 Move plotter headers into include folder. 2021-08-18 16:38:31 -04:00
Jon Evans 8eba0b356b Fix issues calling SaveBoard on board loaded from PcbNew frame
KiCad cannot have more than one board/project open, so disallow
the Python APIs for loading additional boards when the frame is
present.  Inherit the SETTINGS_MANAGER from the frame when present
instead of creating a new one that won't have the loaded project.
2021-08-14 09:18:21 -04:00
qu1ck 7b4dcb6e10 Refactor ExportSpecctraFile to be usable in API
Currently there is pcbnew.ExportSpecctraDSN() but it needs a pcbnew
frame set which makes it unusable outside of the scripting window or a
plugin.

This refactors actual exporting logic into separate helper and adds an
overload to ExportSpecctraDSN(board, filename) that doesn't need pcbnew
window.
2021-07-31 09:55:48 +00: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
Jeff Young f221220fe2 Rename layer ids file.
It hasn't had anything to do with colors or visibility for some time
now.
2021-07-29 16:03:25 +01:00
Wayne Stambaugh 37b200cb3e Pass wxString objects by reference instead of on the stack. 2021-07-27 08:41:27 -04:00
qu1ck c946070005 Fix TRACKs not being cast correctly in API 2021-07-26 22:37:22 +00:00
jean-pierre charras 31d2b2df8b QA test: fix a wx assert about Locale when running qa_python tests.
Probably happens only when the system locale uses a comma as fp separator.
2021-07-23 11:45:45 +02:00
Jeff Young 0fb864d596 Pull some name changes back from 7.0 to ease merging. 2021-07-21 20:58:59 +01:00
Wayne Stambaugh cf00319c85 More NULL expunging. 2021-07-20 07:27:18 -04:00
jean-pierre charras 6a886e7085 Wizard qrcode_footprint_wizard.py: fix a minor issue and update code. 2021-07-19 18:36:58 +02:00
luz paz 8bacc9fccb Fix python 'testing for equality' syntax
'Testing whether an object is 'None' using the == operator is inefficient and potentially incorrect.'  

Per https://lgtm.com/projects/g/KiCad/kicad-source-mirror/?mode=tree&ruleFocus=7900090
2021-07-19 15:42:30 +00:00
jean-pierre charras 4eafd2664a FootprintWizardBase.py: fix use of cmp(), non existing in python3
Fixes #8677
https://gitlab.com/kicad/code/kicad/issues/8677
2021-06-25 09:04:49 +02:00
jean-pierre charras 5b8f32acd2 Python script sample: fix compatibility with recent changes in code. 2021-06-15 18:19:58 +02:00
jean-pierre charras 142dd48c99 SCRIPTING_TOOL::showPluginFolder(): fix wxWidgets3.14 compatibility (Linux mainly) 2021-06-15 18:19:58 +02:00
jean-pierre charras fbbe723811 Fix board_item.i after recent changes in Pcbnew code.
(some class names changed)
2021-06-15 10:59:52 +02:00
jean-pierre charras 30f3d11355 fix possible incompatibilities of python scripts due to recent code cleaning 2021-06-14 18:57:05 +02:00
Jon Evans 82f3df4086 Attempt to fix Python qa code after renames 2021-06-13 11:20:19 -04:00
Jeff Young 096e342386 Prefix TRACK, ARC and VIA. 2021-06-11 22:07:02 +01:00
Jeff Young 16b0147af8 Prefix DIMENSION types. 2021-06-11 17:59:44 +01:00
luz paz f968fc8719 Fix source comment / documentation typos 2021-06-09 19:32:58 +00:00
Marek Roszko d946d6e68f Cleanup some pgm_base.h includes 2021-06-08 21:56:00 -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
Marek Roszko 10e60acf34 Clean up including of board_design_settings.h 2021-06-06 15:03:42 -04:00
Marek Roszko 4712d7a918 Remove a leaky wx/msgdlg.h include 2021-06-06 08:45:38 -04:00
Ian McInerney 2533fb22b3 Add the new pcb item container header to the SWIG wrapper 2021-06-04 12:49:11 +01:00
Ian McInerney 23f8851409 Remove pcb_group include from board header 2021-06-03 20:03:31 +01:00
Ian McInerney 7bbf1b07b7 Fixup to expose PCB_GROUP in Python 2021-06-03 20:00:45 +01:00
Jean-Samuel Reynaud e2e963d14a Adding PCB_GROUP to python interface 2021-06-03 18:55:46 +00:00
Seth Hillbrand 68a5d5dc01 Fix issue reloading plugins 2021-06-01 20:18:24 +00:00
Seth Hillbrand bbcc840989 Cleanup rebase fns 2021-06-01 20:18:24 +00:00
Seth Hillbrand adf885b667 Move pcbnew swig
Separates the python scripts into those using swig and those needed for
other scripting
2021-06-01 20:18:24 +00:00
Seth Hillbrand 81d58bcea9 Working python window 2021-06-01 20:18:24 +00:00
jean-pierre charras 4d9829ec8b Fix some issues related to python scripts:
- make PadArray.py compatible python2/3
- fix a wxWidgets warning in pcbnew_scripting_helpers.cpp shown in some cases
2021-04-28 14:02:47 +02:00
jean-pierre charras 524ca442f3 Old python scripts: fix issues due to code change, and make them Python3/3 compatible 2021-04-27 11:55:56 +02:00
Carsten Schoenert 8dff3725ac Typo fix: Correct 'allow to' -> 'allows one to' 2021-04-03 13:39:50 +00:00
qu1ck 3199a88d54 Fix pcbnewshell not showing namespace inspector tools
on msvc build with recent wxpython
2021-03-02 17:12:57 +00:00
Graham Keeth 4bf79f2b90 Remove ddr3_length_match.py
The script is designed to be used with a particular board that does not
exist in the repository.
2020-11-20 08:10:53 +00:00
jean-pierre charras 103dbb9fbd Some fixes in python footprint wizards 2020-11-14 13:38:44 +01:00
Dominik Wernberger 28991ddf58 Rename D_PAD to PAD 2020-11-14 09:37:45 +00:00
Dominik Wernberger 54878b04a5 Rename MODULE to FOOTPRINT 2020-11-14 09:37:45 +00:00
Dominik Wernberger a4650e7269 Rename GetModules to GetFootprints 2020-11-14 09:37:45 +00:00
jean-pierre charras 411914dffb Fix python footprint wizards after recent changes in code 2020-10-09 20:48:13 +02:00
Jeff Young 37906511f5 Class renaming.
DRAWSEGMENT  -> PCB_SHAPE
EDGE_MODULE  -> FP_SHAPE
TEXTE_PCB    -> PCB_TEXT
TEXTE_MODULE -> FP_TEXT
2020-10-05 11:55:33 +01:00
Seth Hillbrand 91914f1a71 Reverts premature Python 3 calls in favor of backwards compat.
This reverts commits d8d8f4f670
and 9614f6d0d9.
2020-09-03 20:05:38 -07:00
jean-pierre charras eb16fec7ec Footprint wizards: fix some issues due to C++ code change.
Some constants were renamed, breaking some wizards.
2020-09-02 15:45:20 +02:00
Graham Keeth 9057a46a20 circular pad array wizard: pin 1 optionally square
Add option to make pin 1 rectangular to Circular Pad Array wizard.
Default behavior is unchanged (oval pin 1).

Fixes https://gitlab.com/kicad/code/kicad/-/issues/4614
2020-08-12 20:49:55 +00:00
Seth Hillbrand c4de3c8f1a Move mutual capacitance wizard to correct folder 2020-08-12 11:26:01 -07:00
Seth Hillbrand d8d8f4f670 Removing extra parameters to super() calls
The extra parameters seem to cause problems for some Python
configurations and are not needed.

Fixes https://gitlab.com/kicad/code/kicad/issues/4896
2020-08-12 06:22:45 -07:00
Blake Smith 9614f6d0d9 Fix PadGridArray super call 2020-08-12 06:22:45 -07:00
Ian McInerney e57c495d05 Fix remaining python method name error
The method was renamed to SetTextThickness in
9c8941e040.
2020-04-20 23:24:55 +01:00
Matt Huszagh 300de7e74c fix footprint wizard for rename from SetThickness to SetTextThickness 2020-04-20 22:09:41 +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
Seth Hillbrand 9bccbaf497 qrcode: Handle Python3 integer promotion
In Python3, all division operators promote integers to floats.  We need
to downcast back to integer for the polygon vertices.

There was also an unhandled overflow in the QR generation that allowed
more than 512 bits to be loaded.  This overflows the type of QR we
generate, so this truncates the input string to 62 bytes ( leaving 12
bits for the checksum )

Fixes: lp:1850223
* https://bugs.launchpad.net/kicad/+bug/1850223
2019-11-01 13:32:50 -07:00
jean-pierre charras 92ccb766ab Python fp wizards: fix a few issues in qrcode_footprint_wizard.py
Fixes: lp:1828744
https://bugs.launchpad.net/kicad/+bug/1828744
2019-05-13 13:04:57 +02:00
jean-pierre charras c1c5afad67 fix in qfn_wizard.py 2019-04-17 18:02:22 +02:00
jean-pierre charras 68e6308066 Fix qfn_wizard.py wizard.
(a parameter controlling pad position offset was also used in pad size, that creating incorrect pad size).
2019-04-17 13:46:35 +02:00
jean-pierre charras a4d4d9a241 Fix not working sdip_wizard.py 2019-01-29 08:42:28 +01:00
Seth Hillbrand b4910658b5 Footprint wiz: Fix FPC courtyard 2018-12-11 13:11:56 -08:00
Seth Hillbrand 4b3bfb0115 footprint wiz: Update default values
This updates some of the footprint wizard values to use the default KLC
values for silkscreen, fab, courtyard and text.

Also updates the default QFN settings to create a valid footprint
2018-12-11 13:11:56 -08:00
nats 6e77176d76 Adding fillet option for the QFN Wizard
Fixes lp:1775961

https://bugs.launchpad.net/kicad/+bug/1775961
2018-11-21 15:00:39 -05:00
Nick Østergaard 8c1ebc4314 Remove shebang from footprint wizard plugin
Fedora packaging errors with ambiguous python shebang since current
rawhide (30).

So we should remove it as the footprint wizards are not to be executed
standalone.
2018-11-04 08:43:20 +01:00
Thomas Pointhuber 0e0b4d52a2 Add initial support for Phoenix (new wxPython binding)
Based on the work of @mmccoo:
https://kicad.mmccoo.com/2017/11/23/learnings-from-moving-kicad-to-wxpython-4-0/
and this additional patchset to remove wxpy_api.h dependency:
http://mmccoo.com/random/0001-Remove-dependence-on-pywx_api.h.patch

Please note CreatePythonShellWindow changed quite a lot. Throughful testing
should be made for the old as well as new wxPython version on all platforms
2018-10-26 13:21:11 +02:00
Thomas Pointhuber 9eff4e999f Quick fix to avoid nameclash with local qrcode python package 2018-10-19 09:59:06 +02:00
Thomas Pointhuber a27e547290 Fix uss39_barcode.py to work with Python3 as well 2018-10-19 09:59:06 +02:00
Thomas Pointhuber 0812f71bd3 Fix builtins import in Python3 2018-10-19 09:59:06 +02:00
Thomas Pointhuber 8805706ccb Fix incompatibilites between Python 2 and Python 3 2018-10-19 09:59:05 +02:00
jean-pierre charras 3d28d0274b put a demo file to the right place 2018-08-01 16:44:18 +02:00
jean-pierre charras b47ffd7054 Update python scripts examples according to recent changes in pcbnew code.
Add a new example to plot files
2018-08-01 16:32:37 +02:00
jean-pierre charras 1dbaef303e Fix FootprintWizardBase.py according to recent changes in lib_id.h 2018-07-31 18:46:25 +02:00
John Beard 847f4f50b1 Pcbnew python plugins: fix some pad arrays
Fixes some pad array init functions that were not calling the
class hierarchy's init functions correctly.
2018-06-25 09:34:32 -04:00
John Beard 41d6fc648d Pcbnew Python: use python super for inherited classes 2018-06-13 11:12:15 -04:00
John Beard 1f04b5fc7d Pcbnew Python: Add PadArray module documentation 2018-06-13 11:12:08 -04:00
John Beard 939450856a Pcbnew FP wizard: add rounded and chamfered box aids
These functions are fairly common drawing operations that otherwise
require fairly complex calculations, which would be better not to
have to repeat.
2018-06-13 11:11:55 -04:00
John Beard 5001b056ac Pcbnew FP wizard: add docstring for parameters
Adds more verbose and complete explanations of the
FootprintWizardBase and FootprintWizardDrawingAids functions.
2018-06-13 11:11:49 -04:00
John Beard 137799165d Pcbnew FP wizard: minor style fixes
This contains only a few minor style fixes according to PEP8
for FootprintWizardBase.py, and some spelling fixes
2018-06-13 11:11:42 -04:00
jean-pierre charras c1ae2fd0a8 Typo 2018-04-10 20:27:54 +02:00
Wayne Stambaugh 89d350a7d2 Footprint editor: fix bug in footprint wizard 2D barcode generator.
The text height and thickness settings were never implemented so they
didn't get updated when the options were changed.  Added the missing
code to update both parameters.

Added text width parameter so text height and width do not need to be
the same value.  Currently both the value and reference fields are set
to the same height and width.  Please feel free to change this if you
feel the need to have separate text settings for both the value and
reference fields.

Fixes lp:1751309

https://bugs.launchpad.net/kicad/+bug/1751309
2018-03-15 10:37:36 -04:00
Christoph Riehl f6023d22e4 Minor Python pad array improvement.
Allow selection of square pads and allow to rotate the pads in the
circular pad array wizard
2018-01-06 10:39:32 -05:00
jean-pierre charras b93cc8423e qrcode_footprint_wizard.py fix (due to DRAWSEGMENT recent changes)
Fixes: lp:1739265
https://bugs.launchpad.net/kicad/+bug/1739265
2017-12-21 10:23:37 +01:00
Maciej Suminski cca63801bf Renamed D_PAD::{Set,Get}PadName() to D_PAD::{Set,Get}Name() 2017-09-19 18:23:50 +02:00
jean-pierre charras 4d0c1577d2 Fix Pcbnew Python: LoadBoard does not rebuild connectivity database, and later, SaveBoard does not save net class memberships
Fixes: lp:1711268
https://bugs.launchpad.net/kicad/+bug/1711268
2017-08-17 18:00:34 +02:00
jean-pierre charras 66ed8f00ca Update a really outdated python script example, and remove a too old example. 2017-01-31 18:39:30 +01:00
jean-pierre charras c761d30ade Make FootprintWizardBase.py compatible with last changes in EDA_TEXT. 2017-01-26 20:19:20 +01:00
jean-pierre charras 24192ff3d6 Add Micromatch connectors footprint wizard. Unfortunately, I don't remember the initial author of this script. 2017-01-04 20:01:15 +01:00
jean-pierre charras 995940e992 refinement 2017-01-04 16:17:40 +01:00
jean-pierre charras 02fa9639cd DIALOG_FOOTPRINT_WIZARD_LIST: minor enhancement. qrcode_footprint_wizard.py: use filled polygons instead of square pads on silkscren layer. 2017-01-04 15:03:43 +01:00
jean-pierre charras 1a464ab8c8 Coding style fixes 2017-01-03 18:04:35 +01:00
Oliver Walters 66ee44cb1f Footprint Wizards Update 2017-01-03 16:01:47 +01:00
Wayne Stambaugh 64c892ee23 Make footprint ID into a generic library ID.
Rename FPID to LIB_ID as is now used as a generic library identifier and
is no longer specific to footprints.

Remove all mention of footprint from the new LIB_ID doxygen comments and
code.

Rename files fpid.h and fpid.cpp to lib_id.h and lib_id.cpp.

Rename fp_lib_table.keywords file to lib_table.keywords and adjust CMake
build dependencies accordingly.

Update all source files effected by the code and file name changes.

Update .gitignore for file name changes.
2016-11-20 18:35:08 -05: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