h2o-wave 0.26.3__py3-none-any.whl → 1.0.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of h2o-wave might be problematic. Click here for more details.

@@ -1,227 +0,0 @@
1
- from h2o_wave import main, app, Q, ui, on, handle_on, data
2
- from typing import Optional, List
3
-
4
-
5
- # Use for page cards that should be removed when navigating away.
6
- # For pages that should be always present on screen use q.page[key] = ...
7
- def add_card(q, name, card) -> None:
8
- q.client.cards.add(name)
9
- q.page[name] = card
10
-
11
-
12
- # Remove all the cards related to navigation.
13
- def clear_cards(q, ignore: Optional[List[str]] = []) -> None:
14
- if not q.client.cards:
15
- return
16
-
17
- for name in q.client.cards.copy():
18
- if name not in ignore:
19
- del q.page[name]
20
- q.client.cards.remove(name)
21
-
22
-
23
- @on('#page1')
24
- async def page1(q: Q):
25
- q.page['sidebar'].value = '#page1'
26
- clear_cards(q) # When routing, drop all the cards except of the main ones (header, sidebar, meta).
27
-
28
- for i in range(3):
29
- add_card(q, f'info{i}', ui.tall_info_card(box='horizontal', name='', title='Speed',
30
- caption='The models are performant thanks to...', icon='SpeedHigh'))
31
- add_card(q, 'article', ui.tall_article_preview_card(
32
- box=ui.box('vertical', height='600px'), title='How does magic work',
33
- image='https://images.pexels.com/photos/624015/pexels-photo-624015.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=1',
34
- content='''
35
- Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum ac sodales felis. Duis orci enim, iaculis at augue vel, mattis imperdiet ligula. Sed a placerat lacus, vitae viverra ante. Duis laoreet purus sit amet orci lacinia, non facilisis ipsum venenatis. Duis bibendum malesuada urna. Praesent vehicula tempor volutpat. In sem augue, blandit a tempus sit amet, tristique vehicula nisl. Duis molestie vel nisl a blandit. Nunc mollis ullamcorper elementum.
36
- Donec in erat augue. Nullam mollis ligula nec massa semper, laoreet pellentesque nulla ullamcorper. In ante ex, tristique et mollis id, facilisis non metus. Aliquam neque eros, semper id finibus eu, pellentesque ac magna. Aliquam convallis eros ut erat mollis, sit amet scelerisque ex pretium. Nulla sodales lacus a tellus molestie blandit. Praesent molestie elit viverra, congue purus vel, cursus sem. Donec malesuada libero ut nulla bibendum, in condimentum massa pretium. Aliquam erat volutpat. Interdum et malesuada fames ac ante ipsum primis in faucibus. Integer vel tincidunt purus, congue suscipit neque. Fusce eget lacus nibh. Sed vestibulum neque id erat accumsan, a faucibus leo malesuada. Curabitur varius ligula a velit aliquet tincidunt. Donec vehicula ligula sit amet nunc tempus, non fermentum odio rhoncus.
37
- Vestibulum condimentum consectetur aliquet. Phasellus mollis at nulla vel blandit. Praesent at ligula nulla. Curabitur enim tellus, congue id tempor at, malesuada sed augue. Nulla in justo in libero condimentum euismod. Integer aliquet, velit id convallis maximus, nisl dui porta velit, et pellentesque ligula lorem non nunc. Sed tincidunt purus non elit ultrices egestas quis eu mauris. Sed molestie vulputate enim, a vehicula nibh pulvinar sit amet. Nullam auctor sapien est, et aliquet dui congue ornare. Donec pulvinar scelerisque justo, nec scelerisque velit maximus eget. Ut ac lectus velit. Pellentesque bibendum ex sit amet cursus commodo. Fusce congue metus at elementum ultricies. Suspendisse non rhoncus risus. In hac habitasse platea dictumst.
38
- '''
39
- ))
40
-
41
-
42
- @on('#page2')
43
- async def page2(q: Q):
44
- q.page['sidebar'].value = '#page2'
45
- clear_cards(q) # When routing, drop all the cards except of the main ones (header, sidebar, meta).
46
- add_card(q, 'chart1', ui.plot_card(
47
- box='horizontal',
48
- title='Chart 1',
49
- data=data('category country product price', 10, rows=[
50
- ('G1', 'USA', 'P1', 124),
51
- ('G1', 'China', 'P2', 580),
52
- ('G1', 'USA', 'P3', 528),
53
- ('G1', 'China', 'P1', 361),
54
- ('G1', 'USA', 'P2', 228),
55
- ('G2', 'China', 'P3', 418),
56
- ('G2', 'USA', 'P1', 824),
57
- ('G2', 'China', 'P2', 539),
58
- ('G2', 'USA', 'P3', 712),
59
- ('G2', 'USA', 'P1', 213),
60
- ]),
61
- plot=ui.plot([ui.mark(type='interval', x='=product', y='=price', color='=country', stack='auto',
62
- dodge='=category', y_min=0)])
63
- ))
64
- add_card(q, 'chart2', ui.plot_card(
65
- box='horizontal',
66
- title='Chart 2',
67
- data=data('date price', 10, rows=[
68
- ('2020-03-20', 124),
69
- ('2020-05-18', 580),
70
- ('2020-08-24', 528),
71
- ('2020-02-12', 361),
72
- ('2020-03-11', 228),
73
- ('2020-09-26', 418),
74
- ('2020-11-12', 824),
75
- ('2020-12-21', 539),
76
- ('2020-03-18', 712),
77
- ('2020-07-11', 213),
78
- ]),
79
- plot=ui.plot([ui.mark(type='line', x_scale='time', x='=date', y='=price', y_min=0)])
80
- ))
81
- add_card(q, 'table', ui.form_card(box='vertical', items=[ui.table(
82
- name='table',
83
- downloadable=True,
84
- resettable=True,
85
- groupable=True,
86
- columns=[
87
- ui.table_column(name='text', label='Process', searchable=True),
88
- ui.table_column(name='tag', label='Status', filterable=True, cell_type=ui.tag_table_cell_type(
89
- name='tags',
90
- tags=[
91
- ui.tag(label='FAIL', color='$red'),
92
- ui.tag(label='DONE', color='#D2E3F8', label_color='#053975'),
93
- ui.tag(label='SUCCESS', color='$mint'),
94
- ]
95
- ))
96
- ],
97
- rows=[
98
- ui.table_row(name='row1', cells=['Process 1', 'FAIL']),
99
- ui.table_row(name='row2', cells=['Process 2', 'SUCCESS,DONE']),
100
- ui.table_row(name='row3', cells=['Process 3', 'DONE']),
101
- ui.table_row(name='row4', cells=['Process 4', 'FAIL']),
102
- ui.table_row(name='row5', cells=['Process 5', 'SUCCESS,DONE']),
103
- ui.table_row(name='row6', cells=['Process 6', 'DONE']),
104
- ])
105
- ]))
106
-
107
-
108
- @on('#page3')
109
- async def page3(q: Q):
110
- q.page['sidebar'].value = '#page3'
111
- clear_cards(q) # When routing, drop all the cards except of the main ones (header, sidebar, meta).
112
-
113
- for i in range(12):
114
- add_card(q, f'item{i}', ui.wide_info_card(box=ui.box('grid', width='400px'), name='', title='Tile',
115
- caption='Lorem ipsum dolor sit amet'))
116
-
117
-
118
- @on('#page4')
119
- async def handle_page4(q: Q):
120
- q.page['sidebar'].value = '#page4'
121
- # When routing, drop all the cards except of the main ones (header, sidebar, meta).
122
- # Since this page is interactive, we want to update its card instead of recreating it every time, so ignore 'form' card on drop.
123
- clear_cards(q, ['form'])
124
-
125
- if q.args.step1:
126
- # Just update the existing card, do not recreate.
127
- q.page['form'].items = [
128
- ui.stepper(name='stepper', items=[
129
- ui.step(label='Step 1'),
130
- ui.step(label='Step 2'),
131
- ui.step(label='Step 3'),
132
- ]),
133
- ui.textbox(name='textbox2', label='Textbox 1'),
134
- ui.buttons(justify='end', items=[
135
- ui.button(name='step2', label='Next', primary=True),
136
- ])
137
- ]
138
- elif q.args.step2:
139
- # Just update the existing card, do not recreate.
140
- q.page['form'].items = [
141
- ui.stepper(name='stepper', items=[
142
- ui.step(label='Step 1', done=True),
143
- ui.step(label='Step 2'),
144
- ui.step(label='Step 3'),
145
- ]),
146
- ui.textbox(name='textbox2', label='Textbox 2'),
147
- ui.buttons(justify='end', items=[
148
- ui.button(name='step1', label='Cancel'),
149
- ui.button(name='step3', label='Next', primary=True),
150
- ])
151
- ]
152
- elif q.args.step3:
153
- # Just update the existing card, do not recreate.
154
- q.page['form'].items = [
155
- ui.stepper(name='stepper', items=[
156
- ui.step(label='Step 1', done=True),
157
- ui.step(label='Step 2', done=True),
158
- ui.step(label='Step 3'),
159
- ]),
160
- ui.textbox(name='textbox3', label='Textbox 3'),
161
- ui.buttons(justify='end', items=[
162
- ui.button(name='step2', label='Cancel'),
163
- ui.button(name='submit', label='Next', primary=True),
164
- ])
165
- ]
166
- else:
167
- # If first time on this page, create the card.
168
- add_card(q, 'form', ui.form_card(box='vertical', items=[
169
- ui.stepper(name='stepper', items=[
170
- ui.step(label='Step 1'),
171
- ui.step(label='Step 2'),
172
- ui.step(label='Step 3'),
173
- ]),
174
- ui.textbox(name='textbox1', label='Textbox 1'),
175
- ui.buttons(justify='end', items=[
176
- ui.button(name='step2', label='Next', primary=True),
177
- ]),
178
- ]))
179
-
180
-
181
- async def init(q: Q) -> None:
182
- q.page['meta'] = ui.meta_card(box='', layouts=[ui.layout(breakpoint='xs', min_height='100vh', zones=[
183
- ui.zone('main', size='1', direction=ui.ZoneDirection.ROW, zones=[
184
- ui.zone('sidebar', size='250px'),
185
- ui.zone('body', zones=[
186
- ui.zone('content', zones=[
187
- # Specify various zones and use the one that is currently needed. Empty zones are ignored.
188
- ui.zone('horizontal', direction=ui.ZoneDirection.ROW),
189
- ui.zone('vertical'),
190
- ui.zone('grid', direction=ui.ZoneDirection.ROW, wrap='stretch', justify='center')
191
- ]),
192
- ]),
193
- ])
194
- ])])
195
- q.page['sidebar'] = ui.nav_card(
196
- box='sidebar', color='primary', title='My App', subtitle="Let's conquer the world!",
197
- value=f'#{q.args["#"]}' if q.args['#'] else '#page1',
198
- image='https://wave.h2o.ai/img/h2o-logo.svg', items=[
199
- ui.nav_group('Menu', items=[
200
- ui.nav_item(name='#page1', label='Home'),
201
- ui.nav_item(name='#page2', label='Charts'),
202
- ui.nav_item(name='#page3', label='Grid'),
203
- ui.nav_item(name='#page4', label='Form'),
204
- ]),
205
- ],
206
- secondary_items=[
207
- ui.persona(title='John Doe', subtitle='Developer', size='s',
208
- image='https://images.pexels.com/photos/220453/pexels-photo-220453.jpeg?auto=compress&h=750&w=1260'),
209
- ]
210
- )
211
-
212
- # If no active hash present, render page1.
213
- if q.args['#'] is None:
214
- await page1(q)
215
-
216
-
217
- @app('/')
218
- async def serve(q: Q):
219
- # Run only once per client connection.
220
- if not q.client.initialized:
221
- q.client.cards = set()
222
- await init(q)
223
- q.client.initialized = True
224
-
225
- # Handle routing.
226
- await handle_on(q)
227
- await q.page.save()
@@ -1,29 +0,0 @@
1
- h2o_wave/__init__.py,sha256=OOFxoUhRs7IHsmZZyDGAkY4_sdlUtuJJQT1x06Adkn4,1674
2
- h2o_wave/__main__.py,sha256=MoNOW43ppIqCdY3iq0n25Q3SKLyk8Igg5fD_sSROK4c,638
3
- h2o_wave/cli.py,sha256=bM_qXy1nvx5g38wSBV2tTxjtLY1zTlEbJne3Jv2bONg,12559
4
- h2o_wave/core.py,sha256=YEHBFWTllX99jTofGWPOg93MavLsOonTT6gGiciqp7U,39019
5
- h2o_wave/db.py,sha256=H3W_EyMfnwr4UjqPVoAsE19O2QzY1ptIYGMOqU0YUQo,7489
6
- h2o_wave/graphics.py,sha256=HLYrX-lwsMKbyLmy2ClG5L46DA2_hSCEPTsv0gPVoyg,25866
7
- h2o_wave/ide.py,sha256=wAJjfEI1ekQrL455FGRVeNi3KiH6ELgsG3qm31Q-kRs,6810
8
- h2o_wave/metadata.py,sha256=yxQ-BCY56rDs8o3N8K_rOABA5h390WZs8C0uXJy5sDw,66
9
- h2o_wave/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10
- h2o_wave/routing.py,sha256=5aNgnVjhYU3Yih--rC2THfsNZpVWBHmzY9ju64KtyB4,7889
11
- h2o_wave/server.py,sha256=a-p7WVtEz5GSbjSzMxO9sY92AoHWalQiqmHR-2evXH8,19122
12
- h2o_wave/share.py,sha256=nnLwLt7cccUMMFWUkVPUgiv2-T_2pcOxlVfGbl-btv4,843
13
- h2o_wave/test.py,sha256=hF_fS5e25bACnzENjpDrikv7nPOs0iENh4MuXX9BaVA,2738
14
- h2o_wave/types.py,sha256=DO-z92m6oAxPUhN1144vdZ4Ug8jII8YAGlHYu239P4E,635848
15
- h2o_wave/ui.py,sha256=u41t97teUgPOB3IJ8TxIkd4qp8AW_Y9Dskcaq78iRww,166206
16
- h2o_wave/ui_ext.py,sha256=zx_2Ec2-p_ztm8brfVaVF0fTQWVDrb_YxcGfVb-wA10,2325
17
- h2o_wave/version.py,sha256=IJFEoLY0s48Q1zpqv88QrvXA_m6iYTmujuwk8Gd0uus,23
18
- h2o_wave-0.26.3.data/data/project_templates/README.md,sha256=RFQX5Ly7sZd55zRW3GgqjJDMFoPbZbZM7zuK1CuP1y4,1052
19
- h2o_wave-0.26.3.data/data/project_templates/header.py,sha256=lIROU6xzlzxq2GrqiUVYdqJ3U7zRln4qbehQipdfVxQ,2603
20
- h2o_wave-0.26.3.data/data/project_templates/header_nav.py,sha256=3ctwel84C2Kh05s_IR9COBcLYjSUWuh-LcmJyNfzWyM,10389
21
- h2o_wave-0.26.3.data/data/project_templates/header_sidebar_nav.py,sha256=bJWlfuQkFqGy4kXPvLXfZ5IOxDMmR7IAFWh-CITMMqg,10994
22
- h2o_wave-0.26.3.data/data/project_templates/hello_world.py,sha256=wUHq-f9bXcVXDyGTHKYI7i44mK9tlbAJIqFEytTBB2I,2475
23
- h2o_wave-0.26.3.data/data/project_templates/sidebar_nav.py,sha256=Iq-CY5VSPXibruN_Qu_Jh6f6DIQ3Q9Mr90HWyKdmiF0,10775
24
- h2o_wave-0.26.3.dist-info/LICENSE,sha256=hpuFayniDwysSKD0tHGELH2KJDVyhUrKS29torRIpqY,53
25
- h2o_wave-0.26.3.dist-info/METADATA,sha256=hxDRTPuxoCMI5aI71bcdaIeUzHBXRXmG8LKXYzDSaZ0,2554
26
- h2o_wave-0.26.3.dist-info/WHEEL,sha256=yQN5g4mg4AybRjkgi-9yy4iQEFibGQmlz78Pik5Or-A,92
27
- h2o_wave-0.26.3.dist-info/entry_points.txt,sha256=0JfvaphzVeSD5pkJTr6OKTLcROFnQ1cp31DI8M5frzY,44
28
- h2o_wave-0.26.3.dist-info/top_level.txt,sha256=jmpW_e6CkJf82dE4S7ofAe2ipbBd1YmrS-0MM-DN0lY,9
29
- h2o_wave-0.26.3.dist-info/RECORD,,
@@ -1 +0,0 @@
1
- h2o_wave