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
3 changes: 3 additions & 0 deletions .commitlintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
extends: ["@commitlint/config-conventional"],
};
4 changes: 2 additions & 2 deletions .externals.sha256
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
d6e1d6ca32dd252f4c46d1b5c7ab1225f66990da50215b9de91912bbf7aa97ed ./src/trame_vtk/tools/static_viewer.html
948b0cca167bc2e2315a4d1ef18eb23cbe5979c806fbb7f0b157ed7c0e5ed280 ./src/trame_vtk/modules/common/serve/trame-vtk.js
d40400185f1e260ceb298f7218c010be3c6bf86214c0692944ff37a81e5de51f ./src/trame_vtk/tools/static_viewer.html
6d3e20a67b32c8a10443b2df7a1e7b32a459b944cf6f630695e260b5406b4b57 ./src/trame_vtk/modules/common/serve/trame-vtk.js
14 changes: 0 additions & 14 deletions .flake8

This file was deleted.

21 changes: 10 additions & 11 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,21 @@ repos:
- id: prettier
types_or: [yaml, markdown, html, css, scss, javascript, json]
args: [--prose-wrap=always]
exclude: |
(?x)^(
CHANGELOG.md|
src/trame_vtk/tools/static_viewer.html
)$

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.15.0"
rev: "v0.15.10"
hooks:
- id: ruff
args: ["--fix", "--show-fixes"]
- id: ruff-format

- repo: https://github.com/codespell-project/codespell
rev: "v2.4.1"
rev: "v2.4.2"
hooks:
- id: codespell

Expand All @@ -52,19 +57,13 @@ repos:
hooks:
- id: shellcheck

- repo: local
hooks:
- id: disallow-caps
name: Disallow improper capitalization
language: pygrep
entry: PyBind|Numpy|Cmake|CCache|Github|PyTest
exclude: .pre-commit-config.yaml

- repo: https://github.com/abravalheri/validate-pyproject
Comment thread
jourdain marked this conversation as resolved.
rev: "v0.25"
hooks:
- id: validate-pyproject
additional_dependencies: ["validate-pyproject-schema-store[all]"]
additional_dependencies:
- validate-pyproject[all]
- validate-pyproject-schema-store

- repo: https://github.com/python-jsonschema/check-jsonschema
rev: "0.36.1"
Expand Down
2 changes: 2 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ VTK integration in trame allows you to create rich visualization and data proces
Several components are available so you can leverage VTK either for its data processing and/or rendering.
trame lets you choose if you want to leverage Remote Rendering or if the client should do the rendering by leveraging vtk.js under the hood.

.. image:: https://raw.githubusercontent.com/Kitware/trame-vtk/master/trame-vtk.jpg
:alt: Example of trame-vtk usage

Installing
-----------------------------------------------------------
Expand Down
62 changes: 32 additions & 30 deletions examples/pyvista/ambient.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
"""Validate lighting and properties."""

import pyvista as pv
from trame.app import get_server
from trame.ui.vuetify import SinglePageLayout

from trame.widgets import vuetify
from trame.widgets.vtk import VtkLocalView, VtkRemoteView

import pyvista as pv

server = get_server()
state, ctrl = server.state, server.controller

Expand All @@ -30,7 +30,7 @@


@state.change("color")
def color(color="lightblue", **kwargs):
def color(color="lightblue", **_kwargs):
actor.prop.color = color
ctrl.view_update()

Expand All @@ -56,36 +56,38 @@ def color(color="lightblue", **kwargs):
style="max-width: 250px",
)

