From 7bdbe66dc7caf3d27fd13b72a2603b7bca19762d Mon Sep 17 00:00:00 2001 From: jaseg Date: Tue, 21 Jun 2022 14:17:08 +0200 Subject: Fix zip import/export and bounds for empty boards --- gerbonara/layers.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'gerbonara/layers.py') diff --git a/gerbonara/layers.py b/gerbonara/layers.py index 41c5bfe..afd6db9 100644 --- a/gerbonara/layers.py +++ b/gerbonara/layers.py @@ -27,6 +27,7 @@ import itertools from collections import namedtuple from pathlib import Path from zipfile import ZipFile, is_zipfile +import tempfile from .excellon import ExcellonFile, parse_allegro_ncparam, parse_allegro_logfile from .rs274x import GerberFile @@ -249,13 +250,13 @@ class LayerStack: @classmethod def open_zip(kls, file, original_path=None, board_name=None, lazy=False): tmpdir = tempfile.TemporaryDirectory() - tmp_indir = Path(tmpdir) / 'input' + tmp_indir = Path(tmpdir.name) / 'input' tmp_indir.mkdir() with ZipFile(file) as f: f.extractall(path=tmp_indir) - inst = kls.from_directory(tmp_indir, board_name=board_name, lazy=lazy) + inst = kls.open_dir(tmp_indir, board_name=board_name, lazy=lazy) inst.tmpdir = tmpdir inst.original_path = Path(original_path or file) inst.was_zipped = True @@ -486,7 +487,7 @@ class LayerStack: if force_bounds: bounds = svg_unit.convert_bounds_from(arg_unit, force_bounds) else: - bounds = selfboard_bounds(unit=svg_unit, default=((0, 0), (0, 0))) + bounds = self.board_bounds(unit=svg_unit, default=((0, 0), (0, 0))) tags = [] inkscape_attrs = lambda label: dict(inkscape__groupmode='layer', inkscape__label=label) if inkscape else {} -- cgit