Added Pattern and text variables expansion on internal BoM title

Closes #198
This commit is contained in:
Salvador E. Tropea 2022-05-20 07:30:29 -03:00
parent 287f8626ba
commit 23d3d76d94
5 changed files with 11 additions and 2 deletions

View File

@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- New outputs:
- KiCad netlist generation
- IPC-D-356 netlist generation (#197)
- Pattern and text variables expansion on internal BoM title (#198)
### Fixed
- Already configured outputs not created (i.e. when creating reports)

View File

@ -39,7 +39,7 @@ DEFAULT_ALIASES = [['r', 'r_small', 'res', 'resistor'],
]
RegDependency.register(ToolDependency('bom', 'KiCost', URL_KICOST, url_down=URL_KICOST+'/releases', in_debian=False,
roles=ToolDependencyRole(desc='Find components costs and specs', version=(1, 1, 8))))
RegDependency.register(ToolDependency('bom', 'xlsxwriter', is_python=True,
RegDependency.register(ToolDependency('bom', 'XLSXWriter', is_python=True,
roles=ToolDependencyRole(desc='Create XLSX files')))
@ -600,6 +600,12 @@ class BoMOptions(BaseOptions):
# If no options get the defaults
self.xlsx = BoMXLSX()
self.xlsx.config(self)
# Do title %X and ${var} expansions on the BoMLinkable titles
# Here because some variables needs our parent
if self.format == 'html' and self.html.title:
self.html.title = self.expand_filename_both(self.html.title, make_safe=False)
if self.format == 'xlsx' and self.xlsx.title:
self.xlsx.title = self.expand_filename_both(self.xlsx.title, make_safe=False)
# group_fields
if isinstance(self.group_fields, type):
self.group_fields = GroupFields.get_default()

View File

@ -10,4 +10,5 @@ outputs:
options:
html:
logo: false
title: "%f BOM"
style: 'modern-green'

View File

@ -10,4 +10,5 @@ outputs:
options:
format: XLSX
xlsx:
title: "%f BOM"
logo: false

View File

@ -22,7 +22,7 @@ outputs:
dir: Layers
output_id: -front
options:
title: 'Fake title for front copper and silk'
title: 'Fake title for front copper and silk (%f)'
pages:
- scaling: 2.0
layers: