-
-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
52 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
from trame.app import get_server | ||
from trame.widgets import vtk as tvtk, vuetify | ||
from trame.ui.vuetify import SinglePageWithDrawerLayout | ||
|
||
import json | ||
|
||
server = get_server(client_type="vue2") | ||
state = server.state | ||
ctrl = server.controller | ||
|
||
state.sgnodeList = json.loads( | ||
"""[ | ||
{ | ||
"name": "First", | ||
"visible": false, | ||
"selfcolor": "#ff643d", | ||
"selected": true | ||
}, | ||
{ | ||
"name": "Second", | ||
"visible": true, | ||
"selfcolor": "green", | ||
"selected": false | ||
} | ||
]""" | ||
) | ||
|
||
|
||
def changeSelected(): | ||
print("changing selected") | ||
|
||
|
||
with SinglePageWithDrawerLayout(server, style="overflow: hidden") as layout: | ||
layout.title.set_text("My App") | ||
|
||
with layout.drawer: | ||
with vuetify.VList(shaped=True): | ||
with vuetify.VListItem(v_for="val, idx in sgnodeList", key="idx"): | ||
vuetify.VSwitch( | ||
v_model=("val.visible",), | ||
color=("val.selfcolor",), | ||
) | ||
with vuetify.VListItemContent(): | ||
vuetify.VListItemTitle("{{val.name}}") | ||
|
||
vuetify.VCheckbox( | ||
v_model=("val.selected",), | ||
click=changeSelected, | ||
) | ||
|
||
if __name__ == "__main__": | ||
server.start() |