Skip to content

Commit

Permalink
[DOCs][Fixed] pcbdraw.remap is a string_dict (not a regular dict)
Browse files Browse the repository at this point in the history
  • Loading branch information
set-soft committed Sep 18, 2024
1 parent 7444fc8 commit a991fc0
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 32 deletions.
4 changes: 2 additions & 2 deletions docs/samples/generic_plot.kibot.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2845,9 +2845,9 @@ outputs:
# [string|list(string)='_null'] Name of the filter to transform fields before applying other filters.
# A short-cut to use for simple cases where a variant is an overkill
pre_transform: '_null'
# [dict|string='None'] (DEPRECATED) Replacements for PCB references using specified components (lib:component).
# [string_dict|string='None'] (DEPRECATED) Replacements for PCB references using specified components (lib:component).
# Use `remap_components` instead
remap:
remap: 'None'
# [list(dict)=[]] Replacements for PCB references using specified components.
# Replaces `remap` with type check
remap_components:
Expand Down
4 changes: 2 additions & 2 deletions docs/source/configuration/outputs/PcbDrawOptions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,9 @@ PcbDrawOptions parameters
- ``pre_transform`` :index:`: <pair: output - pcbdraw - options; pre_transform>` [:ref:`string <string>` | :ref:`list(string) <list(string)>`] (default: ``'_null'``) Name of the filter to transform fields before applying other filters.
A short-cut to use for simple cases where a variant is an overkill.

- ``remap`` :index:`: <pair: output - pcbdraw - options; remap>` [:ref:`PcbDrawRemap parameters <PcbDrawRemap>`] [:ref:`dict <dict>` | :ref:`string <string>`] (default: ``'None'``) (DEPRECATED) Replacements for PCB references using specified components (lib:component).
- ``remap`` :index:`: <pair: output - pcbdraw - options; remap>` [:ref:`string_dict <string_dict>` | :ref:`string <string>`] (default: ``'None'``) (DEPRECATED) Replacements for PCB references using specified components (lib:component).
Use `remap_components` instead.

- ``remap_components`` :index:`: <pair: output - pcbdraw - options; remap_components>` [:ref:`PcbDrawRemapComponents parameters <PcbDrawRemapComponents>`] [:ref:`list(dict) <list(dict)>`] (default: ``[]``) Replacements for PCB references using specified components.
Replaces `remap` with type check.
- ``resistor_flip`` :index:`: <pair: output - pcbdraw - options; resistor_flip>` [:ref:`string <string>` | :ref:`list(string) <list(string)>`] (default: ``''``) [:ref:`comma separated <comma_sep>`] List of resistors to flip its bands.
Expand All @@ -66,7 +67,6 @@ PcbDrawOptions parameters
.. toctree::
:caption: Used dicts

PcbDrawRemap
PcbDrawRemapComponents
PcbDrawResistorRemap
PcbDrawStyle
Expand Down
7 changes: 0 additions & 7 deletions docs/source/configuration/outputs/PcbDrawRemap.rst

This file was deleted.

15 changes: 4 additions & 11 deletions kibot/out_pcbdraw.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,13 +113,6 @@ def to_dict(self):
return {k.replace('_', '-'): v for k, v in self.get_attrs_gen()}


class PcbDrawRemap(Optionable):
""" This class accepts a free form dict.
No validation is done. """
def config(self, parent):
pass


