Skip to content

Commit ec5912b

Browse files
committed
Merge branch 'next' of https://github.com/Geode-solutions/OpenGeodeWeb-Viewer into fix/database
2 parents dcb0d06 + 72f65b7 commit ec5912b

File tree

9 files changed

+46
-7
lines changed

9 files changed

+46
-7
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,12 @@ __pycache__/
66
.env
77
/node_modules
88
latest_logs
9-
schemas.json
109
build
1110
/src/tests/tests_output/
1211
*.egg-info
1312
.coverage*
1413
.mypy_cache
1514
*.db
1615
tests/data
16+
17+
opengeodeweb_viewer_schemas.json

package-lock.json

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ dependencies = { file = ["requirements.txt"] }
3131
where = ["src"]
3232

3333
[tool.setuptools.package-data]
34+
"opengeodeweb_viewer.rpc.schemas" = ["*.json"]
3435
"opengeodeweb_viewer.rpc.generic.schemas" = ["*.json"]
3536
"opengeodeweb_viewer.rpc.mesh.schemas" = ["*.json"]
3637
"opengeodeweb_viewer.rpc.mesh.points.schemas" = ["*.json"]

requirements.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ frozenlist==1.8.0
2222
# via
2323
# aiohttp
2424
# aiosignal
25-
idna==3.10
25+
idna==3.11
2626
# via yarl
2727
kiwisolver==1.4.9
2828
# via matplotlib
@@ -61,3 +61,4 @@ wslink==1.12.4
6161
yarl==1.22.0
6262
# via aiohttp
6363

64+
opengeodeweb-microservice==1.*,>=1.0.4rc5
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"rpc": "kill",
3+
"type": "object",
4+
"properties": {},
5+
"required": [],
6+
"additionalProperties": false
7+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# type: ignore
2+
# Standard library imports
3+
import os
4+
5+
# Third party imports
6+
from wslink import register as exportRpc
7+
8+
# Local application imports
9+
from opengeodeweb_viewer.utils_functions import get_schemas_dict
10+
from opengeodeweb_viewer.vtk_protocol import VtkView
11+
12+
13+
class VtkUtilsView(VtkView):
14+
ogw_prefix = "opengeodeweb_viewer."
15+
ogw_schemas_dict = get_schemas_dict(
16+
os.path.join(os.path.dirname(__file__), "schemas")
17+
)
18+
19+
def __init__(self) -> None:
20+
super().__init__()
21+
22+
@exportRpc(ogw_prefix + ogw_schemas_dict["kill"]["rpc"])
23+
def kill(self) -> None:
24+
print("Manual viewer kill, shutting down...", flush=True)
25+
os._exit(0)

src/opengeodeweb_viewer/utils_functions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
type RpcParamsWithList = dict[str, JsonPrimitive | list[str]]
1616

1717

18-
def get_schemas_dict(path):
18+
def get_schemas_dict(path: str) -> object:
1919
json_files = os.listdir(path)
2020
schemas_dict = {}
2121
for json_file in json_files:

src/opengeodeweb_viewer/vtk_protocol.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,14 @@
33

44
# Third party imports
55
import vtk
6-
from vtk.web import protocols as vtk_protocols
6+
from vtk.web import protocols as vtk_protocols # type: ignore
77

88
# Local application imports
99
from opengeodeweb_microservice.database.connection import get_session
1010
from opengeodeweb_microservice.database.data import Data
1111

12+
# mypy: allow-untyped-defs
13+
1214

1315
class VtkView(vtk_protocols.vtkWebProtocol):
1416
def __init__(self) -> None:

src/opengeodeweb_viewer/vtkw_server.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
VtkModelBlocksView,
3939
)
4040
from .rpc.generic.generic_protocols import VtkGenericView
41+
from .rpc.utils_protocols import VtkUtilsView # type: ignore
4142

4243

4344
# =============================================================================
@@ -79,6 +80,7 @@ def initialize(self):
7980
model_protocols = VtkModelView()
8081
vtk_view = VtkView()
8182
self.registerVtkWebProtocol(vtk_view)
83+
self.registerVtkWebProtocol(VtkUtilsView())
8284
self.registerVtkWebProtocol(VtkViewerView())
8385
self.registerVtkWebProtocol(mesh_protocols)
8486
self.registerVtkWebProtocol(VtkMeshPointsView())

0 commit comments

Comments
 (0)