Skip to content

Commit bd1c386

Browse files
Add support for loading libraries along the main eda file
1 parent c195b5a commit bd1c386

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

changelog.d/+010f9944.added.md

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Add support for loading libraries along the main eda file

klayout/python/klive_server.py

+9-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import json
2-
from dataclasses import dataclass, field
2+
from dataclasses import dataclass
33
from pathlib import Path
44
from time import sleep
55
from typing import Optional
@@ -63,6 +63,12 @@ def new_connection(self):
6363

6464
send_data = {"version": "0.2.2"}
6565

66+
libs = data.get("libraries", {})
67+
for lib_dict in libs:
68+
lib = pya.Library()
69+
lib.register(lib_dict["name"])
70+
lib.layout().read(lib_dict["file"])
71+
6672
def load_existing_layout():
6773
for i in range(window.views()):
6874
view = window.view(i)
@@ -100,6 +106,7 @@ def load_existing_layout():
100106
connection.write(json.dumps(send_data).encode("utf-8"))
101107
connection.flush()
102108
return new_view
109+
103110
if window.views() > 0:
104111
view = load_existing_layout()
105112
else:
@@ -129,8 +136,7 @@ def load_existing_layout():
129136
l2n.read(l2n_path)
130137
l2n_i = view.add_l2ndb(l2n)
131138
view.show_l2ndb(l2n_i, view.active_cellview().cell_index)
132-
133-
139+
134140
else:
135141
connection.waitForReadyRead(100)
136142

0 commit comments

Comments
 (0)