From aa9b9d0560b6515a05c2b2c94a75a50fde25e353 Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Tue, 7 May 2019 12:41:42 +0200 Subject: kicad: Better export: * Allow unannotated parts in the export. * Export value and footprint too. --- src/ee/part/__init__.py | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/ee/part') diff --git a/src/ee/part/__init__.py b/src/ee/part/__init__.py index fbf0838..4354771 100644 --- a/src/ee/part/__init__.py +++ b/src/ee/part/__init__.py @@ -22,6 +22,8 @@ class Part(object): xml.linksProp = xml.linksProp if xml.linksProp is not None else types.LinkList() xml.factsProp = xml.factsProp if xml.factsProp is not None else types.FactList() + self.facts = Facts(self) + def clean_xml(self): x = self.xml if len(x.referencesProp.part_referenceProp) == 0 and \ @@ -154,6 +156,14 @@ class Part(object): return next((f for f in self.get_facts() if f.keyProp == key), None) +class Facts(object): + def __init__(self, part): + self.part = part + + def add(self, key: str, value: str, label=None): + self.part.get_facts().append(types.Fact(key=key, label=label, value=value)) + + class Entry(object): def __init__(self, new: bool, part: types.Part): self.new = new -- cgit v1.2.3