From 80b91124498528f94d34728d8c24b59ecf497084 Mon Sep 17 00:00:00 2001 From: Sebastian Goeldi Date: Tue, 16 Jul 2024 12:14:24 +0200 Subject: [PATCH 1/3] add reload button --- .pre-commit-config.yaml | 10 +++++----- pyproject.toml | 4 ++-- src/kweb/layout_server.py | 12 ++++++------ src/kweb/static/viewer.js | 9 +++++++++ 4 files changed, 22 insertions(+), 13 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 0d9cfec..bfe3ca9 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,6 @@ repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: "v4.5.0" + rev: "v4.6.0" hooks: - id: check-added-large-files exclude: | @@ -19,7 +19,7 @@ repos: # - id: trailing-whitespace - repo: https://github.com/charliermarsh/ruff-pre-commit - rev: "v0.2.0" + rev: "v0.5.2" hooks: - id: ruff - repo: https://github.com/djlint/djLint @@ -40,18 +40,18 @@ repos: src/kweb/static/bootstrap/.* )$ - repo: https://github.com/shellcheck-py/shellcheck-py - rev: v0.9.0.6 + rev: v0.10.0.1 hooks: - id: shellcheck - repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks - rev: v2.12.0 + rev: v2.14.0 hooks: - id: pretty-format-toml args: [--autofix] - repo: https://github.com/codespell-project/codespell - rev: v2.2.6 + rev: v2.3.0 hooks: - id: codespell additional_dependencies: diff --git a/pyproject.toml b/pyproject.toml index 7f0a5f2..9b74663 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -12,7 +12,7 @@ classifiers = [ "Operating System :: OS Independent" ] dependencies = [ - "klayout >= 0.28.17", + "klayout >= 0.29.4", "fastapi", "uvicorn[standard]", "jinja2", @@ -21,7 +21,7 @@ dependencies = [ description = "KLayout API implementation of gdsfactory" name = "kweb" readme = "README.md" -requires-python = ">=3.10" +requires-python = ">=3.11" version = "2.0.1" [project.optional-dependencies] diff --git a/src/kweb/layout_server.py b/src/kweb/layout_server.py index ac38d3c..5b31798 100755 --- a/src/kweb/layout_server.py +++ b/src/kweb/layout_server.py @@ -679,13 +679,13 @@ async def reader(self, websocket: WebSocket, data: str) -> None: ) case "rdb-selected": await self.draw_items(js["items"]) + case "reload": + self.layout_view.reload_layout( + self.layout_view.active_cellview().index() + ) + if self.rdb_file is not None: + self.db.load(self.rdb_file) def meta_json_serializer(obj: object) -> str: return str(obj) - - -# class EditableLayoutViewServerEndpoint( -# LayoutViewServerEndpoint, editable=True, add_missing_layers=True -# ): -# pass diff --git a/src/kweb/static/viewer.js b/src/kweb/static/viewer.js index 2a9c15f..8dd2559 100644 --- a/src/kweb/static/viewer.js +++ b/src/kweb/static/viewer.js @@ -217,6 +217,15 @@ function showMenu(modes, annotations) { socket.send(JSON.stringify({ msg: "zoom-f" })); }; menuElement.appendChild(zoomFit); + let reload = document.createElement("button"); + reload.textContent = "Reload"; + reload.className = "col-auto btn btn-primary mx-2"; + reload.setAttribute("type", "button"); + reload.onclick = function() { + socket.send(JSON.stringify({ msg: "reload" })); + }; + menuElement.appendChild(reload); + let index = 0; From 214e75ba0a4727a53654c31f610406942ade3229 Mon Sep 17 00:00:00 2001 From: Sebastian Goeldi Date: Tue, 16 Jul 2024 12:15:56 +0200 Subject: [PATCH 2/3] fix typo --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b2b9acd..083abcd 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,7 @@ KWeb offers two basic apps: ### Development -#### Clone & Installl +#### Clone & Install ```bash From a75ce10787660dea00d8c7a5084ac3ef32ca0f1e Mon Sep 17 00:00:00 2001 From: Sebastian Goeldi Date: Tue, 16 Jul 2024 12:18:45 +0200 Subject: [PATCH 3/3] fix github actions --- .github/workflows/test_code.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test_code.yml b/.github/workflows/test_code.yml index a922f49..7353ec9 100644 --- a/.github/workflows/test_code.yml +++ b/.github/workflows/test_code.yml @@ -19,7 +19,7 @@ jobs: strategy: max-parallel: 12 matrix: - python-version: ["3.10"] + python-version: ["3.11"] os: [ubuntu-latest] steps: - uses: actions/checkout@v4