Changed the default `group_fields` list.
Internal BoM: now components with different Tolerance, Voltage, Current and/or Power fields aren't grouped together. These fields are now part of the default `group_fields`. (#79)
This commit is contained in:
parent
e902c7350d
commit
0f0e739026
|
|
@ -12,6 +12,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
- skip_bottom: bottom components aren't rotated.
|
- skip_bottom: bottom components aren't rotated.
|
||||||
- XLSX BoM: option to control the logo scale (#84)
|
- XLSX BoM: option to control the logo scale (#84)
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
- Internal BoM: now components with different Tolerance, Voltage, Current
|
||||||
|
and/or Power fields aren't grouped together.
|
||||||
|
These fields are now part of the default `group_fields`. (#79)
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
- Position files now defaults to use the auxiliar origin as KiCad.
|
- Position files now defaults to use the auxiliar origin as KiCad.
|
||||||
Can be disabled to use absolute coordinates. (#87)
|
Can be disabled to use absolute coordinates. (#87)
|
||||||
|
|
|
||||||
|
|
@ -692,7 +692,8 @@ Next time you need this list just use an alias, like this:
|
||||||
- `group_fields`: [list(string)] List of fields used for sorting individual components into groups.
|
- `group_fields`: [list(string)] List of fields used for sorting individual components into groups.
|
||||||
Components which match (comparing *all* fields) will be grouped together.
|
Components which match (comparing *all* fields) will be grouped together.
|
||||||
Field names are case-insensitive.
|
Field names are case-insensitive.
|
||||||
If empty: ['Part', 'Part Lib', 'Value', 'Footprint', 'Footprint Lib'] is used.
|
If empty: ['Part', 'Part Lib', 'Value', 'Footprint', 'Footprint Lib',
|
||||||
|
'Voltage', 'Tolerance', 'Current', 'Power'] is used.
|
||||||
- `group_fields_fallbacks`: [list(string)] List of fields to be used when the fields in `group_fields` are empty.
|
- `group_fields_fallbacks`: [list(string)] List of fields to be used when the fields in `group_fields` are empty.
|
||||||
The first field in this list is the fallback for the first in `group_fields`, and so on.
|
The first field in this list is the fallback for the first in `group_fields`, and so on.
|
||||||
- `html`: [dict] Options for the HTML format.
|
- `html`: [dict] Options for the HTML format.
|
||||||
|
|
|
||||||
|
|
@ -130,8 +130,9 @@ outputs:
|
||||||
# [list(string)] List of fields used for sorting individual components into groups.
|
# [list(string)] List of fields used for sorting individual components into groups.
|
||||||
# Components which match (comparing *all* fields) will be grouped together.
|
# Components which match (comparing *all* fields) will be grouped together.
|
||||||
# Field names are case-insensitive.
|
# Field names are case-insensitive.
|
||||||
# If empty: ['Part', 'Part Lib', 'Value', 'Footprint', 'Footprint Lib'] is used
|
# If empty: ['Part', 'Part Lib', 'Value', 'Footprint', 'Footprint Lib',
|
||||||
group_fields: ['part', 'part lib', 'value', 'footprint', 'footprint lib']
|
# 'Voltage', 'Tolerance', 'Current', 'Power'] is used
|
||||||
|
group_fields: ['part', 'part lib', 'value', 'footprint', 'footprint lib', 'voltage', 'tolerance', 'current', 'power']
|
||||||
# [list(string)] List of fields to be used when the fields in `group_fields` are empty.
|
# [list(string)] List of fields to be used when the fields in `group_fields` are empty.
|
||||||
# The first field in this list is the fallback for the first in `group_fields`, and so on
|
# The first field in this list is the fallback for the first in `group_fields`, and so on
|
||||||
group_fields_fallbacks:
|
group_fields_fallbacks:
|
||||||
|
|
|
||||||
|
|
@ -405,8 +405,8 @@ def print_example_options(f, cls, name, indent, po, is_list=False):
|
||||||
# Get the text before the space, without the ]
|
# Get the text before the space, without the ]
|
||||||
txt = txt.split()[0][:-1]
|
txt = txt.split()[0][:-1]
|
||||||
f.write(ind_str+'{}: {}\n'.format(k, txt))
|
f.write(ind_str+'{}: {}\n'.format(k, txt))
|
||||||
elif hasattr(val, '_default'):
|
elif val.get_default():
|
||||||
f.write(ind_str+'{}: {}\n'.format(k, val._default))
|
f.write(ind_str+'{}: {}\n'.format(k, val.get_default()))
|
||||||
else:
|
else:
|
||||||
f.write(ind_str+'{}:\n'.format(k))
|
f.write(ind_str+'{}:\n'.format(k))
|
||||||
print_example_options(f, val, '', indent+2, None, help and 'list(dict' in help_lines[0])
|
print_example_options(f, val, '', indent+2, None, help and 'list(dict' in help_lines[0])
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,7 @@ class Optionable(object):
|
||||||
Is configured from a dict and the collected values are stored in its attributes. """
|
Is configured from a dict and the collected values are stored in its attributes. """
|
||||||
_str_values_re = compile(r"string=.*\] \[([^\]]+)\]")
|
_str_values_re = compile(r"string=.*\] \[([^\]]+)\]")
|
||||||
_num_range_re = compile(r"number=.*\] \[(-?\d+),(-?\d+)\]")
|
_num_range_re = compile(r"number=.*\] \[(-?\d+),(-?\d+)\]")
|
||||||
|
_default = None
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self._unkown_is_error = False
|
self._unkown_is_error = False
|
||||||
|
|
@ -253,6 +254,10 @@ class Optionable(object):
|
||||||
val = []
|
val = []
|
||||||
return val
|
return val
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def get_default(cls):
|
||||||
|
return cls._default
|
||||||
|
|
||||||
|
|
||||||
class BaseOptions(Optionable):
|
class BaseOptions(Optionable):
|
||||||
""" A class to validate and hold output options.
|
""" A class to validate and hold output options.
|
||||||
|
|
|
||||||
|
|
@ -183,7 +183,7 @@ class ComponentAliases(Optionable):
|
||||||
|
|
||||||
|
|
||||||
class GroupFields(Optionable):
|
class GroupFields(Optionable):
|
||||||
_default = ColumnList.DEFAULT_GROUPING
|
_default = ColumnList.DEFAULT_GROUPING + ['voltage', 'tolerance', 'current', 'power']
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
|
|
@ -274,7 +274,8 @@ class BoMOptions(BaseOptions):
|
||||||
""" [list(string)] List of fields used for sorting individual components into groups.
|
""" [list(string)] List of fields used for sorting individual components into groups.
|
||||||
Components which match (comparing *all* fields) will be grouped together.
|
Components which match (comparing *all* fields) will be grouped together.
|
||||||
Field names are case-insensitive.
|
Field names are case-insensitive.
|
||||||
If empty: ['Part', 'Part Lib', 'Value', 'Footprint', 'Footprint Lib'] is used """
|
If empty: ['Part', 'Part Lib', 'Value', 'Footprint', 'Footprint Lib',
|
||||||
|
. 'Voltage', 'Tolerance', 'Current', 'Power'] is used """
|
||||||
self.group_fields_fallbacks = Optionable
|
self.group_fields_fallbacks = Optionable
|
||||||
""" [list(string)] List of fields to be used when the fields in `group_fields` are empty.
|
""" [list(string)] List of fields to be used when the fields in `group_fields` are empty.
|
||||||
The first field in this list is the fallback for the first in `group_fields`, and so on """
|
The first field in this list is the fallback for the first in `group_fields`, and so on """
|
||||||
|
|
@ -427,7 +428,7 @@ class BoMOptions(BaseOptions):
|
||||||
self.xlsx.config(self)
|
self.xlsx.config(self)
|
||||||
# group_fields
|
# group_fields
|
||||||
if isinstance(self.group_fields, type):
|
if isinstance(self.group_fields, type):
|
||||||
self.group_fields = ColumnList.DEFAULT_GROUPING
|
self.group_fields = GroupFields.get_default()
|
||||||
else:
|
else:
|
||||||
# Make the grouping fields lowercase
|
# Make the grouping fields lowercase
|
||||||
self.group_fields = [f.lower() for f in self.group_fields]
|
self.group_fields = [f.lower() for f in self.group_fields]
|
||||||
|
|
|
||||||
|
|
@ -32,4 +32,4 @@ outputs:
|
||||||
dir: BoM
|
dir: BoM
|
||||||
options:
|
options:
|
||||||
exclude_filter: 'exclude_any'
|
exclude_filter: 'exclude_any'
|
||||||
|
group_fields: ['Part', 'Part Lib', 'Value', 'Footprint', 'Footprint Lib']
|
||||||
|
|
|
||||||
|
|
@ -7,4 +7,5 @@ outputs:
|
||||||
comment: "Bill of Materials in CSV format"
|
comment: "Bill of Materials in CSV format"
|
||||||
type: bom
|
type: bom
|
||||||
dir: BoM
|
dir: BoM
|
||||||
|
options:
|
||||||
|
group_fields: ['Part', 'Part Lib', 'Value', 'Footprint', 'Footprint Lib']
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue