[Schematic v6][Fixed] Targets
- We always collected the v5 targets - Detect flat hierarchy
This commit is contained in:
parent
742a8c155e
commit
82532ffab0
|
|
@ -123,6 +123,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
- Schematics:
|
- Schematics:
|
||||||
- Problems with deep nested and recycled sheets (#520)
|
- Problems with deep nested and recycled sheets (#520)
|
||||||
- Problems saving deep nested sheets
|
- Problems saving deep nested sheets
|
||||||
|
- Makefile/compress targets
|
||||||
- Rotated polygons and text used in the worksheet (#466)
|
- Rotated polygons and text used in the worksheet (#466)
|
||||||
- The --log/-L didn't enabled full debug for all messages
|
- The --log/-L didn't enabled full debug for all messages
|
||||||
- BoM:
|
- BoM:
|
||||||
|
|
|
||||||
|
|
@ -1916,7 +1916,7 @@ class SchematicV6(Schematic):
|
||||||
f.write(dumps(lib))
|
f.write(dumps(lib))
|
||||||
f.write('\n')
|
f.write('\n')
|
||||||
|
|
||||||
def save(self, fname=None, dest_dir=None, base_sheet=None, saved=None, cross=False, exp_hierarchy=False):
|
def save(self, fname=None, dest_dir=None, base_sheet=None, saved=None, cross=False, exp_hierarchy=False, dry=False):
|
||||||
# Switch to the current version
|
# Switch to the current version
|
||||||
global version
|
global version
|
||||||
version = self.version
|
version = self.version
|
||||||
|
|
@ -1946,7 +1946,7 @@ class SchematicV6(Schematic):
|
||||||
# Save all in dest_dir (variant)
|
# Save all in dest_dir (variant)
|
||||||
fname = os.path.join(dest_dir, fname)
|
fname = os.path.join(dest_dir, fname)
|
||||||
# Save the sheet
|
# Save the sheet
|
||||||
if fname not in saved:
|
if fname not in saved and not dry:
|
||||||
sch = [Symbol('kicad_sch')]
|
sch = [Symbol('kicad_sch')]
|
||||||
sch.append(_symbol('version', [self.version]))
|
sch.append(_symbol('version', [self.version]))
|
||||||
sch.append(_symbol('generator', [Symbol(self.generator)]))
|
sch.append(_symbol('generator', [Symbol(self.generator)]))
|
||||||
|
|
@ -2028,17 +2028,25 @@ class SchematicV6(Schematic):
|
||||||
with GS.create_file(fname) as f:
|
with GS.create_file(fname) as f:
|
||||||
f.write(dumps(sch))
|
f.write(dumps(sch))
|
||||||
f.write('\n')
|
f.write('\n')
|
||||||
|
if fname not in saved:
|
||||||
saved.add(fname)
|
saved.add(fname)
|
||||||
for sch in self.sheets:
|
for sch in self.sheets:
|
||||||
if sch.sch:
|
if sch.sch:
|
||||||
sch.sch.save(sch.flat_file if exp_hierarchy else sch.sch.fname_rel, dest_dir, base_sheet, saved, cross=cross,
|
sch.sch.save(sch.flat_file if exp_hierarchy else sch.sch.fname_rel, dest_dir, base_sheet, saved, cross=cross,
|
||||||
exp_hierarchy=exp_hierarchy)
|
exp_hierarchy=exp_hierarchy, dry=dry)
|
||||||
|
|
||||||
def save_variant(self, dest_dir):
|
def save_variant(self, dest_dir):
|
||||||
fname = os.path.basename(self.fname)
|
fname = os.path.basename(self.fname)
|
||||||
self.save(fname, dest_dir, cross=True, exp_hierarchy=self.check_exp_hierarchy())
|
self.save(fname, dest_dir, cross=True, exp_hierarchy=self.check_exp_hierarchy())
|
||||||
return fname
|
return fname
|
||||||
|
|
||||||
|
def file_names_variant(self, dest_dir):
|
||||||
|
""" Returns a list of file names created by save_variant() """
|
||||||
|
saved = set()
|
||||||
|
fname = os.path.basename(self.fname)
|
||||||
|
self.save(fname, dest_dir, cross=True, exp_hierarchy=self.check_exp_hierarchy(), dry=True, saved=saved)
|
||||||
|
return saved
|
||||||
|
|
||||||
def check_exp_hierarchy(self):
|
def check_exp_hierarchy(self):
|
||||||
""" Check if we really need to expand the hierarchy """
|
""" Check if we really need to expand the hierarchy """
|
||||||
# KiCad v6: we can change the value and footprint, but won't work when imported by v7
|
# KiCad v6: we can change the value and footprint, but won't work when imported by v7
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue