Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ __pycache__/
.env
/node_modules
latest_logs
schemas.json
build
/src/tests/tests_output/
*.egg-info
.coverage*
.mypy_cache
.mypy_cache
opengeodeweb_viewer_schemas.json
15 changes: 9 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ dependencies = {file = ["requirements.txt"]}
where = ["src"]

[tool.setuptools.package-data]
"opengeodeweb_viewer.rpc.schemas" = ["*.json"]
"opengeodeweb_viewer.rpc.generic.schemas" = ["*.json"]
"opengeodeweb_viewer.rpc.mesh.schemas" = ["*.json"]
"opengeodeweb_viewer.rpc.mesh.points.schemas" = ["*.json"]
Expand Down
1 change: 0 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,3 @@ wslink==1.12.4
yarl==1.22.0
# via aiohttp

opengeodeweb-microservice~=1.0
1 change: 1 addition & 0 deletions src/opengeodeweb_viewer/py.typed
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
partial
7 changes: 7 additions & 0 deletions src/opengeodeweb_viewer/rpc/schemas/kill.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"rpc": "kill",
"type": "object",
"properties": {},
"required": [],
"additionalProperties": false
}
25 changes: 25 additions & 0 deletions src/opengeodeweb_viewer/rpc/utils_protocols.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# type: ignore
# Standard library imports
import os

# Third party imports
from wslink import register as exportRpc

# Local application imports
from opengeodeweb_viewer.utils_functions import get_schemas_dict
from opengeodeweb_viewer.vtk_protocol import VtkView


class VtkUtilsView(VtkView):
ogw_prefix = "opengeodeweb_viewer."
ogw_schemas_dict = get_schemas_dict(
os.path.join(os.path.dirname(__file__), "schemas")
)

def __init__(self) -> None:
super().__init__()

@exportRpc(ogw_prefix + ogw_schemas_dict["kill"]["rpc"])
def kill(self) -> None:
print("Manual viewer kill, shutting down...", flush=True)
os._exit(0)
2 changes: 1 addition & 1 deletion src/opengeodeweb_viewer/utils_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# Local application imports


def get_schemas_dict(path):
def get_schemas_dict(path: str) -> object:
json_files = os.listdir(path)
schemas_dict = {}
for json_file in json_files:
Expand Down
4 changes: 3 additions & 1 deletion src/opengeodeweb_viewer/vtk_protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@

# Third party imports
import vtk
from vtk.web import protocols as vtk_protocols
from vtk.web import protocols as vtk_protocols # type: ignore

# Local application imports

# mypy: allow-untyped-defs


class VtkView(vtk_protocols.vtkWebProtocol):
def __init__(self):
Expand Down
2 changes: 2 additions & 0 deletions src/opengeodeweb_viewer/vtkw_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
VtkModelBlocksView,
)
from .rpc.generic.generic_protocols import VtkGenericView
from .rpc.utils_protocols import VtkUtilsView # type: ignore


# =============================================================================
Expand Down Expand Up @@ -78,6 +79,7 @@ def initialize(self):
model_protocols = VtkModelView()
vtk_view = VtkView()
self.registerVtkWebProtocol(vtk_view)
self.registerVtkWebProtocol(VtkUtilsView())
self.registerVtkWebProtocol(VtkViewerView())
self.registerVtkWebProtocol(mesh_protocols)
self.registerVtkWebProtocol(VtkMeshPointsView())
Expand Down