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 __future__ import annotations | |
| import inspect | |
| from typing import Callable | |
| from nicegui import binding, ui | |
| from nicegui.elements.markdown import remove_indentation | |
| from ..style import create_anchor_name, subheading | |
| from .custom_restructured_text import CustomRestructuredText as custom_restructured_text |
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
| import os | |
| import ssl | |
| import sys | |
| from datetime import UTC, datetime | |
| from cryptography import x509 | |
| from cryptography.hazmat.backends import default_backend | |
| from cryptography.hazmat.primitives import serialization | |
| # Define log file path |
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 nicegui import ui | |
| ui.add_head_html(''' | |
| <style> | |
| .extra-compact, .extra-compact .q-field__control, .extra-compact .q-field__append, .extra-compact .q-field__control--addon { | |
| height: 30px !important; | |
| max-height: 30px !important; | |
| min-height: 30px !important; | |
| align-items: center; | |
| } |
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
| # Pieced together from: | |
| # (1) https://github.com/Vizonex/Winloop?tab=readme-ov-file#how-to-use-winloop-with-fastapi | |
| # (2) https://www.reddit.com/r/nicegui/comments/1dlx3or/fastapi_nicegui_integration/ | |
| # (3) https://github.com/pgjones/hypercorn?tab=readme-ov-file#quickstart | |
| from fastapi import FastAPI | |
| from fastapi.responses import HTMLResponse | |
| import winloop | |
| from hypercorn.config import Config | |
| from hypercorn.asyncio import serve | |
| import asyncio |
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
| # Pieced together from: | |
| # (1) https://github.com/Vizonex/Winloop?tab=readme-ov-file#how-to-use-winloop-with-fastapi | |
| # (2) https://www.reddit.com/r/nicegui/comments/1dlx3or/fastapi_nicegui_integration/ | |
| from fastapi import FastAPI | |
| from fastapi.responses import HTMLResponse | |
| import winloop | |
| import uvicorn | |
| import asyncio | |
| import datetime | |
| from nicegui import ui |
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 True = true; | |
| const False = false; | |
| const None = undefined; | |
| let app = undefined; | |
| let mounted_app = undefined; | |
| const loaded_libraries = new Set(); | |
| const loaded_components = new Set(); |
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
| print("__name__ is", __name__) | |
| DEV = True # True for development with hot reload, False for production with no hot reload | |
| from nicegui.ui_run import run as ui_run # just importing the function to run the server | |
| if not DEV or not __name__ == "__main__": # you can do `if True:` to bypass this to revert to the normal behavior, but that is slow... | |
| # Explanation: 2 reasons for running this code: | |
| # 1. not in dev mode, so there is no __mp_main__, this is already where NiceGUI will run | |
| # 2. or, in dev mode, and this is the __mp_main__, so we want to run this code | |
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 nicegui import ui | |
| class my_widget: | |
| def __init__(self, name, value): | |
| self.name = name | |
| self.value = value | |
| self.container = ui.row() | |
| self.create_widget() |
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
| adg// NOTE: I only go so far as to ensure this works with the nicegui-speed | |
| // Based on NiceGUI 2.12.1 | |
| const True = true; | |
| const False = false; | |
| const None = undefined; | |
| let app = undefined; | |
| let mounted_app = undefined; |
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 nicegui.element import Element | |
| class MyRowSoftload(Element, component='my_row_softload.js'): | |
| def __init__(self, *, day_texts=[], day_checked=[]) -> None: | |
| super().__init__() | |
| self._props["day_texts"] = day_texts | |
| self._props["day_checked"] = day_checked |
NewerOlder