|
@@ -7,6 +7,7 @@ import docutils.core
|
|
|
|
|
|
from nicegui import ui
|
|
|
from nicegui.auto_context import Context
|
|
|
+from nicegui.elements.div import Div
|
|
|
from nicegui.task_logger import create_task
|
|
|
|
|
|
REGEX_H4 = re.compile(r'<h4.*?>(.*?)</h4>')
|
|
@@ -315,6 +316,12 @@ To overlay an SVG, make the `viewBox` exactly the size of the image and provide
|
|
|
line_updates = ui.timer(0.1, update_line_plot, active=False)
|
|
|
line_checkbox = ui.checkbox('active').bind_value(line_updates, 'active')
|
|
|
|
|
|
+ with example(ui.linear_progress):
|
|
|
+ ui.linear_progress(value=0.3)
|
|
|
+
|
|
|
+ with example(ui.circular_progress):
|
|
|
+ ui.circular_progress(value=67.0)
|
|
|
+
|
|
|
with example(ui.scene):
|
|
|
with ui.scene(width=225, height=225) as scene:
|
|
|
scene.sphere().material('#4488ff')
|
|
@@ -540,6 +547,13 @@ Just pass a property of the model as parameter to these methods to create the bi
|
|
|
def __init__(self):
|
|
|
self.number = 1
|
|
|
|
|
|
+ @property
|
|
|
+ def progress_float(self) -> float:
|
|
|
+ return (self.number - 1) / 2
|
|
|
+ @property
|
|
|
+ def progress(self) -> int:
|
|
|
+ return int(self.progress_float * 100)
|
|
|
+
|
|
|
demo = Demo()
|
|
|
v = ui.checkbox('visible', value=True)
|
|
|
with ui.column().bind_visibility_from(v, 'value'):
|
|
@@ -547,6 +561,15 @@ Just pass a property of the model as parameter to these methods to create the bi
|
|
|
ui.toggle({1: 'a', 2: 'b', 3: 'c'}).bind_value(demo, 'number')
|
|
|
ui.number().bind_value(demo, 'number')
|
|
|
|
|
|
+ with ui.linear_progress(target_object=demo, target_name='progress_float') as progress:
|
|
|
+ with Div() as progress_lbl:
|
|
|
+ progress_lbl.classes(add='absolute-full flex flex-center')
|
|
|
+ lbl = ui.label(text='number')
|
|
|
+ lbl.classes('text-center text-subtitle2 text-white')
|
|
|
+ lbl.bind_text_from(demo, 'progress')
|
|
|
+
|
|
|
+ ui.circular_progress(target_object=demo, target_name='progress')
|
|
|
+
|
|
|
ui_updates = '''#### UI Updates
|
|
|
|
|
|
NiceGUI tries to automatically synchronize the state of UI elements with the client, e.g. when a label text, an input value or style/classes/props of an element have changed.
|