Commit Graph

206 Commits

Author SHA1 Message Date
Salvador E. Tropea 3822a39671 Added _pos to all position formats in the ID field. 2020-07-12 18:59:50 -03:00
Salvador E. Tropea 9d10c991da Changed default name for step files (adds -3D) 2020-07-12 18:55:08 -03:00
Salvador E. Tropea 031c69e27c Added `position` output configuration. 2020-07-12 18:46:37 -03:00
Salvador E. Tropea 36eedc9fce Added `drill` output configuration 2020-07-12 17:43:15 -03:00
Salvador E. Tropea b8b1277f5f Drill map file names can be configured. 2020-07-12 17:01:23 -03:00
Salvador E. Tropea b6347d8992 Drill report now uses %i='drill_report' %x='txt' 2020-07-12 16:27:46 -03:00
Salvador E. Tropea bc52d932b0 Changed default file name for pdf_pcb_print
Now %i is the list of layers (suffixes) and %x is PDF.
The default is %f-%i.%x
2020-07-12 16:17:38 -03:00
Salvador E. Tropea f8c339aa3d Simplified the Optionable.expand_filename() usage.
Now the dir concatenation and absolute expansion is done in the
function avoiding repetition.
2020-07-12 16:15:56 -03:00
Salvador E. Tropea acf6bedda8 Defined %i as 'job' for gerber job files. 2020-07-12 15:55:25 -03:00
Salvador E. Tropea 41de8c032c Added `output` option to control the file name to all plot output formats. 2020-07-12 13:00:38 -03:00
Salvador E. Tropea e2854ef524 Added gerber.gerber_job_file option to control the gerber job file name. 2020-07-12 12:28:00 -03:00
Salvador E. Tropea 63999aa009 Preflight filters parsed by Optionable class.
This makes the filters similar to output options.
- Adds coherence to error messages.
- Enable aliases (used the ones suggested by @leoheck)
Additionally now the README.md preflights documentation comes directly
from --help-preflights
2020-07-12 11:52:44 -03:00
Salvador E. Tropea 9fdc02ecea Added aliases for options.
The test case is the pdf_pcb_print.output_name, which is different than
other *.output options. Now output_name is an alias for output.
2020-07-12 09:41:16 -03:00
Salvador E. Tropea 2dab2417e0 Bumped version to 0.5.0 2020-07-11 14:02:09 -03:00
Salvador E. Tropea 52e6bb1b5f Added support for PcbDraw 2020-07-11 13:49:03 -03:00
Salvador E. Tropea c468dd44e1 Removed unused log import 2020-07-09 18:50:29 -03:00
Salvador E. Tropea f72ff3f441 Extra dot in step.metric_units docstring.
Remove dead code in check_eeschema_do()
Fixed the way we read scale stuff from a PCB
Added special checks for check_script and check_version
2020-07-09 12:50:27 -03:00
Salvador E. Tropea 587ef177b3 Added test for corrupted PCB, skip a preflight that isn't in use and output
plugin
2020-07-09 09:54:25 -03:00
Salvador E. Tropea a48e9ecc96 Added tests to cover out_pdf_pcb_print.py, error case left out 2020-07-09 09:20:52 -03:00
Salvador E. Tropea 2ade49bde5 Removed Layer.get_id(), no longer used. 2020-07-08 23:43:08 -03:00
Salvador E. Tropea d4677a2c2e Added tests for:
- Inner layer that doesn't exist
- Technical layers
- Wrong layer group/spec
2020-07-08 23:34:45 -03:00
Salvador E. Tropea 995b6990aa Added HPGL and PS autoscaling tests.
Added test for example in a dir that must be created.
Removed code not used in docstring trim.
2020-07-08 23:16:04 -03:00
Salvador E. Tropea 05460f4541 Added test for wrong boolean 2020-07-08 21:06:35 -03:00
Salvador E. Tropea 1917b4c601 Added more tests for errors 2020-07-08 20:41:16 -03:00
Salvador E. Tropea 307bed3a36 Added more preflight tests 2020-07-08 19:49:33 -03:00
Salvador E. Tropea 38baa62cbe Fixed ERC/DRC error count report. 2020-07-08 19:28:07 -03:00
Salvador E. Tropea 922b853084 Fixed ignore_unconnected.
Also added a test and a test for the error type.
Additionally the BasePreflight now provides default run/apply members.
2020-07-08 16:29:30 -03:00
Salvador E. Tropea 4368364489 Refactored the BaseOutput class to make it more similar to the YAML
Now the options are just an attribute of the outputs.
It means we have a set of classes for the options.
All the output content is parsed by the classes, including the Layers.
Now the layers support a simple string (with interesting shortcuts), a list of
strings or the original list of dicts.
2020-07-08 15:17:24 -03:00
Salvador E. Tropea 1c4c94cfa2 Some super() use clean-up.
Now using Python3 style everywhere.
Added some missing calls to allow more cases of use.
2020-07-05 19:11:52 -03:00
Salvador E. Tropea 45ecb1d02a Added a mechanism to specify suboptions.
Now the legacy drill.map.type and drill.report.filename are specified in this
way.
The BaseOutput class now inherits from Optionable.
Suboptions are just Optionable classes.
Also: added traceback print when an error is reported and we are in debug mode.
2020-07-05 12:40:57 -03:00
Salvador E. Tropea ee11ecf8e7 Added number, variant, conf and separator KiBoM options. 2020-07-02 23:30:57 -03:00
Salvador E. Tropea b48998bb86 Applied abspath to the output path to make is cleaner. 2020-07-02 23:29:53 -03:00
Salvador E. Tropea 4538236574 Now outputs and preflights are loaded as plugins.
They can be added from ~/.config/kiplot/plugins/
Also sorted the preflights in the YAML example and allower -v for
--help-list-outputs, needed to know from where are the plugins loaded.
2020-07-02 12:30:30 -03:00
Salvador E. Tropea 1ca21efe94 Now the docstring for string options can specify a list of allowed values
This reduces the number of setters/getters we need to write.
On the other side the time to validate the YAML is increased.
2020-07-02 09:25:06 -03:00
Salvador E. Tropea ec35d2443f Added option to copy plot options from the PCB to the YAML example.
Also added DXF.metric_units and updated the README.
2020-07-01 20:43:03 -03:00
Salvador E. Tropea 3685e3cb8b Enforced a limit to line_width [0.02,2] mm 2020-07-01 11:21:25 -03:00
Salvador E. Tropea 3a1d5d0652 Added pen_number and pen_speed HPGL options 2020-07-01 11:11:33 -03:00
Salvador E. Tropea d926a5419e Added --example basic tests
Also added support for output directory to --example
2020-06-30 20:43:42 -03:00
Salvador E. Tropea 4ae54f3ded Added --example/-x option to generate a configuration example.
The example contains all the available preflights and outputs.
If the user specifies a PCB the names of the layers are from the provided PCB
2020-06-30 20:09:14 -03:00
Salvador E. Tropea f579d648bf Added check for string in outputs.drill.map/report.
Also support 'None' as Python None.
2020-06-30 19:59:21 -03:00
Salvador E. Tropea 60a2649c0f Moved the dril_marks attribute to a separated class.
Reused by 5 output classes.
2020-06-29 20:10:40 -03:00
Salvador E. Tropea 3c6f4950c7 Now the schematic can be specified separately.
We now test if the PCB and/or SCH are there only when we need them.
2020-06-29 19:25:54 -03:00
Salvador E. Tropea 42d1f14056 Now layers are solved when we really need it.
So we can do some operations (like --list) without loading the board.
Also: now the names for the layers are asked to pcbnew classes (not from file)
2020-06-29 12:55:02 -03:00
Salvador E. Tropea 7cd0afcdb9 Excluded from coverage code in macros.py that we aren't using.
This code covers cases that we aren't using.
2020-06-27 19:18:32 -03:00
Salvador E. Tropea a436aea8e7 Now the README.md is sychronized using the help output.
The --help-outputs and --help are embedded in the README.md
To make it easier to read now options are enclosed in `` and the list of
outputs is sorted.
2020-06-27 18:28:05 -03:00
Salvador E. Tropea c82c2f0c39 Added support for all the missing IBoM options.
Note that variants_blacklist and variants_whitelist needs a fresh IBoM.
These options didn't work and crashed IBoM. It was reported as a result of
the tests included in this commit.
2020-06-27 15:04:35 -03:00
Salvador E. Tropea f70e484780 Excluded from coverage the last line of the with document block
This isn't recorded as executed and I don't know how to inform to coverage
that this is executed. SO I'm just excluding them.
2020-06-26 14:46:09 -03:00
Salvador E. Tropea 7726732df9 Created a decorator to register the preflight options 2020-06-26 14:45:33 -03:00
Salvador E. Tropea 2f0f3f755d Changed the command line parser from argparse to docopt.
This make the code cleaner and better documented.
Now the usage is more clear, and also a little bit more strict.
I'm using a modified docopt because I preffer using args.option instead of
args['--option'], I also fixed a few flake8 issues in docopt.py.
2020-06-26 12:04:56 -03:00
Salvador E. Tropea 43b7e27a22 Documented the output_class macro 2020-06-26 12:02:18 -03:00
Salvador E. Tropea 5ce3da2bcc Added a macro decorator to register output classes. 2020-06-25 11:32:13 -03:00
Salvador E. Tropea 46a20404a4 Added preflights help. 2020-06-25 10:31:23 -03:00
Salvador E. Tropea acd5592a45 Now the map.type and report.filename are deprecated in favor of map and report.
The old mechanism is supported, but removed from examples.
Added a test case for the new mechanism.
Documented the reason for the complex properties.
Added docstrings to these particular cases (with None as default).
2020-06-25 09:37:43 -03:00
Salvador E. Tropea fa1ea5bdc9 Outputs help and options review
- Included properties
- The final dot is placed by the printing code (removed from messages)
- docstrings line lengths limited
- Better HPGL help
- Fixed ibom default output (.html.html)
- pdf_pcb_print to use PCB name when not output name
- Default PS scaling factor to 1 (not 2)
2020-06-25 09:05:46 -03:00
Salvador E. Tropea fb5c32f0ad Added negative numbers support to the document macro. 2020-06-25 08:09:39 -03:00
Salvador E. Tropea 6295b00657 Implemented the `sketch_plot` option. 2020-06-24 12:00:53 -03:00
Salvador E. Tropea 505039332b Made sketch_plot default to false when absent. 2020-06-24 11:59:13 -03:00
Salvador E. Tropea 090aa6b8f1 Removed the "plot" option "check_zone_fills".
Not used and overlapped with the preflight option.
2020-06-24 11:26:08 -03:00
Salvador E. Tropea ac4ae89aba Added command line help for the outputs.
--help-list-outputs list supported outputs
--help-outputs list details for the supported outputs
--help-output OUTPUT shows the help for this particular output
2020-06-24 11:02:17 -03:00
Salvador E. Tropea 89fb93d6d7 Documented the output formats in the source code. 2020-06-24 11:01:43 -03:00
Salvador E. Tropea 458d4ba0a9 Removed flake8 issues 2020-06-23 10:27:11 -03:00
Salvador E. Tropea d68376ba2e Added a small test to gerbers output.
Currently commented.
2020-06-23 10:26:29 -03:00
Salvador E. Tropea 6859f89c9c Copied the experiments implementation to the macros file
Is more robust
2020-06-23 10:25:29 -03:00
Salvador E. Tropea 2bb2bd2034 Added preliminary tests to add "automagic" documenation for the output options 2020-06-22 19:47:37 -03:00
Salvador E. Tropea 20d79d58ad Restricted the YAML support to safe features.
I think it doesn't change anything important, but looks sensitive.
2020-06-21 11:58:35 -03:00
Salvador E. Tropea 19023ef4e6 Added tests to cover 100% of kiplot/config_reader.py
Mostly parser errors.
2020-06-19 23:38:09 -03:00
Salvador E. Tropea 7679604646 Major code refactor
Pro:
- Much easier to add new outputs and pre-flights
- All options are optional
- Much better configuration syntax check
- Access to data is simpler

