fix: use _elements.remove() for kicad-skip collections lacking remove method
ElementCollection in kicad-skip doesn't implement remove(), causing 'WireCollection object has no attribute remove' errors. Access the underlying _elements list directly for wire, label, and symbol deletion. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -253,7 +253,7 @@ class ComponentManager:
|
|||||||
break
|
break
|
||||||
|
|
||||||
if symbol_to_remove:
|
if symbol_to_remove:
|
||||||
schematic.symbol.remove(symbol_to_remove)
|
schematic.symbol._elements.remove(symbol_to_remove)
|
||||||
print(f"Removed component {component_ref} from schematic.")
|
print(f"Removed component {component_ref} from schematic.")
|
||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
|
|||||||
@@ -1933,7 +1933,7 @@ class KiCADInterface:
|
|||||||
break
|
break
|
||||||
|
|
||||||
if wire_to_remove:
|
if wire_to_remove:
|
||||||
schematic.wire.remove(wire_to_remove)
|
schematic.wire._elements.remove(wire_to_remove)
|
||||||
SchematicManager.save_schematic(schematic, schematic_path)
|
SchematicManager.save_schematic(schematic, schematic_path)
|
||||||
return {"success": True}
|
return {"success": True}
|
||||||
else:
|
else:
|
||||||
@@ -1984,7 +1984,7 @@ class KiCADInterface:
|
|||||||
break
|
break
|
||||||
|
|
||||||
if label_to_remove:
|
if label_to_remove:
|
||||||
schematic.label.remove(label_to_remove)
|
schematic.label._elements.remove(label_to_remove)
|
||||||
SchematicManager.save_schematic(schematic, schematic_path)
|
SchematicManager.save_schematic(schematic, schematic_path)
|
||||||
return {"success": True}
|
return {"success": True}
|
||||||
else:
|
else:
|
||||||
|
|||||||
Reference in New Issue
Block a user