summaryrefslogtreecommitdiff
path: root/gerbonara/layers.py
diff options
context:
space:
mode:
authorjaseg <git@jaseg.de>2022-06-21 14:17:08 +0200
committerjaseg <git@jaseg.de>2022-06-21 14:17:08 +0200
commit7bdbe66dc7caf3d27fd13b72a2603b7bca19762d (patch)
tree2fa0507a61b7acbdfa1fa39f2b70d9788e2d12f9 /gerbonara/layers.py
parent71e996e8749e26dcc1385b03603344dede891782 (diff)
downloadgerbonara-0.11.1.tar.gz
gerbonara-0.11.1.tar.bz2
gerbonara-0.11.1.zip
Fix zip import/export and bounds for empty boardsv0.11.1
Diffstat (limited to 'gerbonara/layers.py')
-rw-r--r--gerbonara/layers.py7
1 files changed, 4 insertions, 3 deletions
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 {}