class PcbDrawResistorRemap(Optionable):
""" Reference -> New value """
def __init__(self):
Expand Down Expand Up @@ -188,9 +181,9 @@ def __init__(self):
""" [list(string)] List of libraries """
self.placeholder = False
""" Show placeholder for missing components """
self.remap = PcbDrawRemap
""" [dict|string='None'] (DEPRECATED) Replacements for PCB references using specified components (lib:component).
Use `remap_components` instead """
self.remap = Optionable
""" [string_dict|string='None'] (DEPRECATED) Replacements for PCB references using specified components
(lib:component). Use `remap_components` instead """
self.remap_components = PcbDrawRemapComponents
""" [list(dict)=[]] Replacements for PCB references using specified components.
Replaces `remap` with type check """
Expand Down Expand Up @@ -280,7 +273,7 @@ def config(self, parent):
self.show_components = self.solve_kf_filters(self.show_components)
# Resistors Remap
self._remap = {}
if isinstance(self.remap, PcbDrawRemap):
if isinstance(self.remap, Optionable):
for ref, v in self.remap._tree.items():
if not isinstance(v, str):
raise KiPlotConfigurationError("Wrong PcbDraw remap, must be `ref: lib:component` ({}: {})".format(ref, v))
Expand Down
4 changes: 2 additions & 2 deletions tests/GUI/outputs
Original file line number Diff line number Diff line change
Expand Up @@ -8953,10 +8953,10 @@
[
"remap",
[
"DataTypeDict",
"DataTypeStringDict",
"DataTypeString"
],
[]
null
],
[
"remap_components",
Expand Down
18 changes: 10 additions & 8 deletions tests/GUI/stats
Original file line number Diff line number Diff line change
Expand Up @@ -142,14 +142,14 @@ Outputs sorted by depth:
- Number: 266
- ListStringSingular: 222
- Choice: 94
- Dict: 80
- Dict: 79
- ListDictOrString: 21
- ListDict: 20
- Combo: 14
- ListString: 9
- ListDictSingular: 5
- ListListString: 2
- StringDict: 1
- StringDict: 2
- NumberChoice: 1
--------------------------------------------------------------------------------
Used as single data type:
Expand All @@ -168,16 +168,17 @@ Used as single data type:
- StringDict: 1 ['download_datasheets.options.classify_extra']
- NumberChoice: 1 ['gerber.options.gerber_precision']
--------------------------------------------------------------------------------
9 different data type combinations
10 different data type combinations
- Number,String: 92
- Boolean,String: 52
- Combo,ListDictOrString: 12
- Dict,String: 6 ['blender_export.options.pcb3d', 'excellon.options.report', 'gerb_drill.options.report', 'kibom.options.conf', 'pcbdraw.options.style', 'pcbdraw.options.remap']
- Dict,String: 5 ['blender_export.options.pcb3d', 'excellon.options.report', 'gerb_drill.options.report', 'kibom.options.conf', 'pcbdraw.options.style']
- ListDictOrString,String: 4 ['bom.options.columns.join', 'bom.options.cost_extra_columns.join', 'bom.options.xlsx.specs_columns.join', 'panelize.options.configs']
- Boolean,ListStringSingular: 3 ['bom.options.html.lcsc_link', 'bom.options.xlsx.lcsc_link', 'kibom.options.conf.lcsc_link']
- Choice,Dict: 2 ['excellon.options.map', 'gerb_drill.options.map']
- Dict,Number: 2 ['pcbdraw.options.margin', 'svg.options.margin']
- Boolean,Choice: 1 ['ibom.options.highlight_pin1']
- String,StringDict: 1 ['pcbdraw.options.remap']
================================================================================
================================================================================
21 preflights types with a total of 120 different parameters
Expand Down Expand Up @@ -599,14 +600,14 @@ Totals sorted by depth:
- Number: 295
- ListStringSingular: 251
- Choice: 124
- Dict: 89
- Dict: 88
- ListDict: 30
- ListDictOrString: 22
- Combo: 14
- ListString: 12
- ListDictSingular: 10
- ListListString: 4
- StringDict: 1
- StringDict: 2
- NumberChoice: 1
--------------------------------------------------------------------------------
Used as single data type:
Expand All @@ -625,15 +626,16 @@ Used as single data type:
- StringDict: 1 ['download_datasheets.options.classify_extra']
- NumberChoice: 1 ['gerber.options.gerber_precision']
--------------------------------------------------------------------------------
10 different data type combinations
11 different data type combinations
- Number,String: 107
- Boolean,String: 52
- Combo,ListDictOrString: 12
- Dict,String: 6 ['blender_export.options.pcb3d', 'excellon.options.report', 'gerb_drill.options.report', 'kibom.options.conf', 'pcbdraw.options.style', 'pcbdraw.options.remap']
- Boolean,Dict: 6 ['draw_stackup.draw_stackup', 'drc.drc', 'erc.erc', 'run_drc.run_drc', 'run_erc.run_erc', 'update_xml.update_xml']
- Dict,String: 5 ['blender_export.options.pcb3d', 'excellon.options.report', 'gerb_drill.options.report', 'kibom.options.conf', 'pcbdraw.options.style']
- ListDictOrString,String: 4 ['bom.options.columns.join', 'bom.options.cost_extra_columns.join', 'bom.options.xlsx.specs_columns.join', 'panelize.options.configs']
- Boolean,ListStringSingular: 3 ['bom.options.html.lcsc_link', 'bom.options.xlsx.lcsc_link', 'kibom.options.conf.lcsc_link']
- Choice,Dict: 2 ['excellon.options.map', 'gerb_drill.options.map']
- Dict,Number: 2 ['pcbdraw.options.margin', 'svg.options.margin']
- Boolean,Choice: 1 ['ibom.options.highlight_pin1']
- String,StringDict: 1 ['pcbdraw.options.remap']
Found 2 unique warning/s (3 total)

0 comments on commit a991fc0

Please sign in to comment.