Skip to content

Commit c52a962

Browse files
committed
fix app example
1 parent a15631f commit c52a962

3 files changed

Lines changed: 80 additions & 699 deletions

File tree

04_application/app.py

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -59,18 +59,16 @@
5959
renderer.ResetCamera()
6060

6161
# -----------------------------------------------------------------------------
62-
# Callbacks
62+
# Trame setup
6363
# -----------------------------------------------------------------------------
6464

65+
server = get_server()
66+
state, ctrl = server.state, server.controller
6567

6668
# -----------------------------------------------------------------------------
67-
# Views
69+
# Callbacks
6870
# -----------------------------------------------------------------------------
6971

70-
local_view = vtk.VtkLocalView(renderWindow)
71-
remote_view = vtk.VtkRemoteView(renderWindow, interactive_ratio=(1,))
72-
html_view = local_view
73-
7472
# -----------------------------------------------------------------------------
7573
# GUI elements
7674
# -----------------------------------------------------------------------------
@@ -79,24 +77,27 @@
7977
# GUI
8078
# -----------------------------------------------------------------------------
8179

82-
layout = SinglePage("Viewer", on_ready=html_view.update)
83-
layout.title.set_text("Viewer")
80+
with SinglePageLayout(server) as layout:
81+
layout.title.set_text("Viewer")
8482

85-
with layout.toolbar:
86-
# toolbar components
87-
pass
83+
with layout.toolbar:
84+
# toolbar components
85+
pass
8886

89-
with layout.content:
90-
# content components
91-
vuetify.VContainer(
92-
fluid=True,
93-
classes="pa-0 fill-height",
94-
children=[html_view],
95-
)
87+
with layout.content:
88+
# content components
89+
with vuetify.VContainer(
90+
fluid=True,
91+
classes="pa-0 fill-height",
92+
):
93+
view = vtk.VtkLocalView(renderWindow)
94+
ctrl.view_update = view.update
95+
ctrl.view_reset_camera = view.reset_camera
96+
ctrl.on_server_ready.add(view.update)
9697

9798
# -----------------------------------------------------------------------------
9899
# Main
99100
# -----------------------------------------------------------------------------
100101

101102
if __name__ == "__main__":
102-
layout.start()
103+
server.start()

0 commit comments

Comments
 (0)