aboutsummaryrefslogtreecommitdiff
path: root/src/ee/part
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2019-05-07 12:41:42 +0200
committerTrygve Laugstøl <trygvis@inamo.no>2019-05-07 12:41:42 +0200
commitaa9b9d0560b6515a05c2b2c94a75a50fde25e353 (patch)
tree2afb2f09e85310e71e78c77a3224ae7555c2411d /src/ee/part
parent2a48664afc5f634157d9c383f605d0d2541ca1d9 (diff)
downloadee-python-aa9b9d0560b6515a05c2b2c94a75a50fde25e353.tar.gz
ee-python-aa9b9d0560b6515a05c2b2c94a75a50fde25e353.tar.bz2
ee-python-aa9b9d0560b6515a05c2b2c94a75a50fde25e353.tar.xz
ee-python-aa9b9d0560b6515a05c2b2c94a75a50fde25e353.zip
kicad: Better export:
* Allow unannotated parts in the export. * Export value and footprint too.
Diffstat (limited to 'src/ee/part')
-rw-r--r--src/ee/part/__init__.py10
1 files changed, 10 insertions, 0 deletions
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