Skip to content

Commit

Permalink
add version information to demos
Browse files Browse the repository at this point in the history
  • Loading branch information
falkoschindler committed Jan 14, 2025
1 parent a866273 commit 6739a7d
Show file tree
Hide file tree
Showing 11 changed files with 28 additions and 1 deletion.
2 changes: 1 addition & 1 deletion nicegui/timer.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def __init__(self,
:param callback: function or coroutine to execute when interval elapses
:param active: whether the callback should be executed or not (can be changed during runtime)
:param once: whether the callback is only executed once after a delay specified by `interval` (default: `False`)
:param immediate: whether the callback should be executed immediately (default: `True`, ignored if `once` is `True`)
:param immediate: whether the callback should be executed immediately (default: `True`, ignored if `once` is `True`, *added in version 2.9.0*)
"""
super().__init__()
self.interval = interval
Expand Down
2 changes: 2 additions & 0 deletions website/documentation/content/aggrid_documentation.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,8 @@ def aggrid_from_pandas():
@doc.demo('Create Grid from Polars DataFrame', '''
You can create an AG Grid from a Polars DataFrame using the `from_polars` method.
This method takes a Polars DataFrame as input and returns an AG Grid.
*Added in version 2.7.0*
''')
def aggrid_from_polars():
import polars as pl
Expand Down
2 changes: 2 additions & 0 deletions website/documentation/content/colors_documentation.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ def main_demo() -> None:
@doc.demo('Custom colors', '''
You can add custom color definitions for branding.
In this case, `ui.colors` must be called before the custom color is ever used.
*Added in version 2.2.0*
''')
def custom_color_demo() -> None:
from random import randint
Expand Down
1 change: 1 addition & 0 deletions website/documentation/content/input_documentation.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ def styling():
- by passing a callable that returns an error message or `None`, or
- by passing a dictionary that maps error messages to callables that return `True` if the input is valid.
*Since version 2.7.0:*
The callable validation function can also be an async coroutine.
In this case, the validation is performed asynchronously in the background.
Expand Down
2 changes: 2 additions & 0 deletions website/documentation/content/json_editor_documentation.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ def main_demo() -> None:
- `id` must be an integer
- `name` must be a string
- `price` must be a number greater than 0
*Added in version 2.8.0*
''')
def schema_demo() -> None:
schema = {
Expand Down
2 changes: 2 additions & 0 deletions website/documentation/content/page_documentation.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ async def wait_for_connection():
The content on a page is private to the client (the browser tab) and has its own local element context.
If you want to send updates to _all_ clients of a specific page, you can use the `app.clients` iterator.
This is useful for modifying UI elements from a background process or from other pages.
*Added in version 2.7.0*
''')
def multicasting():
from nicegui import app
Expand Down
2 changes: 2 additions & 0 deletions website/documentation/content/scene_documentation.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,8 @@ def __init__(self, name: str, *, length: float = 1.0) -> None:
The position and rotation of the object are preserved so that the object does not move in space.
But note that scaling is not preserved.
If either the parent or the object itself is scaled, the object shape and position can change.
*Added in version 2.7.0*
''')
def attach_detach() -> None:
import math
Expand Down
4 changes: 4 additions & 0 deletions website/documentation/content/storage_documentation.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,8 @@ def tab_storage():
@doc.demo('Maximum age of tab storage', '''
By default, the tab storage is kept for 30 days.
You can change this by setting `app.storage.max_tab_storage_age`.
*Added in version 2.10.0*
''')
def max_tab_storage_age():
from nicegui import app
Expand Down Expand Up @@ -198,4 +200,6 @@ def short_term_memory():
If you have large data sets, we suggest to use a database instead.
See our [database example](https://github.com/zauberzeug/nicegui/blob/main/examples/sqlite_database/main.py) for a demo with SQLite.
But of course to sync between multiple instances you should replace SQLite with PostgreSQL or similar.
*Added in version 2.10.0*
''')
6 changes: 6 additions & 0 deletions website/documentation/content/table_documentation.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ def main_demo() -> None:
@doc.demo('Omitting columns', '''
If you omit the `columns` parameter, the table will automatically generate columns from the first row.
Labels are uppercased and sorting is enabled.
*Updated in version 2.0.0: The `columns` parameter became optional.*
''')
def omitting_columns():
ui.table(rows=[
Expand All @@ -32,6 +34,8 @@ def omitting_columns():
@doc.demo('Default column parameters', '''
You can define default column parameters that apply to all columns.
In this example, all columns are left-aligned by default and have a blue uppercase header.
*Added in version 2.0.0*
''')
def default_column_parameters():
ui.table(rows=[
Expand Down Expand Up @@ -169,6 +173,8 @@ def table_from_pandas_demo():
@doc.demo('Table from Polars DataFrame', '''
You can create a table from a Polars DataFrame using the `from_polars` method.
This method takes a Polars DataFrame as input and returns a table.
*Added in version 2.7.0*
''')
def table_from_polars_demo():
import polars as pl
Expand Down
2 changes: 2 additions & 0 deletions website/documentation/content/timer_documentation.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ def handle_click():
By default, the timer will start immediately.
You can change this behavior by setting the `immediate` parameter to `False`.
This will delay the first execution of the callback by the given interval.
*Added in version 2.9.0*
''')
def start_immediately_demo():
from datetime import datetime
Expand Down
4 changes: 4 additions & 0 deletions website/documentation/content/user_documentation.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,8 @@ def receive_file(e: events.UploadEventArguments):
doc.text('Autocomplete', '''
The `UserInteraction` object returned by `user.find(...)` provides methods to trigger events on the found elements.
This demo shows how to trigger a "keydown.tab" event to autocomplete an input field.
*Added in version 2.7.0*
''')


Expand All @@ -185,6 +187,8 @@ def trigger_events():
doc.text('Test Downloads', '''
You can verify that a download was triggered by checking `user.downloads.http_responses`.
By awaiting `user.downloads.next()` you can get the next download response.
*Added in version 2.1.0*
''')


Expand Down

0 comments on commit 6739a7d

Please sign in to comment.