Skip to content

Commit

Permalink
Merge pull request #52 from gdsfactory/reload-button
Browse files Browse the repository at this point in the history
add reload button
  • Loading branch information
sebastian-goeldi authored Jul 16, 2024
2 parents 2c1086b + a75ce10 commit 5dc7b44
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test_code.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -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: |
Expand All @@ -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
Expand All @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ KWeb offers two basic apps:
### Development
#### Clone & Installl
#### Clone & Install
```bash
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ classifiers = [
"Operating System :: OS Independent"
]
dependencies = [
"klayout >= 0.28.17",
"klayout >= 0.29.4",
"fastapi",
"uvicorn[standard]",
"jinja2",
Expand All @@ -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]
Expand Down
12 changes: 6 additions & 6 deletions src/kweb/layout_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
9 changes: 9 additions & 0 deletions src/kweb/static/viewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit 5dc7b44

Please sign in to comment.