Skip to content
Closed
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
23 changes: 0 additions & 23 deletions src/pan3d/explorers/analytics.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,29 +91,6 @@ def _setup_vtk(self, pipeline=None):
self.widget.EnabledOn()
self.widget.InteractiveOff()

# -------------------------------------------------------------------------
# Trame API
# -------------------------------------------------------------------------

def start(self, **kwargs):
"""Initialize the UI and start the server for XArray Viewer."""
self.ui.server.start(**kwargs)

@property
async def ready(self):
"""Start and wait for the XArray Viewer corroutine to be ready."""
await self.ui.ready

@property
def state(self):
"""Returns the current the trame server state."""
return self.server.state

@property
def ctrl(self):
"""Returns the Controller for the trame server."""
return self.server.controller

# -------------------------------------------------------------------------
# UI
# -------------------------------------------------------------------------
Expand Down
98 changes: 12 additions & 86 deletions src/pan3d/ui/contour.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import math

from pan3d.ui.shared_components import (
ScalingControls,
UpdateButton,
)
from pan3d.utils.common import RenderingSettingsBasic
from pan3d.utils.convert import max_str_length
from trame.widgets import html
from trame.widgets import vuetify3 as v3

Expand All @@ -14,62 +15,7 @@ def __init__(self, source, update_rendering, **kwargs):

with self.content:
# Actor scaling
with v3.VTooltip(text="Representation scaling"):
with html.Template(v_slot_activator="{ props }"):
with v3.VRow(
v_bind="props",
no_gutter=True,
classes="align-center my-0 mx-0 border-b-thin",
):
v3.VIcon(
"mdi-ruler-square",
classes="ml-2 text-medium-emphasis",
)
with v3.VCol(classes="pa-0", v_if="axis_names?.[0]"):
v3.VTextField(
v_model=("scale_x", 1),
hide_details=True,
density="compact",
flat=True,
variant="solo",
reverse=True,
raw_attrs=[
'pattern="^\d*(\.\d)?$"',
'min="0.001"',
'step="0.1"',
],
type="number",
)
with v3.VCol(classes="pa-0", v_if="axis_names?.[1]"):
v3.VTextField(
v_model=("scale_y", 1),
hide_details=True,
density="compact",
flat=True,
variant="solo",
reverse=True,
raw_attrs=[
'pattern="^\d*(\.\d)?$"',
'min="0.001"',
'step="0.1"',
],
type="number",
)
with v3.VCol(classes="pa-0", v_if="axis_names?.[2]"):
v3.VTextField(
v_model=("scale_z", 1),
hide_details=True,
density="compact",
flat=True,
variant="solo",
reverse=True,
raw_attrs=[
'pattern="^\d*(\.\d)?$"',
'min="0.001"',
'step="0.1"',
],
type="number",
)
ScalingControls().create()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

weird call


# contours
with v3.VTooltip(
Expand Down Expand Up @@ -115,36 +61,16 @@ def __init__(self, source, update_rendering, **kwargs):
variant="solo",
)
v3.VDivider()
v3.VBtn(
"Update 3D view",
block=True,
classes="text-none",
flat=True,
density="compact",
rounded=0,
disabled=("data_arrays.length === 0",),
color=("dirty_data && data_arrays.length ? 'primary': undefined",),
click=(update_rendering, "[true]"),
)

UpdateButton(update_rendering).create()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

weird call


def update_from_source(self, source=None):
if source is None:
# Call base implementation
super().update_from_source(source)

if self.source is None:
return

# Additional contour-specific logic
with self.state as state:
state.data_arrays_available = source.available_arrays
state.data_arrays = source.arrays
state.color_by = None
state.axis_names = [source.x, source.y, source.z]
state.slice_extents = source.slice_extents

# Update time
state.slice_t = source.t_index
state.slice_t_max = source.t_size - 1
state.t_labels = source.t_labels
state.max_time_width = math.ceil(0.58 * max_str_length(state.t_labels))

if state.slice_t_max > 0:
state.max_time_index_width = math.ceil(
0.6 + (math.log10(state.slice_t_max + 1) + 1) * 2 * 0.58
)
Loading
Loading