with layout.content:
with vuetify.VContainer(
with (
layout.content,
vuetify.VContainer(
fluid=True,
classes="pa-0 fill-height",
),
):
with vuetify.VContainer(
fluid=True, classes="pa-0 fill-height", style="width: 50%;"
):
with vuetify.VContainer(
fluid=True, classes="pa-0 fill-height", style="width: 50%;"
):
local = VtkLocalView(
plotter.ren_win,
)
with vuetify.VContainer(
fluid=True, classes="pa-0 fill-height", style="width: 50%;"
):
remote = VtkRemoteView(
plotter.ren_win,
)

def view_update(**kwargs):
local.update(**kwargs)
remote.update(**kwargs)

def view_reset_camera(**kwargs):
local.reset_camera(**kwargs)
remote.reset_camera(**kwargs)

ctrl.view_update = view_update
ctrl.view_reset_camera = view_reset_camera

ctrl.on_server_ready.add(view_update)
local = VtkLocalView(
plotter.ren_win,
)
with vuetify.VContainer(
fluid=True, classes="pa-0 fill-height", style="width: 50%;"
):
remote = VtkRemoteView(
plotter.ren_win,
)

def view_update(**kwargs):
local.update(**kwargs)
remote.update(**kwargs)

def view_reset_camera(**kwargs):
local.reset_camera(**kwargs)
remote.reset_camera(**kwargs)

ctrl.view_update = view_update
ctrl.view_reset_camera = view_reset_camera

ctrl.on_server_ready.add(view_update)

# hide footer
layout.footer.hide()
Expand Down
26 changes: 14 additions & 12 deletions examples/pyvista/export_scene.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
https://kitware.github.io/vtk-js/examples/OfflineLocalView.html
"""

from trame.app import get_server
from trame.ui.vuetify import SinglePageLayout
from trame.widgets import vuetify

import pyvista as pv
from pyvista import examples
from pyvista.trame import PyVistaLocalView
from trame.app import get_server
from trame.ui.vuetify import SinglePageLayout

from trame.widgets import vuetify

server = get_server()
state, ctrl = server.state, server.controller
Expand Down Expand Up @@ -39,16 +39,18 @@ def export_scene():
click="utils.download('scene-extract.vtksz', trigger('export'), 'application/octet-stream')",
)

with layout.content:
with vuetify.VContainer(
with (
layout.content,
vuetify.VContainer(
fluid=True,
classes="pa-0 fill-height",
):
with vuetify.VCol(classes="pa-0 ma-1 fill-height"):
view = PyVistaLocalView(plotter)
ctrl.view_export = view.export
ctrl.view_update = view.update
ctrl.view_reset_camera = view.reset_camera
),
vuetify.VCol(classes="pa-0 ma-1 fill-height"),
):
view = PyVistaLocalView(plotter)
ctrl.view_export = view.export
ctrl.view_update = view.update
ctrl.view_reset_camera = view.reset_camera

if __name__ == "__main__":
server.start()
25 changes: 14 additions & 11 deletions examples/pyvista/grid.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from trame.app import get_server
from trame.ui.vuetify import SinglePageLayout

from trame.widgets import grid

server = get_server()
Expand All @@ -12,18 +13,20 @@

with SinglePageLayout(server) as layout:
layout.title.set_text("Grid layout")
with layout.content:
with grid.GridLayout(
with (
layout.content,
grid.GridLayout(
layout=("layout", LAYOUT),
):
grid.GridItem(
"{{ item.i }}",
v_for="item in layout",
key="item.i",
v_bind="item",
classes="pa-4",
style="border: solid 1px #333; background: rgba(128, 128, 128, 0.5);",
)
),
):
grid.GridItem(
"{{ item.i }}",
v_for="item in layout",
key="item.i",
v_bind="item",
classes="pa-4",
style="border: solid 1px #333; background: rgba(128, 128, 128, 0.5);",
)

if __name__ == "__main__":
server.start()
60 changes: 31 additions & 29 deletions examples/pyvista/lighting.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
"""Validate lighting."""

import pyvista as pv
from trame.app import get_server
from trame.ui.vuetify import SinglePageLayout

from trame.widgets import vuetify
from trame.widgets.vtk import VtkLocalView, VtkRemoteView

import pyvista as pv

server = get_server()
state, ctrl = server.state, server.controller

Expand Down Expand Up @@ -39,36 +39,38 @@
with layout.toolbar:
vuetify.VSpacer()

with layout.content:
with vuetify.VContainer(
with (
layout.content,
vuetify.VContainer(
fluid=True,
classes="pa-0 fill-height",
),
):
with vuetify.VContainer(
fluid=True, classes="pa-0 fill-height", style="width: 50%;"
):
with vuetify.VContainer(
fluid=True, classes="pa-0 fill-height", style="width: 50%;"
):
local = VtkLocalView(
plotter.ren_win,
)
with vuetify.VContainer(
fluid=True, classes="pa-0 fill-height", style="width: 50%;"
):
remote = VtkRemoteView(
plotter.ren_win,
)

def view_update(**kwargs):
local.update(**kwargs)
remote.update(**kwargs)

def view_reset_camera(**kwargs):
local.reset_camera(**kwargs)
remote.reset_camera(**kwargs)

ctrl.view_update = view_update
ctrl.view_reset_camera = view_reset_camera

ctrl.on_server_ready.add(view_update)
local = VtkLocalView(
plotter.ren_win,
)
with vuetify.VContainer(
fluid=True, classes="pa-0 fill-height", style="width: 50%;"
):
remote = VtkRemoteView(
plotter.ren_win,
)

def view_update(**kwargs):
local.update(**kwargs)
remote.update(**kwargs)

def view_reset_camera(**kwargs):
local.reset_camera(**kwargs)
remote.reset_camera(**kwargs)

ctrl.view_update = view_update
ctrl.view_reset_camera = view_reset_camera

ctrl.on_server_ready.add(view_update)

# hide footer
layout.footer.hide()
Expand Down
38 changes: 20 additions & 18 deletions examples/pyvista/picking.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import pyvista as pv
from trame.app import get_server
from trame.assets.local import LocalFileManager
from trame.ui.vuetify import SinglePageLayout

from trame.widgets import vuetify
from trame.widgets.vtk import VtkRemoteView
from trame.assets.local import LocalFileManager

import pyvista as pv

server = get_server()
state, ctrl = server.state, server.controller
Expand Down Expand Up @@ -46,7 +46,7 @@ def on_box_selection(event): ...


@state.change("selection_mode")
def on_mode_change(selection_mode, **kwargs):
def on_mode_change(selection_mode, **_kwargs):
# Use box for selection
state.box_selection = selection_mode in [
"select_surface_point",
Expand Down Expand Up @@ -100,22 +100,24 @@ def on_mode_change(selection_mode, **kwargs):
width=ICON_SIZE,
)

with layout.content:
with vuetify.VContainer(
with (
layout.content,
vuetify.VContainer(
fluid=True,
classes="pa-0 fill-height",
):
# with vuetify.VCol(classes="fill-height"):
# view = VtkLocalView(plotter.ren_win)
# ctrl.view_update = view.update
# ctrl.view_reset_camera = view.reset_camera
# with vuetify.VCol(classes="fill-height"):
VtkRemoteView(
plotter.ren_win,
enable_picking=("send_mouse", False),
box_selection=("box_selection", False),
box_selection_change=(ctrl.on_selection_change, "[$event]"),
)
),
):
# with vuetify.VCol(classes="fill-height"):
# view = VtkLocalView(plotter.ren_win)
# ctrl.view_update = view.update
# ctrl.view_reset_camera = view.reset_camera
# with vuetify.VCol(classes="fill-height"):
VtkRemoteView(
plotter.ren_win,
enable_picking=("send_mouse", False),
box_selection=("box_selection", False),
box_selection_change=(ctrl.on_selection_change, "[$event]"),
)

# hide footer
layout.footer.hide()
Expand Down
Loading
Loading