Skip to content

Commit 80b9112

Browse files
add reload button
1 parent 954ff8a commit 80b9112

File tree

4 files changed

+22
-13
lines changed

4 files changed

+22
-13
lines changed

.pre-commit-config.yaml

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
repos:
22
- repo: https://github.com/pre-commit/pre-commit-hooks
3-
rev: "v4.5.0"
3+
rev: "v4.6.0"
44
hooks:
55
- id: check-added-large-files
66
exclude: |
@@ -19,7 +19,7 @@ repos:
1919
# - id: trailing-whitespace
2020

2121
- repo: https://github.com/charliermarsh/ruff-pre-commit
22-
rev: "v0.2.0"
22+
rev: "v0.5.2"
2323
hooks:
2424
- id: ruff
2525
- repo: https://github.com/djlint/djLint
@@ -40,18 +40,18 @@ repos:
4040
src/kweb/static/bootstrap/.*
4141
)$
4242
- repo: https://github.com/shellcheck-py/shellcheck-py
43-
rev: v0.9.0.6
43+
rev: v0.10.0.1
4444
hooks:
4545
- id: shellcheck
4646

4747
- repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks
48-
rev: v2.12.0
48+
rev: v2.14.0
4949
hooks:
5050
- id: pretty-format-toml
5151
args: [--autofix]
5252

5353
- repo: https://github.com/codespell-project/codespell
54-
rev: v2.2.6
54+
rev: v2.3.0
5555
hooks:
5656
- id: codespell
5757
additional_dependencies:

pyproject.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ classifiers = [
1212
"Operating System :: OS Independent"
1313
]
1414
dependencies = [
15-
"klayout >= 0.28.17",
15+
"klayout >= 0.29.4",
1616
"fastapi",
1717
"uvicorn[standard]",
1818
"jinja2",
@@ -21,7 +21,7 @@ dependencies = [
2121
description = "KLayout API implementation of gdsfactory"
2222
name = "kweb"
2323
readme = "README.md"
24-
requires-python = ">=3.10"
24+
requires-python = ">=3.11"
2525
version = "2.0.1"
2626

2727
[project.optional-dependencies]

src/kweb/layout_server.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -679,13 +679,13 @@ async def reader(self, websocket: WebSocket, data: str) -> None:
679679
)
680680
case "rdb-selected":
681681
await self.draw_items(js["items"])
682+
case "reload":
683+
self.layout_view.reload_layout(
684+
self.layout_view.active_cellview().index()
685+
)
686+
if self.rdb_file is not None:
687+
self.db.load(self.rdb_file)
682688

683689

684690
def meta_json_serializer(obj: object) -> str:
685691
return str(obj)
686-
687-
688-
# class EditableLayoutViewServerEndpoint(
689-
# LayoutViewServerEndpoint, editable=True, add_missing_layers=True
690-
# ):
691-
# pass

src/kweb/static/viewer.js

+9
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,15 @@ function showMenu(modes, annotations) {
217217
socket.send(JSON.stringify({ msg: "zoom-f" }));
218218
};
219219
menuElement.appendChild(zoomFit);
220+
let reload = document.createElement("button");
221+
reload.textContent = "Reload";
222+
reload.className = "col-auto btn btn-primary mx-2";
223+
reload.setAttribute("type", "button");
224+
reload.onclick = function() {
225+
socket.send(JSON.stringify({ msg: "reload" }));
226+
};
227+
menuElement.appendChild(reload);
228+
220229

221230
let index = 0;
222231

0 commit comments

Comments
 (0)