Skip to content

Commit

Permalink
refactor wip
Browse files Browse the repository at this point in the history
  • Loading branch information
ducky64 committed Apr 10, 2024
1 parent 88b936e commit e9711e5
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 119 deletions.
115 changes: 0 additions & 115 deletions electronics_model/SvgPcbBackend.py

This file was deleted.

15 changes: 12 additions & 3 deletions electronics_model/SvgPcbTemplateBlock.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,17 @@ class SvgPcbTemplateBlock(Block):
A Block that can generate a SVG-PCB (https://github.com/leomcelroy/svg-pcb) layout template.
This defines the per-class methods (including per-class code generation), the actual board-level code composition
and generation of non-templated footprints exists in the backend."""
and generation of non-templated footprints exists in the backend.
This defines the interface and supporting utilities only."""
@staticmethod
def _svgpcb_pathname_to_svgpcb(path: TransformUtil.Path):
return '_'.join(path.to_tuple())

@staticmethod
def _svgpcb_footprint_to_svgpcb(footprint: str) -> str: # KiCad footprint name to SVGPCB reference
return footprint.split(':')[-1].replace('-', '_').replace(' ', '_').replace('.', '_')

def _svgpcb_init(self, pathname: TransformUtil.Path, design: CompiledDesign) -> None:
"""Initializes this Block for SVGPCB template generation. Called from the backend."""
self._svgpcb_pathname_data = pathname
Expand All @@ -19,8 +29,7 @@ def _svgpcb_init(self, pathname: TransformUtil.Path, design: CompiledDesign) ->

def _svgpcb_pathname(self) -> str:
"""Infrastructure method, returns the pathname for this Block as a JS-code-friendly string."""
from .SvgPcbBackend import SvgPcbBackend
return SvgPcbBackend._pathname_to_svbpcb(self._svgpcb_pathname_data)
return self._svgpcb_pathname_to_svgpcb(self._svgpcb_pathname_data)

def _svgpcb_get(self, param: ConstraintExpr[Any, Any]) -> Optional[str]:
"""Infrastructure method, returns the value of the ConstraintExpr as a JS literal.
Expand Down
1 change: 0 additions & 1 deletion electronics_model/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,4 @@
from .NetlistBackend import NetlistBackend
from .PinAssignmentUtil import PinAssignmentUtil, AnyPinAssign, PeripheralPinAssign, NotConnectedPin, AnyPin

from .SvgPcbBackend import SvgPcbBackend
from .SvgPcbTemplateBlock import SvgPcbTemplateBlock

0 comments on commit e9711e5

Please sign in to comment.