Skip to content

Commit a809a9d

Browse files
authored
Merge pull request #142 from LibrePCB/screw-terminals
Add generator for Phoenix PT series screw terminals
2 parents 66abdb4 + 258b4bc commit a809a9d

File tree

4 files changed

+2889
-3
lines changed

4 files changed

+2889
-3
lines changed

entities/common.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,3 +316,15 @@ def __str__(self) -> str:
316316
return '(text {} {} {}\n'.format(self.uuid, self.layer, self.value) +\
317317
' {} {} {} {}\n'.format(self.align, self.height, self.position, self.rotation) +\
318318
')'
319+
320+
321+
class Resource():
322+
def __init__(self, name: str, mediatype: str, url: str):
323+
self.name = name
324+
self.mediatype = mediatype
325+
self.url = url
326+
327+
def __str__(self) -> str:
328+
return '(resource "{}" (mediatype "{}")\n'.format(escape_string(self.name), escape_string(self.mediatype)) +\
329+
' (url "{}")\n'.format(escape_string(self.url)) +\
330+
')'

entities/device.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
from entities.attribute import Attribute
55

66
from .common import (
7-
Author, Category, Created, Deprecated, Description, GeneratedBy, Keywords, Name, StringValue, UUIDValue, Version
7+
Author, Category, Created, Deprecated, Description, GeneratedBy, Keywords, Name, Resource, StringValue, UUIDValue,
8+
Version
89
)
910
from .component import SignalUUID
1011
from .helper import indent_entities
@@ -70,6 +71,7 @@ def __init__(self, uuid: str, name: Name, description: Description,
7071
self.package_uuid = package_uuid
7172
self.pads: List[ComponentPad] = []
7273
self.parts: List[Part] = []
74+
self.resources: List[Resource] = []
7375
self.approvals: List[str] = []
7476

7577
def add_pad(self, pad: ComponentPad) -> None:
@@ -78,6 +80,9 @@ def add_pad(self, pad: ComponentPad) -> None:
7880
def add_part(self, part: Part) -> None:
7981
self.parts.append(part)
8082

83+
def add_resource(self, resource: Resource) -> None:
84+
self.resources.append(resource)
85+
8186
def add_approval(self, approval: str) -> None:
8287
self.approvals.append(approval)
8388

@@ -91,8 +96,9 @@ def __str__(self) -> str:
9196
' {}\n'.format(self.created) +\
9297
' {}\n'.format(self.deprecated) +\
9398
' {}\n'.format(self.generated_by) +\
94-
''.join([' {}\n'.format(cat) for cat in self.categories]) +\
95-
' {}\n'.format(self.component_uuid) +\
99+
''.join([' {}\n'.format(cat) for cat in self.categories])
100+
ret += indent_entities(self.resources)
101+
ret += ' {}\n'.format(self.component_uuid) +\
96102
' {}\n'.format(self.package_uuid)
97103
ret += indent_entities(sorted(self.pads, key=lambda x: str(x.pad_uuid)))
98104
ret += indent_entities(self.parts)

0 commit comments

Comments
 (0)