Cons:
- Much more source code files
- I focused on one application, not multiple instances running on the same
  process.
2020-06-19 15:54:55 -03:00
Salvador E. Tropea c2c221151b Bumped version to 0.4.0. 2020-06-17 15:38:49 -03:00
Salvador E. Tropea b8f8ed53bd Added a mechanism to avoid problems with ibom
This new mechanism should be accepted in the upstream.
So we will be able to use unpatched ibom.
2020-06-17 15:34:43 -03:00
Salvador E. Tropea 3382b4fe7b Fixed the way options with arguments are passed to kicad2step. 2020-06-15 15:58:08 -03:00
Salvador E. Tropea ef64a57697 Documented the fact that current kicad2step program never fails.
Well, it fails, but returns 0.
2020-06-15 15:17:09 -03:00
Salvador E. Tropea 2766b5afcb Added STEP file output 2020-06-15 13:21:24 -03:00
Salvador E. Tropea 8fbcffba0f Bumped version to 0.3.0 2020-06-14 15:28:25 -03:00
Salvador E. Tropea 0d9256fb24 The 'check_zone_fills' option is now independent of 'run_drc'
Implemented in a different way.
For all internal commands now we use Python bindings to fill the zones as
suggested by @arikrupnik in johnbeard/kiplot#11
For 'print_pcb' now we ask KiCad to do it before printing (needs v1.4.1)
2020-06-14 15:12:56 -03:00
Salvador E. Tropea 406a9ab374 Fixed gzip exception name. 2020-06-14 12:02:15 -03:00
Salvador E. Tropea 4101f69cd4 Added support for compressed YAML files. 2020-06-14 11:05:08 -03:00
Salvador E. Tropea 61f1ebbab2 Better debug info, fixed errors and no .kicad_pcb dependency
- When a BoM operation fails now we show the output of the child process.
  (Only enabled when using debug verbosity)
