misc fixes
This commit is contained in:
parent
d079b44883
commit
cca6b90830
@ -345,6 +345,7 @@ class FlatBuilder(PortList):
|
||||
other_copy.mirror2d(mirrored)
|
||||
other_copy.rotate_around(pivot, rotation)
|
||||
other_copy.translate_elements(offset)
|
||||
other_copy.ports.clear()
|
||||
self.pattern.append(other_copy)
|
||||
return self
|
||||
|
||||
|
@ -44,7 +44,7 @@ def _rename_patterns(lib: 'Library', name: str) -> str:
|
||||
return name
|
||||
|
||||
stem = name.split('$')[0]
|
||||
return lib.get_name(stem)
|
||||
return lib.get_name(stem)
|
||||
|
||||
|
||||
class Library(Mapping[str, 'Pattern'], metaclass=ABCMeta):
|
||||
@ -493,7 +493,7 @@ class MutableLibrary(Library, MutableMapping[str, 'Pattern'], metaclass=ABCMeta)
|
||||
Returns:
|
||||
(name, pattern) tuple
|
||||
"""
|
||||
from .pattern import Pattern
|
||||
from .pattern import NamedPattern
|
||||
#name = self.get_name(base_name)
|
||||
npat = NamedPattern(name)
|
||||
self[name] = npat
|
||||
@ -550,7 +550,7 @@ class MutableLibrary(Library, MutableMapping[str, 'Pattern'], metaclass=ABCMeta)
|
||||
if internal_conflicts:
|
||||
raise LibraryError('Renamed patterns conflict with un-renamed names in `other`' + pformat(internal_conflicts))
|
||||
|
||||
conflicts = set(self.keys()) & renamed
|
||||
conflicts = set(self.keys()) & set(rename_map.values())
|
||||
if conflicts:
|
||||
raise LibraryError('Unresolved duplicate keys encountered in library merge: ' + pformat(conflicts))
|
||||
|
||||
@ -559,6 +559,8 @@ class MutableLibrary(Library, MutableMapping[str, 'Pattern'], metaclass=ABCMeta)
|
||||
|
||||
for old_name, new_name in rename_map.items():
|
||||
temp.rename(old_name, new_name, move_references=True)
|
||||
for key in temp.keys():
|
||||
self._merge(key, temp, key)
|
||||
|
||||
else:
|
||||
for key in other.keys():
|
||||
@ -592,6 +594,7 @@ class MutableLibrary(Library, MutableMapping[str, 'Pattern'], metaclass=ABCMeta)
|
||||
name = tree.top
|
||||
else:
|
||||
tree.library.rename(tree.top, name, move_references=True)
|
||||
tree.top = name
|
||||
|
||||
self.add(tree.library, rename_theirs=rename_theirs)
|
||||
return name
|
||||
|
@ -83,7 +83,6 @@ def data_to_ports(
|
||||
Returns:
|
||||
The updated `pattern`. Port labels are not removed.
|
||||
"""
|
||||
print(f'TODO pat2dev {name}')
|
||||
if pattern.ports:
|
||||
logger.warning(f'Pattern {name if name else pattern} already had ports, skipping data_to_ports')
|
||||
return pattern
|
||||
|
Loading…
Reference in New Issue
Block a user