aboutsummaryrefslogtreecommitdiff
path: root/src/ee/kicad
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2017-12-12 15:34:46 +0100
committerTrygve Laugstøl <trygvis@inamo.no>2017-12-15 07:30:35 +0100
commit206bbfa8424442d49dd62520255aaf47f788f663 (patch)
tree0bed14f878e5d95694e9ee6633dc68d147ad51ea /src/ee/kicad
parentbb600df28f88f892fe221655a47a0ed2f1691b17 (diff)
downloadee-python-206bbfa8424442d49dd62520255aaf47f788f663.tar.gz
ee-python-206bbfa8424442d49dd62520255aaf47f788f663.tar.bz2
ee-python-206bbfa8424442d49dd62520255aaf47f788f663.tar.xz
ee-python-206bbfa8424442d49dd62520255aaf47f788f663.zip
o Adding a 'kicad' format that can be used to compare the output to KiCAD's output.
Diffstat (limited to 'src/ee/kicad')
-rw-r--r--src/ee/kicad/pcb/__init__.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/ee/kicad/pcb/__init__.py b/src/ee/kicad/pcb/__init__.py
index 679c5ea..79987e6 100644
--- a/src/ee/kicad/pcb/__init__.py
+++ b/src/ee/kicad/pcb/__init__.py
@@ -26,7 +26,8 @@ class Module(object):
for k, v in kwargs.items():
setattr(self, k, v)
- self.fp_texts = self.fp_texts or []
+ self.fp_texts = self.fp_texts if hasattr(self, "fp_texts") else []
+ self.attr = self.attr if hasattr(self, "attr") else []
def filter_fp_text(self, kind = None):
filters = []
@@ -36,6 +37,9 @@ class Module(object):
return (fp_text for fp_text in self.fp_texts if run_filters(filters, fp_text))
+ def has_attr(self, name):
+ return next((True for a in self.attr if a == name), False)
+
@auto_str
class Pad(object):
def __init__(self, **kwargs):
@@ -145,6 +149,8 @@ def parse(path):
args[token] = _parse_text(rparen = True)
elif token == "at":
args[token] = _parse_at()
+ elif token == "attr":
+ args[token] = [_parse_text(rparen = True)]
elif token == "pad":
pads.append(_parse_pad())
elif token == "fp_text":