summaryrefslogtreecommitdiff
path: root/gerbonara/cad/kicad/symbols.py
diff options
context:
space:
mode:
authorjaseg <git@jaseg.de>2023-07-18 21:54:26 +0200
committerjaseg <git@jaseg.de>2023-07-18 21:54:26 +0200
commita1b8cbf86160eb2fbe73ffda61c953589ffa3512 (patch)
tree4123a00e361d48e2b1fb73039858633b847ab931 /gerbonara/cad/kicad/symbols.py
parent58142cb0c7c0a38dd07592632a7e0c1622cc99d9 (diff)
downloadgerbonara-a1b8cbf86160eb2fbe73ffda61c953589ffa3512.tar.gz
gerbonara-a1b8cbf86160eb2fbe73ffda61c953589ffa3512.tar.bz2
gerbonara-a1b8cbf86160eb2fbe73ffda61c953589ffa3512.zip
Make kicad eat schematics written by gerbonara
Diffstat (limited to 'gerbonara/cad/kicad/symbols.py')
-rw-r--r--gerbonara/cad/kicad/symbols.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/gerbonara/cad/kicad/symbols.py b/gerbonara/cad/kicad/symbols.py
index 7e16d38..0f32b4d 100644
--- a/gerbonara/cad/kicad/symbols.py
+++ b/gerbonara/cad/kicad/symbols.py
@@ -247,7 +247,7 @@ class Unit:
if not (m := re.fullmatch(r'(.*)_([0-9]+)_([0-9]+)', self.name)):
raise FormatError(f'Invalid unit name "{self.name}"')
sym_name, unit_index, demorgan_style = m.groups()
- if sym_name != self.symbol.name:
+ if sym_name != self.symbol.raw_name.rpartition(':')[2]:
raise FormatError(f'Unit name "{self.name}" does not match symbol name "{self.symbol.name}"')
self.demorgan_style = int(demorgan_style)
self.unit_index = int(unit_index)
@@ -271,7 +271,7 @@ class Unit:
@sexp_type('symbol')
class Symbol:
- name: str = None
+ raw_name: str = None
extends: Named(str) = None
power: Wrap(Flag()) = False
pin_numbers: OmitDefault(PinNumberSpec) = field(default_factory=PinNumberSpec)
@@ -284,10 +284,13 @@ class Symbol:
styles: {str: {str: Unit}} = None
global_units: {str: {str: Unit}} = None
library = None
+ name: str = None
+ library_name: str = None
def __after_parse__(self, parent):
self.library = parent
+ self.library_name, _, self.name = self.raw_name.rpartition(':')
self.global_units = {}
self.styles = {}