diff options
Diffstat (limited to 'src/ee/kicad')
-rw-r--r-- | src/ee/kicad/pcb/__init__.py | 8 |
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": |