Skip to content

Commit 222f2c3

Browse files
bourdaisjjourdain
authored andcommitted
fix(vue3): update examples to work with vuetify 3
1 parent e198720 commit 222f2c3

File tree

8 files changed

+93
-94
lines changed

8 files changed

+93
-94
lines changed

examples/00_AddressBook/app.py

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from pathlib import Path
22
from trame.app import get_server
3-
from trame.ui.vuetify import SinglePageWithDrawerLayout
4-
from trame.widgets import vuetify, simput
3+
from trame.ui.vuetify3 import SinglePageWithDrawerLayout
4+
from trame.widgets import vuetify3 as vuetify, simput
55

66
from trame_simput import get_simput_manager
77

@@ -109,8 +109,8 @@ def entry_ids(self):
109109
items=(
110110
"options",
111111
[
112-
{"text": "English", "value": "en"},
113-
{"text": "Francais", "value": "fr"},
112+
{"title": "English", "value": "en"},
113+
{"title": "Francais", "value": "fr"},
114114
],
115115
),
116116
**compact_styles,
@@ -119,7 +119,7 @@ def entry_ids(self):
119119
classes="mx-2",
120120
v_model="abAutoApply",
121121
label="Apply",
122-
**compact_styles,
122+
**compact_styles,
123123
)
124124
with vuetify.VBtn(
125125
**btn_styles,
@@ -154,20 +154,19 @@ def entry_ids(self):
154154

155155
with layout.drawer:
156156
with vuetify.VList(**compact_styles):
157-
with vuetify.VListItemGroup(v_model="active_id", color="primary"):
157+
with vuetify.VListGroup(v_model="active_id", color="primary"):
158158
with vuetify.VListItem(
159159
v_for="(id, i) in person_ids",
160160
key="i",
161161
value=("id",),
162162
):
163-
with vuetify.VListItemContent():
164-
with vuetify.VListItemTitle():
165-
simput.SimputItem(
166-
"{{FirstName}} {{LastName}}",
167-
item_id="id",
168-
no_ui=True,
169-
extract=["FirstName", "LastName"],
170-
)
163+
with vuetify.VListItemTitle():
164+
simput.SimputItem(
165+
"{{FirstName}} {{LastName}}",
166+
item_id="id",
167+
no_ui=True,
168+
extract=["FirstName", "LastName"],
169+
)
171170

172171
with layout.content:
173172
with vuetify.VContainer(fluid=True):

examples/00_AddressBook/definitions/model.yaml

Lines changed: 51 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -33,107 +33,107 @@ Person:
3333
domains:
3434
- type: LabelList
3535
values:
36-
- text: Alabama
36+
- title: Alabama
3737
value: AL
38-
- text: Alaska
38+
- title: Alaska
3939
value: AK
40-
- text: Arizona
40+
- title: Arizona
4141
value: AZ
42-
- text: Arkansas
42+
- title: Arkansas
4343
value: AR
44-
- text: California
44+
- title: California
4545
value: CA
46-
- text: Colorado
46+
- title: Colorado
4747
value: CO
48-
- text: Connecticut
48+
- title: Connecticut
4949
value: CT
50-
- text: Delaware
50+
- title: Delaware
5151
value: DE
52-
- text: Florida
52+
- title: Florida
5353
value: FL
54-
- text: Georgia
54+
- title: Georgia
5555
value: GA
56-
- text: Hawaii
56+
- title: Hawaii
5757
value: HI
58-
- text: Idaho
58+
- title: Idaho
5959
value: ID
60-
- text: Illinois
60+
- title: Illinois
6161
value: IL
62-
- text: Indiana
62+
- title: Indiana
6363
value: IN
64-
- text: Iowa
64+
- title: Iowa
6565
value: IA
66-
- text: Kansas
66+
- title: Kansas
6767
value: KS
68-
- text: Kentucky
68+
- title: Kentucky
6969
value: KY
70-
- text: Louisiana
70+
- title: Louisiana
7171
value: LA
72-
- text: Maine
72+
- title: Maine
7373
value: ME
74-
- text: Maryland
74+
- title: Maryland
7575
value: MD
76-
- text: Massachusetts
76+
- title: Massachusetts
7777
value: MA
78-
- text: Michigan
78+
- title: Michigan
7979
value: MI
80-
- text: Minnesota
80+
- title: Minnesota
8181
value: MN
82-
- text: Mississippi
82+
- title: Mississippi
8383
value: MS
84-
- text: Missouri
84+
- title: Missouri
8585
value: MO
86-
- text: Montana
86+
- title: Montana
8787
value: MT
88-
- text: Nebraska
88+
- title: Nebraska
8989
value: NE
90-
- text: Nevada
90+
- title: Nevada
9191
value: NV
92-
- text: New Hampshire
92+
- title: New Hampshire
9393
value: NH
94-
- text: New Jersey
94+
- title: New Jersey
9595
value: NJ
96-
- text: New Mexico
96+
- title: New Mexico
9797
value: NM
98-
- text: New York
98+
- title: New York
9999
value: NY
100-
- text: North Carolina
100+
- title: North Carolina
101101
value: NC
102-
- text: North Dakota
102+
- title: North Dakota
103103
value: ND
104-
- text: Ohio
104+
- title: Ohio
105105
value: OH
106-
- text: Oklahoma
106+
- title: Oklahoma
107107
value: OK
108-
- text: Oregon
108+
- title: Oregon
109109
value: OR
110-
- text: Pennsylvania
110+
- title: Pennsylvania
111111
value: PA
112-
- text: Rhode Island
112+
- title: Rhode Island
113113
value: RI
114-
- text: South Carolina
114+
- title: South Carolina
115115
value: SC
116-
- text: South Dakota
116+
- title: South Dakota
117117
value: SD
118-
- text: Tennessee
118+
- title: Tennessee
119119
value: TN
120-
- text: Texas
120+
- title: Texas
121121
value: TX
122-
- text: Utah
122+
- title: Utah
123123
value: UT
124-
- text: Vermont
124+
- title: Vermont
125125
value: VT
126-
- text: Virginia
126+
- title: Virginia
127127
value: VA
128-
- text: Washington
128+
- title: Washington
129129
value: WA
130-
- text: West Virginia
130+
- title: West Virginia
131131
value: WV
132-
- text: Wisconsin
132+
- title: Wisconsin
133133
value: WI
134-
- text: Wyoming
134+
- title: Wyoming
135135
value: WY
136-
- text: Not Applicable
136+
- title: Not Applicable
137137
value: N/A
138138
ZipCode:
139139
_label: Zip Code

examples/01_Widgets/app.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from pathlib import Path
22
from trame.app import get_server
3-
from trame.ui.vuetify import SinglePageLayout
4-
from trame.widgets import vuetify, simput, html
3+
from trame.ui.vuetify3 import SinglePageLayout
4+
from trame.widgets import vuetify3 as vuetify, simput, html
55

66
from trame_simput import get_simput_manager
77

examples/02_Hints/app.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
from pathlib import Path
22
from trame.app import get_server
3-
from trame.ui.vuetify import SinglePageLayout
4-
from trame.widgets import vuetify, simput
3+
from trame.ui.vuetify3 import SinglePageLayout
4+
from trame.widgets import vuetify3 as vuetify, simput
55

66
from trame_simput import get_simput_manager
77

88
# -----------------------------------------------------------------------------
99
# Trame setup
1010
# -----------------------------------------------------------------------------
1111

12-
server = get_server()
12+
server = get_server(client_type="vue3")
1313
state, ctrl = server.state, server.controller
1414

1515

@@ -30,7 +30,7 @@
3030
CHOICES = []
3131
for obj_type in pxm.types():
3232
item = pxm.create(obj_type)
33-
CHOICES.append({"text": obj_type, "value": item.id})
33+
CHOICES.append({"title": obj_type, "value": item.id})
3434

3535
# -----------------------------------------------------------------------------
3636
# Simput container initialization

examples/03_VTK/app.py

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
from pathlib import Path
22

33
from trame.app import get_server
4-
from trame.ui.vuetify import SinglePageWithDrawerLayout
5-
from trame.widgets import vuetify, simput, html, trame, vtk
4+
from trame.ui.vuetify3 import SinglePageWithDrawerLayout
5+
from trame.widgets import vuetify3 as vuetify, simput, html, trame, vtk
66

77
from trame_simput import get_simput_manager
88

@@ -131,27 +131,27 @@ def import_file(import_file, **kwargs):
131131
for icon in ICONS:
132132
with vuetify.VTab():
133133
vuetify.VIcon(icon)
134-
with vuetify.VTabsItems(v_model=("drawer_mode", 0)):
135-
with vuetify.VTabItem():
134+
135+
with vuetify.VWindow(v_model=("drawer_mode", 0), style="height: 100%;"):
136+
with vuetify.VWindowItem(style="height: 100%;"):
136137
with vuetify.VList(dense=True):
137-
with vuetify.VListItemGroup(
138+
with vuetify.VItemGroup(
138139
v_model=("active_id", 0), color="primary"
139140
):
140141
with vuetify.VListItem(
141142
v_for="(id, i) in source_ids",
142143
key="i",
143144
value=("id",),
144145
):
145-
with vuetify.VListItemContent():
146-
with vuetify.VListItemTitle():
147-
simput.SimputItem(
148-
"{{ data.name }}",
149-
item_id="id",
150-
no_ui=True,
151-
v_slot="{ data }",
152-
)
153-
154-
with vuetify.VTabItem():
146+
with vuetify.VListItemTitle():
147+
simput.SimputItem(
148+
"{{ data.name }}",
149+
item_id="id",
150+
no_ui=True,
151+
v_slot="{ data }",
152+
)
153+
154+
with vuetify.VWindowItem():
155155
with vuetify.VCard():
156156
with vuetify.VCardText():
157157
with vuetify.VRow():
@@ -176,7 +176,7 @@ def import_file(import_file, **kwargs):
176176
"Create", click=(create_object, "[obj_name, obj_type]")
177177
)
178178

179-
with vuetify.VTabItem():
179+
with vuetify.VWindowItem():
180180
simput.SimputItem(item_id="active_id")
181181

182182
with layout.toolbar as toolbar:
@@ -192,7 +192,7 @@ def import_file(import_file, **kwargs):
192192
v_bind="attrs",
193193
v_on="on",
194194
icon=True,
195-
click="document.getElementById('importFile').click();",
195+
click="window.document.getElementById('importFile').click();",
196196
):
197197
vuetify.VIcon("mdi-database-import-outline")
198198
html.Input(

examples/04_DynaDomain/app.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from pathlib import Path
22
from trame.app import get_server
3-
from trame.ui.vuetify import SinglePageLayout
4-
from trame.widgets import vuetify, simput
3+
from trame.ui.vuetify3 import SinglePageLayout
4+
from trame.widgets import vuetify3 as vuetify, simput
55

66
from trame_simput import get_simput_manager
77
from trame_simput.core.domains import PropertyDomain, register_property_domain

examples/05_ReadonlyDisabled/app.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from pathlib import Path
22
from trame.app import get_server
3-
from trame.ui.vuetify import SinglePageLayout
3+
from trame.ui.vuetify3 import SinglePageLayout
44
from trame.widgets import simput
55
from trame_simput import get_simput_manager
66

examples/06_DynaDropDown/app.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from pathlib import Path
22
from trame.app import get_server
3-
from trame.ui.vuetify import SinglePageLayout
4-
from trame.widgets import vuetify, simput, html
3+
from trame.ui.vuetify3 import SinglePageLayout
4+
from trame.widgets import vuetify3 as vuetify, simput, html
55
from trame.decorators import TrameApp
66

77
from trame_simput import get_simput_manager
@@ -22,7 +22,7 @@ def available(self):
2222
class App:
2323
def __init__(self, server=None):
2424
global PROXY_FIELDS
25-
self.server = get_server(server, client_type="vue2")
25+
self.server = get_server(server, client_type="vue3")
2626
register_property_domain("ListDomain", ListDomain)
2727

2828
# Simput

0 commit comments

Comments
 (0)