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
This commit is contained in:
Salvador E. Tropea 2020-07-12 16:17:38 -03:00
parent f8c339aa3d
commit bc52d932b0
2 changed files with 7 additions and 6 deletions

View File

@ -17,15 +17,17 @@ class PDF_Pcb_PrintOptions(BaseOptions):
def __init__(self):
super().__init__()
with document:
self.output = '%f.pdf'
""" filename for the output PDF """
self.output = '%f-%i.%x'
""" filename for the output PDF (%i=layers, %x=pdf)"""
self.output_name = None
""" {output} """ # pragma: no cover
def run(self, output_dir, board, layers):
check_script(CMD_PCBNEW_PRINT_LAYERS, URL_PCBNEW_PRINT_LAYERS, '1.4.1')
layers = Layer.solve(layers)
# Output file name
output = os.path.abspath(os.path.join(output_dir, self.expand_filename(self.output)))
id = '+'.join([l.suffix for l in layers])
output = self.expand_filename(output_dir, self.output, id, 'pdf')
cmd = [CMD_PCBNEW_PRINT_LAYERS, 'export', '--output_name', output]
if BasePreFlight.get_option('check_zone_fills'):
cmd.append('-f')
@ -34,7 +36,6 @@ class PDF_Pcb_PrintOptions(BaseOptions):
cmd.insert(1, '-vv')
cmd.insert(1, '-r')
# Add the layers
layers = Layer.solve(layers)
cmd.extend([l.layer for l in layers])
# Execute it
logger.debug('Executing: '+str(cmd))

View File

@ -19,11 +19,11 @@ if prev_dir not in sys.path:
from utils import context
PDF_DIR = 'Layers'
PDF_FILE = 'bom.pdf'
PDF_FILE = 'bom-F_Cu+F_SilkS.pdf'
PDF_FILE_B = 'PCB_Bot.pdf'
def test_print_pcb():
def test_print_pcb_simple():
prj = 'bom'
ctx = context.TestContext('PrPCB', prj, 'print_pcb', PDF_DIR)
ctx.run()