This file contains hidden or 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
| from h2o_wave import main, app, Q, ui | |
| @app('/') | |
| async def serve(q: Q): | |
| # Check if a link is clicked or active in URL. | |
| if q.args['#'] is not None: | |
| # Set it to local state. | |
| q.client.current_nav = f'#{q.args["#"]}' |
This file contains hidden or 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
| from h2o_wave import main, app, Q, ui | |
| @app('/') | |
| async def serve(q: Q): | |
| # Run this part only once, when the browser first connects. | |
| if not q.client.initialized: | |
| # Create a navigation card. | |
| q.page['nav'] = ui.nav_card( | |
| box='1 1 2 -1', |
This file contains hidden or 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
| from h2o_wave import main, app, Q, ui | |
| @app('/') | |
| async def serve(q: Q): | |
| if not q.client.initialized: | |
| # Upload the file to the Wave server. | |
| download_path, = await q.site.upload(['dataset.csv']) | |
| q.client.initialized = True |
This file contains hidden or 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
| from h2o_wave import main, app, Q, ui | |
| @app('/') | |
| async def serve(q: Q): | |
| # Use app scope to make sure the file is uploaded only once. | |
| if not q.app.initialized: | |
| # Upload the file to the Wave server. | |
| download_path, = await q.site.upload(['dataset.csv']) | |
| q.app.initialized = True |
This file contains hidden or 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
| const baseUrl = 'https://cdnjs.cloudflare.com/ajax/libs/monaco-editor/0.33.0/min/vs' | |
| // UNIMPORTANT: RequireJS paths config for monaco editor. | |
| require.config({ | |
| paths: { | |
| 'vs': baseUrl, | |
| 'vs/language': `${baseUrl}/language`, | |
| } | |
| }) | |
| // UNIMPORTANT: Web worker registration for monaco editor. | |
| window.MonacoEnvironment = { |
This file contains hidden or 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
| from h2o_wave import main, app, Q, ui | |
| # UNIMPORTANT: Helper function to read the file. | |
| def read_file(p: str) -> str: | |
| with open(p, encoding='utf-8') as f: | |
| return f.read() | |
| @app('/') |
This file contains hidden or 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
| if q.events.editor: | |
| if q.events.editor.save: | |
| q.page['text'].content = q.events.editor.save | |
| q.page['editor'].title = 'Editor' | |
| elif q.events.editor.change: | |
| # Show "dirty" state by appending an * to editor card title. | |
| q.page['editor'].title = '*Editor' |
This file contains hidden or 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
| from h2o_wave import main, app, Q, ui | |
| # UNIMPORTANT: Helper function to read the file. | |
| def read_file(p: str) -> str: | |
| with open(p, encoding='utf-8') as f: | |
| return f.read() | |
| @app('/') |
This file contains hidden or 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
| const baseUrl = 'https://cdnjs.cloudflare.com/ajax/libs/monaco-editor/0.33.0/min/vs' | |
| // UNIMPORTANT: RequireJS paths config for monaco editor. | |
| require.config({ | |
| paths: { | |
| 'vs': baseUrl, | |
| 'vs/language': `${baseUrl}/language`, | |
| } | |
| }) | |
| // UNIMPORTANT: Web worker registration for monaco editor. | |
| window.MonacoEnvironment = { |
This file contains hidden or 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
| from h2o_wave import main, app, Q, ui | |
| @app('/') | |
| async def serve(q: Q): | |
| # Initialize the page with a single button. | |
| if not q.client.initialized: | |
| q.page['form'] = ui.form_card( | |
| box='1 1 2 1', | |
| items=[ | |
| ui.button(name='start_recording', label='Start recording') |
OlderNewer