Skip to content

Commit a508ea2

Browse files
Merge pull request #71 from finetjul/tweak-medical-example
Tweak medical example
2 parents 898ef44 + ce92b4c commit a508ea2

4 files changed

Lines changed: 23 additions & 6 deletions

File tree

README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,11 @@ To get started using trame, please have a look at the
4747
[introductory trame course](https://kitware.github.io/trame/guide/intro/course.html).
4848

4949
To start using the trame-slicer library, have a look and run the
50-
[medical viewer app](examples/medical_viewer_app.py)
50+
[medical viewer app](examples/medical_viewer_app.py):
51+
52+
```bash
53+
python examples/medical_viewer_app.py
54+
```
5155

5256
## Features
5357

@@ -93,7 +97,7 @@ The library is distributed with a permissive license. Please look at the
9397
[LICENSE](https://github.com/KitwareMedical/trame-slicer/blob/main/LICENSE) file
9498
for more information.
9599

96-
## Acknowledgment
100+
## Acknowledgments
97101

98102
This library was funded by the following projects :
99103

examples/viewer_lib/ui/segmentation/segment_display_ui.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,18 @@ def __init__(self, typed_state: TypedState[SegmentDisplayState], **kwargs):
4141

4242
self._typed_state.data.opacity_3d.step = 0.01
4343
self._typed_state.data.opacity_3d.value = 1
44+
self._typed_state.data.opacity_3d.is_disabled = not self._typed_state.data.show_3d
4445

4546
with self:
46-
with VCardItem():
47+
with VCardItem(
48+
click=f"{self._typed_state.name.is_extended} = !{self._typed_state.name.is_extended};",
49+
):
4750
Text("Rendering", title=True)
4851
with Template(v_slot_append=True):
4952
VBtn(
5053
icon=(f"{self._typed_state.name.is_extended} ? 'mdi-chevron-up' : 'mdi-chevron-down'",),
5154
variant="flat",
52-
click=f"{self._typed_state.name.is_extended} = !{self._typed_state.name.is_extended};",
55+
click_stop=f"{self._typed_state.name.is_extended} = !{self._typed_state.name.is_extended};",
5356
size="small",
5457
)
5558
with VCardText(v_if=(self._typed_state.name.is_extended,), classes="align-center"):
@@ -88,7 +91,7 @@ def __init__(self, typed_state: TypedState[SegmentDisplayState], **kwargs):
8891
ControlButton(
8992
icon="mdi-video-3d",
9093
name="Toggle 3D",
91-
click=f"{self._typed_state.name.show_3d} = ! {self._typed_state.name.show_3d}",
94+
click=self._toggle_show_3d,
9295
active=(self._typed_state.name.show_3d,),
9396
)
9497
Text("Border thickness", subtitle=True)
@@ -117,3 +120,7 @@ def _on_display_options_changed(self, opacity_mode):
117120
)
118121
else:
119122
self._typed_state.data.opacity_mode = SegmentationOpacityEnum.BOTH
123+
124+
def _toggle_show_3d(self):
125+
self._typed_state.data.show_3d = not self._typed_state.data.show_3d
126+
self._typed_state.data.opacity_3d.is_disabled = not self._typed_state.data.show_3d

examples/viewer_lib/ui/text_components.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@ def __init__(self, text: str, title: bool = False, subtitle: bool = False, **kwa
1010
"text-subtitle-1" if title else ("text-subtitle-2" if subtitle else ""),
1111
]
1212
)
13+
kwargs["style"] = " ".join(
14+
[
15+
"user-select: none;", # text is not selectable by default
16+
kwargs.pop("style", ""),
17+
]
18+
)
1319
super().__init__(**kwargs)
1420

1521
with self:

examples/viewer_lib/ui/viewer_layout.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def __init__(
4242

4343
with self:
4444
with VAppBar() as self.appbar:
45-
self.title = VToolbarTitle(title)
45+
self.title = VToolbarTitle(title, style="user-select: none;")
4646

4747
with VFooter(app=True, classes="my-0 py-0", border=True) as self.footer:
4848
VProgressCircular(

0 commit comments

Comments
 (0)