- The error levels 1 and 2 were overlapped with internal Python codes.
- Now we delay the PCB load until we really need it. Which could be never.
2020-06-12 15:10:56 -03:00
Salvador E. Tropea aef19e31c7 Bumped version to 0.2.5 2020-06-11 13:10:45 -03:00
Salvador E. Tropea c390ec3cb8 Added support for kicad-automation-tools v1.4.0 DRC/ERC filters 2020-06-09 13:49:04 -03:00
Salvador E. Tropea 9e3865d881 Removed another redundant makedirs. 2020-05-26 19:28:14 -03:00
Salvador E. Tropea 46248a6e2e Removed redundant checks to create the output dir.
They became useless after adding it to _configure_output_dir
2020-05-26 19:15:10 -03:00
Salvador E. Tropea be7a613fc8 Removed os import on plot_config.py. No longer used. 2020-05-26 19:14:10 -03:00
Salvador E. Tropea ee7de07ee4 Removed impossible error condition 2020-05-26 14:55:04 -03:00
Salvador E. Tropea 6c5c33be12 Excluded from coverage an internal error.
Is code that gets executed only if we are in the middle of an
implementation.
2020-05-26 14:52:54 -03:00
Salvador E. Tropea 9f60eca419 Removed two PlotConfig members formerly used for testing. 2020-05-26 14:45:19 -03:00
Salvador E. Tropea 3b7bfe40f7 Set the domain for log messages so we get "kiplot..." and not "kilog...." 2020-05-26 14:33:34 -03:00
Salvador E. Tropea 103ef8b79e Fixed: Most formats that needed layers didn't complain when ommited 2020-05-26 13:50:38 -03:00
Salvador E. Tropea bb6bae95a2 Excluded from coverage the fatal case case when python-yaml isn't installed. 2020-05-26 12:43:14 -03:00
Salvador E. Tropea 53be46e1fe Fixed the pragma in __main__ (typo) 2020-05-26 12:27:48 -03:00
Salvador E. Tropea 9672871ebe Excluded the module import main() exclusion from coverage 2020-05-26 12:23:01 -03:00
Salvador E. Tropea 153d967015 Excluded an "internal error check" from coverage and commented why. 2020-05-25 20:01:31 -03:00
Salvador E. Tropea 1dda835cc5 Removed some dead code about configurations.
_configure_plot_ctrl is called only for "layer" outputs, there is no
point trying to configure other formats.
Also some of the "configuration" were ridiculous calls with an assert
that only tested Python's sanity. Probably optimized out by python
compiler.
2020-05-25 19:23:11 -03:00
Salvador E. Tropea c22ccb607a Fixed: All pcbnew plot formats generated gerber job files 2020-05-25 18:31:31 -03:00
Salvador E. Tropea b053017284 Tolerate config files without outputs 2020-05-20 10:36:28 -03:00
Salvador E. Tropea da94eb3f57 Excluded from coverage the test for pcbnew import 2020-05-20 09:24:59 -03:00
Salvador E. Tropea 84831cbdfc Bumped version to 0.2.4. 2020-05-19 12:14:06 -03:00
Salvador E. Tropea 26b4f5c385 Adapted to kicad-automation-scripts 1.3.x 2020-05-19 12:09:19 -03:00
Salvador E. Tropea bcfaead5f1 Fixed: for print_sch, when the PCB name included a path, it wasn't removed and the
output pointed to a mix of both paths, failing.
2020-05-19 11:37:51 -03:00
Salvador E. Tropea da09a617c4 Problems for kibom output when the PCB name included a path 2020-05-15 10:38:26 -03:00
Salvador E. Tropea a58d99325a Added assert for the pcbnew initialization. Also made some debug messages more clear.
I'm getting errors when the test is done using --plot_dir
2020-05-14 09:41:18 -03:00