Rodja Trappe 3 gadi atpakaļ
vecāks
revīzija
49a388b3f9
50 mainītis faili ar 4 papildinājumiem un 182 dzēšanām
  1. 0 1
      LICENSE
  2. 0 29
      main.py
  3. 0 1
      nicegui/config.py
  4. 0 2
      nicegui/elements/bool_element.py
  5. 0 7
      nicegui/elements/button.py
  6. 0 2
      nicegui/elements/card.py
  7. 0 1
      nicegui/elements/checkbox.py
  8. 0 2
      nicegui/elements/choice_element.py
  9. 0 2
      nicegui/elements/column.py
  10. 0 6
      nicegui/elements/custom_example.py
  11. 0 5
      nicegui/elements/custom_view.py
  12. 0 3
      nicegui/elements/dialog.py
  13. 0 10
      nicegui/elements/element.py
  14. 0 3
      nicegui/elements/float_element.py
  15. 0 3
      nicegui/elements/group.py
  16. 0 4
      nicegui/elements/html.py
  17. 0 2
      nicegui/elements/icon.py
  18. 0 7
      nicegui/elements/image.py
  19. 0 1
      nicegui/elements/input.py
  20. 0 6
      nicegui/elements/joystick.py
  21. 0 7
      nicegui/elements/label.py
  22. 0 3
      nicegui/elements/line_plot.py
  23. 0 2
      nicegui/elements/link.py
  24. 0 5
      nicegui/elements/log.py
  25. 0 3
      nicegui/elements/markdown.py
  26. 0 3
      nicegui/elements/menu.py
  27. 0 1
      nicegui/elements/menu_item.py
  28. 0 2
      nicegui/elements/notify.py
  29. 0 2
      nicegui/elements/number.py
  30. 0 1
      nicegui/elements/page.py
  31. 0 3
      nicegui/elements/plot.py
  32. 0 1
      nicegui/elements/radio.py
  33. 0 2
      nicegui/elements/row.py
  34. 0 3
      nicegui/elements/scene.py
  35. 0 1
      nicegui/elements/scene_object3d.py
  36. 0 10
      nicegui/elements/scene_objects.py
  37. 0 3
      nicegui/elements/select.py
  38. 0 1
      nicegui/elements/slider.py
  39. 0 2
      nicegui/elements/string_element.py
  40. 0 7
      nicegui/elements/svg.py
  41. 0 1
      nicegui/elements/switch.py
  42. 0 1
      nicegui/elements/toggle.py
  43. 0 2
      nicegui/elements/upload.py
  44. 0 7
      nicegui/elements/value_element.py
  45. 0 2
      nicegui/lifecycle.py
  46. 0 2
      nicegui/run.py
  47. 4 2
      nicegui/static/templates/local/materialdesignicons/iconfont/README.md
  48. 0 3
      nicegui/timer.py
  49. 0 1
      nicegui/ui.py
  50. 0 2
      nicegui/utils.py

+ 0 - 1
LICENSE

@@ -8,7 +8,6 @@ in the Software without restriction, including without limitation the rights
 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 copies of the Software, and to permit persons to whom the Software is
 copies of the Software, and to permit persons to whom the Software is
 furnished to do so, subject to the following conditions:
 furnished to do so, subject to the following conditions:
-
 The above copyright notice and this permission notice shall be included in all
 The above copyright notice and this permission notice shall be included in all
 copies or substantial portions of the Software.
 copies or substantial portions of the Software.
 
 

+ 0 - 29
main.py

@@ -15,11 +15,9 @@ Element.wp_stack[0].head_html += docutils.core.publish_parts('', writer_name='ht
 
 
 @contextmanager
 @contextmanager
 def example(content: Union[Element, str]):
 def example(content: Union[Element, str]):
-
     callFrame = inspect.currentframe().f_back.f_back
     callFrame = inspect.currentframe().f_back.f_back
     begin = callFrame.f_lineno
     begin = callFrame.f_lineno
     with ui.row().classes('flex w-full'):
     with ui.row().classes('flex w-full'):
-
         if isinstance(content, str):
         if isinstance(content, str):
             ui.markdown(content).classes('mr-8 w-4/12')
             ui.markdown(content).classes('mr-8 w-4/12')
         else:
         else:
@@ -84,7 +82,6 @@ You can also apply [Tailwind](https://tailwindcss.com/) utility classes with the
 If you really need to apply CSS, you can use the `styles` method. Here the delimiter is `;` instead of a blank space.
 If you really need to apply CSS, you can use the `styles` method. Here the delimiter is `;` instead of a blank space.
 '''
 '''
 with example(design):
 with example(design):
-
     ui.radio(['x', 'y', 'z']).props('inline color=green')
     ui.radio(['x', 'y', 'z']).props('inline color=green')
     ui.button().props('icon=touch_app outline round').classes('shadow-lg ml-14')
     ui.button().props('icon=touch_app outline round').classes('shadow-lg ml-14')
 
 
@@ -98,9 +95,7 @@ To define a one-way binding use the `_from` and `_to` variants of these methods.
 Just pass a property of the model as parameter to these methods to create the binding.
 Just pass a property of the model as parameter to these methods to create the binding.
 '''
 '''
 with example(binding):
 with example(binding):
-
     class Demo:
     class Demo:
-
         def __init__(self):
         def __init__(self):
             self.number = 1
             self.number = 1
 
 
@@ -130,17 +125,14 @@ with example(ui.timer):
         ui.timer(interval=0.1, callback=lazy_update)
         ui.timer(interval=0.1, callback=lazy_update)
 
 
 with example(ui.label):
 with example(ui.label):
-
     ui.label('some label')
     ui.label('some label')
 
 
 with example(ui.image):
 with example(ui.image):
-
     ui.image('http://placeimg.com/640/360/tech')
     ui.image('http://placeimg.com/640/360/tech')
     base64 = 'data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAASABIAAD/4QCMRXhpZgAATU0AKgAAAAgABQESAAMAAAABAAEAAAEaAAUAAAABAAAASgEbAAUAAAABAAAAUgEoAAMAAAABAAIAAIdpAAQAAAABAAAAWgAAAAAAAABIAAAAAQAAAEgAAAABAAOgAQADAAAAAQABAACgAgAEAAAAAQAAACKgAwAEAAAAAQAAACMAAAAA/8IAEQgAIwAiAwEiAAIRAQMRAf/EAB8AAAEFAQEBAQEBAAAAAAAAAAMCBAEFAAYHCAkKC//EAMMQAAEDAwIEAwQGBAcGBAgGcwECAAMRBBIhBTETIhAGQVEyFGFxIweBIJFCFaFSM7EkYjAWwXLRQ5I0ggjhU0AlYxc18JNzolBEsoPxJlQ2ZJR0wmDShKMYcOInRTdls1V1pJXDhfLTRnaA40dWZrQJChkaKCkqODk6SElKV1hZWmdoaWp3eHl6hoeIiYqQlpeYmZqgpaanqKmqsLW2t7i5usDExcbHyMnK0NTV1tfY2drg5OXm5+jp6vP09fb3+Pn6/8QAHwEAAwEBAQEBAQEBAQAAAAAAAQIAAwQFBgcICQoL/8QAwxEAAgIBAwMDAgMFAgUCBASHAQACEQMQEiEEIDFBEwUwIjJRFEAGMyNhQhVxUjSBUCSRoUOxFgdiNVPw0SVgwUThcvEXgmM2cCZFVJInotIICQoYGRooKSo3ODk6RkdISUpVVldYWVpkZWZnaGlqc3R1dnd4eXqAg4SFhoeIiYqQk5SVlpeYmZqgo6SlpqeoqaqwsrO0tba3uLm6wMLDxMXGx8jJytDT1NXW19jZ2uDi4+Tl5ufo6ery8/T19vf4+fr/2wBDAAwMDAwMDBUMDBUeFRUVHikeHh4eKTQpKSkpKTQ+NDQ0NDQ0Pj4+Pj4+Pj5LS0tLS0tXV1dXV2JiYmJiYmJiYmL/2wBDAQ8QEBkXGSsXFytnRjlGZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2f/2gAMAwEAAhEDEQAAAeqBgCIareozvbaK3avBqa52teT6He3z0TqCUZa22r//2gAIAQEAAQUCaVVKTjGnLFqSqqlGuciX+87YgM8ScWhAx5KWUJUdJClKadMye6O//9oACAEDEQE/AUxI86A0ynfb/9oACAECEQE/ASaYZBLxpKNinFh2dv8A/9oACAEBAAY/AmUniHVXxfVx7ZIP9x0GlOJdfa+BeVentkSWR66jsI1HUfF+f4l1UykiqR/CypAorg6n/hvuH5nv/8QAMxABAAMAAgICAgIDAQEAAAILAREAITFBUWFxgZGhscHw0RDh8SAwQFBgcICQoLDA0OD/2gAIAQEAAT8hrchP08Nlp8V+7MHK/wCcEXw8q94vkT4K5DD0fpsJBFkwYvy/8cJBuuX7l82UhL9HmlzVKCOfi+3/ADe6Z2jgePxcMYN/xxYQtAu8UCj/ALXDvn/sBxRB/g3/AL//2gAMAwEAAhEDEQAAEE5gPHEUEAP/xAAzEQEBAQADAAECBQUBAQABAQkBABEhMRBBUWEgcfCRgaGx0cHh8TBAUGBwgJCgsMDQ4P/aAAgBAxEBPxAN4PZaNJuOW/g//9oACAECEQE/EAGt2fwmfzBp3X8P/9oACAEBAAE/ELGubg74j5M+RuAgxMrE4g5c4qAjQh1Oh9GL3/xggJDuHs5H2fY1rQIGDISTZ3KuGYzkk8dSkh4Ah8TJ8c0SsIco+yPRD76/486QSwOdnIpjvmvjAQ8pEx4ixlVcDldAdtawTzP5CSqs1wAPeJDMz0nwvHVlRSYTI1ic6b58RUC4kuSTXmFOJuxknJgsgDQMkjQgj/gCBHee6QjzflUA4/5//9k='
     base64 = 'data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAASABIAAD/4QCMRXhpZgAATU0AKgAAAAgABQESAAMAAAABAAEAAAEaAAUAAAABAAAASgEbAAUAAAABAAAAUgEoAAMAAAABAAIAAIdpAAQAAAABAAAAWgAAAAAAAABIAAAAAQAAAEgAAAABAAOgAQADAAAAAQABAACgAgAEAAAAAQAAACKgAwAEAAAAAQAAACMAAAAA/8IAEQgAIwAiAwEiAAIRAQMRAf/EAB8AAAEFAQEBAQEBAAAAAAAAAAMCBAEFAAYHCAkKC//EAMMQAAEDAwIEAwQGBAcGBAgGcwECAAMRBBIhBTETIhAGQVEyFGFxIweBIJFCFaFSM7EkYjAWwXLRQ5I0ggjhU0AlYxc18JNzolBEsoPxJlQ2ZJR0wmDShKMYcOInRTdls1V1pJXDhfLTRnaA40dWZrQJChkaKCkqODk6SElKV1hZWmdoaWp3eHl6hoeIiYqQlpeYmZqgpaanqKmqsLW2t7i5usDExcbHyMnK0NTV1tfY2drg5OXm5+jp6vP09fb3+Pn6/8QAHwEAAwEBAQEBAQEBAQAAAAAAAQIAAwQFBgcICQoL/8QAwxEAAgIBAwMDAgMFAgUCBASHAQACEQMQEiEEIDFBEwUwIjJRFEAGMyNhQhVxUjSBUCSRoUOxFgdiNVPw0SVgwUThcvEXgmM2cCZFVJInotIICQoYGRooKSo3ODk6RkdISUpVVldYWVpkZWZnaGlqc3R1dnd4eXqAg4SFhoeIiYqQk5SVlpeYmZqgo6SlpqeoqaqwsrO0tba3uLm6wMLDxMXGx8jJytDT1NXW19jZ2uDi4+Tl5ufo6ery8/T19vf4+fr/2wBDAAwMDAwMDBUMDBUeFRUVHikeHh4eKTQpKSkpKTQ+NDQ0NDQ0Pj4+Pj4+Pj5LS0tLS0tXV1dXV2JiYmJiYmJiYmL/2wBDAQ8QEBkXGSsXFytnRjlGZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2f/2gAMAwEAAhEDEQAAAeqBgCIareozvbaK3avBqa52teT6He3z0TqCUZa22r//2gAIAQEAAQUCaVVKTjGnLFqSqqlGuciX+87YgM8ScWhAx5KWUJUdJClKadMye6O//9oACAEDEQE/AUxI86A0ynfb/9oACAECEQE/ASaYZBLxpKNinFh2dv8A/9oACAEBAAY/AmUniHVXxfVx7ZIP9x0GlOJdfa+BeVentkSWR66jsI1HUfF+f4l1UykiqR/CypAorg6n/hvuH5nv/8QAMxABAAMAAgICAgIDAQEAAAILAREAITFBUWFxgZGhscHw0RDh8SAwQFBgcICQoLDA0OD/2gAIAQEAAT8hrchP08Nlp8V+7MHK/wCcEXw8q94vkT4K5DD0fpsJBFkwYvy/8cJBuuX7l82UhL9HmlzVKCOfi+3/ADe6Z2jgePxcMYN/xxYQtAu8UCj/ALXDvn/sBxRB/g3/AL//2gAMAwEAAhEDEQAAEE5gPHEUEAP/xAAzEQEBAQADAAECBQUBAQABAQkBABEhMRBBUWEgcfCRgaGx0cHh8TBAUGBwgJCgsMDQ4P/aAAgBAxEBPxAN4PZaNJuOW/g//9oACAECEQE/EAGt2fwmfzBp3X8P/9oACAEBAAE/ELGubg74j5M+RuAgxMrE4g5c4qAjQh1Oh9GL3/xggJDuHs5H2fY1rQIGDISTZ3KuGYzkk8dSkh4Ah8TJ8c0SsIco+yPRD76/486QSwOdnIpjvmvjAQ8pEx4ixlVcDldAdtawTzP5CSqs1wAPeJDMz0nwvHVlRSYTI1ic6b58RUC4kuSTXmFOJuxknJgsgDQMkjQgj/gCBHee6QjzflUA4/5//9k='
     ui.image(base64).style('width:30px')
     ui.image(base64).style('width:30px')
 
 
 with example(ui.svg):
 with example(ui.svg):
-
     svg_content = '''
     svg_content = '''
         <svg viewBox="0 0 200 200" width="100" height="100" xmlns="http://www.w3.org/2000/svg">
         <svg viewBox="0 0 200 200" width="100" height="100" xmlns="http://www.w3.org/2000/svg">
         <circle cx="100" cy="100" r="78" fill="yellow" stroke="black" stroke-width="3" />
         <circle cx="100" cy="100" r="78" fill="yellow" stroke="black" stroke-width="3" />
@@ -158,7 +150,6 @@ Use [Quasar classes](https://quasar.dev/vue-components/img) for positioning and
 To overlay an svg, make the `viewBox` exactly the size of the image and provide `100%` width/height to match the actual rendered size.
 To overlay an svg, make the `viewBox` exactly the size of the image and provide `100%` width/height to match the actual rendered size.
 '''
 '''
 with example(overlay):
 with example(overlay):
-
     with ui.image('http://placeimg.com/640/360/nature'):
     with ui.image('http://placeimg.com/640/360/nature'):
         ui.label('nice').classes('absolute-bottom text-subtitle2 text-center')
         ui.label('nice').classes('absolute-bottom text-subtitle2 text-center')
 
 
@@ -170,15 +161,12 @@ with example(overlay):
         ui.svg(svg_content).style('background:transparent')
         ui.svg(svg_content).style('background:transparent')
 
 
 with example(ui.markdown):
 with example(ui.markdown):
-
     ui.markdown('### Headline\nWith hyperlink to [GitHub](https://github.com/zauberzeug/nicegui).')
     ui.markdown('### Headline\nWith hyperlink to [GitHub](https://github.com/zauberzeug/nicegui).')
 
 
 with example(ui.html):
 with example(ui.html):
-
     ui.html('<p>demo paragraph in <strong>html</strong></p>')
     ui.html('<p>demo paragraph in <strong>html</strong></p>')
 
 
 with example(ui.button):
 with example(ui.button):
-
     def button_increment():
     def button_increment():
         global button_count
         global button_count
         button_count += 1
         button_count += 1
@@ -189,26 +177,22 @@ with example(ui.button):
     button_result = ui.label('pressed: 0')
     button_result = ui.label('pressed: 0')
 
 
 with example(ui.checkbox):
 with example(ui.checkbox):
-
     ui.checkbox('check me', on_change=lambda e: checkbox_state.set_text(e.value))
     ui.checkbox('check me', on_change=lambda e: checkbox_state.set_text(e.value))
     with ui.row():
     with ui.row():
         ui.label('the checkbox is:')
         ui.label('the checkbox is:')
         checkbox_state = ui.label('False')
         checkbox_state = ui.label('False')
 
 
 with example(ui.switch):
 with example(ui.switch):
-
     ui.switch('switch me', on_change=lambda e: switch_state.set_text("ON" if e.value else'OFF'))
     ui.switch('switch me', on_change=lambda e: switch_state.set_text("ON" if e.value else'OFF'))
     with ui.row():
     with ui.row():
         ui.label('the switch is:')
         ui.label('the switch is:')
         switch_state = ui.label('OFF')
         switch_state = ui.label('OFF')
 
 
 with example(ui.slider):
 with example(ui.slider):
-
     slider = ui.slider(min=0, max=100, value=50).props('label')
     slider = ui.slider(min=0, max=100, value=50).props('label')
     ui.label().bind_text_from(slider.value)
     ui.label().bind_text_from(slider.value)
 
 
 with example(ui.input):
 with example(ui.input):
-
     ui.input(
     ui.input(
         label='Text',
         label='Text',
         placeholder='press ENTER to apply',
         placeholder='press ENTER to apply',
@@ -217,30 +201,25 @@ with example(ui.input):
     result = ui.label('')
     result = ui.label('')
 
 
 with example(ui.number):
 with example(ui.number):
-
     number_input = ui.number(label='Number', value=3.1415927, format='%.2f')
     number_input = ui.number(label='Number', value=3.1415927, format='%.2f')
     with ui.row():
     with ui.row():
         ui.label('underlying value: ')
         ui.label('underlying value: ')
         ui.label().bind_text_from(number_input.value)
         ui.label().bind_text_from(number_input.value)
 
 
 with example(ui.radio):
 with example(ui.radio):
-
     radio = ui.radio([1, 2, 3], value=1).props('inline')
     radio = ui.radio([1, 2, 3], value=1).props('inline')
     ui.radio({1: 'A', 2: 'B', 3: 'C'}, value=1).props('inline').bind_value(radio.value)
     ui.radio({1: 'A', 2: 'B', 3: 'C'}, value=1).props('inline').bind_value(radio.value)
 
 
 with example(ui.toggle):
 with example(ui.toggle):
-
     toggle = ui.toggle([1, 2, 3], value=1)
     toggle = ui.toggle([1, 2, 3], value=1)
     ui.toggle({1: 'A', 2: 'B', 3: 'C'}, value=1).bind_value(toggle.value)
     ui.toggle({1: 'A', 2: 'B', 3: 'C'}, value=1).bind_value(toggle.value)
 
 
 with example(ui.select):
 with example(ui.select):
-
     with ui.row():
     with ui.row():
         select = ui.select([1, 2, 3], value=1).props('inline')
         select = ui.select([1, 2, 3], value=1).props('inline')
         ui.select({1: 'One', 2: 'Two', 3: 'Three'}, value=1).props('inline').bind_value(select.value)
         ui.select({1: 'One', 2: 'Two', 3: 'Three'}, value=1).props('inline').bind_value(select.value)
 
 
 with example(ui.upload):
 with example(ui.upload):
-
     ui.upload(on_upload=lambda files: content.set_text(files))
     ui.upload(on_upload=lambda files: content.set_text(files))
     content = ui.label()
     content = ui.label()
 
 
@@ -256,7 +235,6 @@ with example(ui.plot):
         plt.ylabel('Damped oscillation')
         plt.ylabel('Damped oscillation')
 
 
 with example(ui.line_plot):
 with example(ui.line_plot):
-
     lines = ui.line_plot(n=2, limit=20, figsize=(2.5, 1.8)).with_legend(['sin', 'cos'], loc='upper center', ncol=2)
     lines = ui.line_plot(n=2, limit=20, figsize=(2.5, 1.8)).with_legend(['sin', 'cos'], loc='upper center', ncol=2)
     line_updates = ui.timer(0.1, lambda: lines.push([datetime.now()], [
     line_updates = ui.timer(0.1, lambda: lines.push([datetime.now()], [
         [np.sin(datetime.now().timestamp()) + 0.02 * np.random.randn()],
         [np.sin(datetime.now().timestamp()) + 0.02 * np.random.randn()],
@@ -271,7 +249,6 @@ with example(ui.log):
     ui.button('Log time', on_click=lambda: log.push(datetime.now().strftime("%X.%f")[:-5]))
     ui.button('Log time', on_click=lambda: log.push(datetime.now().strftime("%X.%f")[:-5]))
 
 
 with example(ui.scene):
 with example(ui.scene):
-
     with ui.scene(width=200, height=200) as scene:
     with ui.scene(width=200, height=200) as scene:
         scene.sphere().material('#4488ff')
         scene.sphere().material('#4488ff')
         scene.cylinder(1, 0.5, 2, 20).material('#ff8800', opacity=0.5).move(-2, 1)
         scene.cylinder(1, 0.5, 2, 20).material('#ff8800', opacity=0.5).move(-2, 1)
@@ -292,7 +269,6 @@ with example(ui.scene):
         scene.stl(teapot).scale(0.2).move(-3, 4)
         scene.stl(teapot).scale(0.2).move(-3, 4)
 
 
 with example(ui.joystick):
 with example(ui.joystick):
-
     ui.joystick(
     ui.joystick(
         color='blue',
         color='blue',
         size=50,
         size=50,
@@ -301,7 +277,6 @@ with example(ui.joystick):
     coordinates = ui.label('0, 0')
     coordinates = ui.label('0, 0')
 
 
 with example(ui.dialog):
 with example(ui.dialog):
-
     with ui.dialog() as dialog:
     with ui.dialog() as dialog:
         with ui.card():
         with ui.card():
             ui.label('Hello world!')
             ui.label('Hello world!')
@@ -310,7 +285,6 @@ with example(ui.dialog):
     ui.button('Open dialog', on_click=dialog.open)
     ui.button('Open dialog', on_click=dialog.open)
 
 
 with example(ui.menu):
 with example(ui.menu):
-
     choice = ui.label('Try the menu.')
     choice = ui.label('Try the menu.')
     with ui.menu() as menu:
     with ui.menu() as menu:
         ui.menu_item('Menu item 1', lambda: choice.set_text('Selected item 1.'))
         ui.menu_item('Menu item 1', lambda: choice.set_text('Selected item 1.'))
@@ -320,7 +294,6 @@ with example(ui.menu):
     ui.button('Open menu', on_click=menu.open).props('color=secondary')
     ui.button('Open menu', on_click=menu.open).props('color=secondary')
 
 
 with example(ui.notify):
 with example(ui.notify):
-
     ui.button('Show notification', on_click=lambda: ui.notify('Some message', close_button='OK'))
     ui.button('Show notification', on_click=lambda: ui.notify('Some message', close_button='OK'))
 
 
 lifecycle = '''### Lifecycle
 lifecycle = '''### Lifecycle
@@ -330,7 +303,6 @@ If NiceGUI is shut down or restarted, the tasks will be automatically canceled (
 You can also execute cleanup code with `ui.on_shutdown`.
 You can also execute cleanup code with `ui.on_shutdown`.
 '''
 '''
 with example(lifecycle):
 with example(lifecycle):
-
     with ui.row() as row:
     with ui.row() as row:
         ui.label('count:')
         ui.label('count:')
         count_label = ui.label('0')
         count_label = ui.label('0')
@@ -347,7 +319,6 @@ with example(lifecycle):
     ui.on_startup(counter())
     ui.on_startup(counter())
 
 
 with example(ui.page):
 with example(ui.page):
-
     with ui.page('/other_page') as other:
     with ui.page('/other_page') as other:
         ui.label('Welcome to the other side')
         ui.label('Welcome to the other side')
         ui.link('Back to main page', '/')
         ui.link('Back to main page', '/')

+ 0 - 1
nicegui/config.py

@@ -4,7 +4,6 @@ import ast
 import os
 import os
 
 
 class Config(BaseModel):
 class Config(BaseModel):
-
     # NOTE: should be in sync with ui.run arguments
     # NOTE: should be in sync with ui.run arguments
     host: str = '0.0.0.0'
     host: str = '0.0.0.0'
     port: int = 80
     port: int = 80

+ 0 - 2
nicegui/elements/bool_element.py

@@ -3,12 +3,10 @@ from typing import Callable
 from .value_element import ValueElement
 from .value_element import ValueElement
 
 
 class BoolElement(ValueElement):
 class BoolElement(ValueElement):
-
     def __init__(self,
     def __init__(self,
                  view: jp.HTMLBaseComponent,
                  view: jp.HTMLBaseComponent,
                  *,
                  *,
                  value: bool,
                  value: bool,
                  on_change: Callable,
                  on_change: Callable,
                  ):
                  ):
-
         super().__init__(view, value=value, on_change=on_change)
         super().__init__(view, value=value, on_change=on_change)

+ 0 - 7
nicegui/elements/button.py

@@ -4,7 +4,6 @@ from .element import Element
 from ..utils import handle_exceptions, provide_arguments
 from ..utils import handle_exceptions, provide_arguments
 
 
 class Button(Element):
 class Button(Element):
-
     def __init__(self,
     def __init__(self,
                  text: str = '',
                  text: str = '',
                  *,
                  *,
@@ -25,29 +24,23 @@ class Button(Element):
 
 
     @property
     @property
     def text(self):
     def text(self):
-
         return self.view.label
         return self.view.label
 
 
     @text.setter
     @text.setter
     def text(self, text: any):
     def text(self, text: any):
-
         self.view.label = text
         self.view.label = text
 
 
     def set_text(self, text: str):
     def set_text(self, text: str):
-
         self.text = text
         self.text = text
 
 
     def bind_text_to(self, target, forward=lambda x: x):
     def bind_text_to(self, target, forward=lambda x: x):
-
         self.text.bind_to(target, forward=forward, nesting=1)
         self.text.bind_to(target, forward=forward, nesting=1)
         return self
         return self
 
 
     def bind_text_from(self, target, backward=lambda x: x):
     def bind_text_from(self, target, backward=lambda x: x):
-
         self.text.bind_from(target, backward=backward, nesting=1)
         self.text.bind_from(target, backward=backward, nesting=1)
         return self
         return self
 
 
     def bind_text(self, target, forward=lambda x: x, backward=lambda x: x):
     def bind_text(self, target, forward=lambda x: x, backward=lambda x: x):
-
         self.text.bind(target, forward=forward, backward=backward, nesting=1)
         self.text.bind(target, forward=forward, backward=backward, nesting=1)
         return self
         return self

+ 0 - 2
nicegui/elements/card.py

@@ -2,9 +2,7 @@ import justpy as jp
 from .group import Group
 from .group import Group
 
 
 class Card(Group):
 class Card(Group):
-
     def __init__(self):
     def __init__(self):
-
         view = jp.QCard(classes='column items-start q-pa-md', style='gap: 1em', delete_flag=False)
         view = jp.QCard(classes='column items-start q-pa-md', style='gap: 1em', delete_flag=False)
 
 
         super().__init__(view)
         super().__init__(view)

+ 0 - 1
nicegui/elements/checkbox.py

@@ -3,7 +3,6 @@ import justpy as jp
 from .bool_element import BoolElement
 from .bool_element import BoolElement
 
 
 class Checkbox(BoolElement):
 class Checkbox(BoolElement):
-
     def __init__(self,
     def __init__(self,
                  text: str = '',
                  text: str = '',
                  *,
                  *,

+ 0 - 2
nicegui/elements/choice_element.py

@@ -3,14 +3,12 @@ from typing import Any, Union, List, Dict, Callable
 from .value_element import ValueElement
 from .value_element import ValueElement
 
 
 class ChoiceElement(ValueElement):
 class ChoiceElement(ValueElement):
-
     def __init__(self,
     def __init__(self,
                  view: jp.HTMLBaseComponent,
                  view: jp.HTMLBaseComponent,
                  options: Union[List, Dict],
                  options: Union[List, Dict],
                  *,
                  *,
                  value: Any,
                  value: Any,
                  on_change: Callable):
                  on_change: Callable):
-
         if isinstance(options, list):
         if isinstance(options, list):
             view.options = [{'label': option, 'value': option} for option in options]
             view.options = [{'label': option, 'value': option} for option in options]
         else:
         else:

+ 0 - 2
nicegui/elements/column.py

@@ -2,9 +2,7 @@ import justpy as jp
 from .group import Group
 from .group import Group
 
 
 class Column(Group):
 class Column(Group):
-
     def __init__(self):
     def __init__(self):
-
         view = jp.QDiv(classes='column items-start', style='gap: 1em', delete_flag=False)
         view = jp.QDiv(classes='column items-start', style='gap: 1em', delete_flag=False)
 
 
         super().__init__(view)
         super().__init__(view)

+ 0 - 6
nicegui/elements/custom_example.py

@@ -2,9 +2,7 @@ from .custom_view import CustomView
 from .element import Element
 from .element import Element
 
 
 class CustomExampleView(CustomView):
 class CustomExampleView(CustomView):
-
     def __init__(self, on_change):
     def __init__(self, on_change):
-
         super().__init__('custom_example', __file__, value=0)
         super().__init__('custom_example', __file__, value=0)
 
 
         self.on_change = on_change
         self.on_change = on_change
@@ -12,19 +10,15 @@ class CustomExampleView(CustomView):
         self.initialize(temp=False, onAdd=self.handle_add)
         self.initialize(temp=False, onAdd=self.handle_add)
 
 
     def handle_add(self, msg):
     def handle_add(self, msg):
-
         self.options.value += msg.number
         self.options.value += msg.number
         if self.on_change is not None:
         if self.on_change is not None:
             return self.on_change(self.options.value)
             return self.on_change(self.options.value)
         return False
         return False
 
 
 class CustomExample(Element):
 class CustomExample(Element):
-
     def __init__(self, *, on_change=None):
     def __init__(self, *, on_change=None):
-
         super().__init__(CustomExampleView(on_change))
         super().__init__(CustomExampleView(on_change))
 
 
     def add(self, number: str):
     def add(self, number: str):
-
         self.view.options.value += number
         self.view.options.value += number
         self.view.on_change(self.view.options.value)
         self.view.on_change(self.view.options.value)

+ 0 - 5
nicegui/elements/custom_view.py

@@ -4,11 +4,9 @@ from starlette.routing import Route
 from starlette.responses import FileResponse
 from starlette.responses import FileResponse
 
 
 class CustomView(jp.JustpyBaseComponent):
 class CustomView(jp.JustpyBaseComponent):
-
     vue_dependencies = []
     vue_dependencies = []
 
 
     def __init__(self, vue_type, filepath, dependencies=[], **options):
     def __init__(self, vue_type, filepath, dependencies=[], **options):
-
         self.vue_type = vue_type
         self.vue_type = vue_type
         self.vue_filepath = os.path.realpath(filepath).replace('.py', '.js')
         self.vue_filepath = os.path.realpath(filepath).replace('.py', '.js')
         self.vue_dependencies = dependencies
         self.vue_dependencies = dependencies
@@ -21,7 +19,6 @@ class CustomView(jp.JustpyBaseComponent):
         super().__init__(temp=False)
         super().__init__(temp=False)
 
 
     def add_page(self, wp: jp.WebPage):
     def add_page(self, wp: jp.WebPage):
-
         for dependency in self.vue_dependencies:
         for dependency in self.vue_dependencies:
             is_remote = dependency.startswith('http://') or dependency.startswith('https://')
             is_remote = dependency.startswith('http://') or dependency.startswith('https://')
             src = dependency if is_remote else f'lib/{dependency}'
             src = dependency if is_remote else f'lib/{dependency}'
@@ -40,11 +37,9 @@ class CustomView(jp.JustpyBaseComponent):
         super().add_page(wp)
         super().add_page(wp)
 
 
     def react(self, _):
     def react(self, _):
-
         pass
         pass
 
 
     def convert_object_to_dict(self):
     def convert_object_to_dict(self):
-
         return {
         return {
             'vue_type': self.vue_type,
             'vue_type': self.vue_type,
             'id': self.id,
             'id': self.id,

+ 0 - 3
nicegui/elements/dialog.py

@@ -2,7 +2,6 @@ import justpy as jp
 from .group import Group
 from .group import Group
 
 
 class Dialog(Group):
 class Dialog(Group):
-
     def __init__(self,
     def __init__(self,
                  *,
                  *,
                  value: bool = False
                  value: bool = False
@@ -23,9 +22,7 @@ class Dialog(Group):
         super().__init__(view)
         super().__init__(view)
 
 
     def open(self):
     def open(self):
-
         self.view.value = True
         self.view.value = True
 
 
     def close(self):
     def close(self):
-
         self.view.value = False
         self.view.value = False

+ 0 - 10
nicegui/elements/element.py

@@ -2,7 +2,6 @@ import justpy as jp
 from binding.binding import BindableProperty
 from binding.binding import BindableProperty
 
 
 class Element:
 class Element:
-
     wp_stack = []
     wp_stack = []
     view_stack = []
     view_stack = []
 
 
@@ -11,7 +10,6 @@ class Element:
     def __init__(self,
     def __init__(self,
                  view: jp.HTMLBaseComponent,
                  view: jp.HTMLBaseComponent,
                  ):
                  ):
-
         self.parent_view = self.view_stack[-1]
         self.parent_view = self.view_stack[-1]
         self.parent_view.add(view)
         self.parent_view.add(view)
         self.view = view
         self.view = view
@@ -22,22 +20,18 @@ class Element:
 
 
     @property
     @property
     def visible(self):
     def visible(self):
-
         return self.visible_
         return self.visible_
 
 
     @visible.setter
     @visible.setter
     def visible(self, visible: bool):
     def visible(self, visible: bool):
-
         self.visible_ = visible
         self.visible_ = visible
         (self.view.remove_class if self.visible_ else self.view.set_class)('hidden')
         (self.view.remove_class if self.visible_ else self.view.set_class)('hidden')
 
 
     def bind_visibility_to(self, target, forward=lambda x: x):
     def bind_visibility_to(self, target, forward=lambda x: x):
-
         self.visible.bind_to(target, forward=forward, nesting=1)
         self.visible.bind_to(target, forward=forward, nesting=1)
         return self
         return self
 
 
     def bind_visibility_from(self, target, backward=lambda x: x, *, value=None):
     def bind_visibility_from(self, target, backward=lambda x: x, *, value=None):
-
         if value is not None:
         if value is not None:
             def backward(x): return x == value
             def backward(x): return x == value
 
 
@@ -45,7 +39,6 @@ class Element:
         return self
         return self
 
 
     def bind_visibility(self, target, forward=lambda x: x, backward=None, *, value=None):
     def bind_visibility(self, target, forward=lambda x: x, backward=None, *, value=None):
-
         if value is not None:
         if value is not None:
             def backward(x): return x == value
             def backward(x): return x == value
 
 
@@ -53,7 +46,6 @@ class Element:
         return self
         return self
 
 
     def classes(self, add: str = '', *, remove: str = '', replace: str = ''):
     def classes(self, add: str = '', *, remove: str = '', replace: str = ''):
-
         class_list = [] if replace else self.view.classes.split()
         class_list = [] if replace else self.view.classes.split()
         class_list = [c for c in class_list if c not in remove]
         class_list = [c for c in class_list if c not in remove]
         class_list += add.split()
         class_list += add.split()
@@ -63,7 +55,6 @@ class Element:
         return self
         return self
 
 
     def style(self, add: str = '', *, remove: str = '', replace: str = ''):
     def style(self, add: str = '', *, remove: str = '', replace: str = ''):
-
         style_list = [] if replace else self.view.style.split(';')
         style_list = [] if replace else self.view.style.split(';')
         style_list = [c for c in style_list if c not in remove.split(';')]
         style_list = [c for c in style_list if c not in remove.split(';')]
         style_list += add.split(';')
         style_list += add.split(';')
@@ -73,7 +64,6 @@ class Element:
         return self
         return self
 
 
     def props(self, add: str = '', *, remove: str = '', replace: str = ''):
     def props(self, add: str = '', *, remove: str = '', replace: str = ''):
-
         for prop in remove.split() + replace.split():
         for prop in remove.split() + replace.split():
             setattr(self.view, prop.split('=')[0], None)
             setattr(self.view, prop.split('=')[0], None)
 
 

+ 0 - 3
nicegui/elements/float_element.py

@@ -3,7 +3,6 @@ from typing import Callable
 from .value_element import ValueElement
 from .value_element import ValueElement
 
 
 class FloatElement(ValueElement):
 class FloatElement(ValueElement):
-
     def __init__(self,
     def __init__(self,
                  view: jp.HTMLBaseComponent,
                  view: jp.HTMLBaseComponent,
                  *,
                  *,
@@ -11,13 +10,11 @@ class FloatElement(ValueElement):
                  format: str = None,
                  format: str = None,
                  on_change: Callable,
                  on_change: Callable,
                  ):
                  ):
-
         self.format = format
         self.format = format
 
 
         super().__init__(view, value=value, on_change=on_change)
         super().__init__(view, value=value, on_change=on_change)
 
 
     def value_to_view(self, value: float):
     def value_to_view(self, value: float):
-
         if value is None:
         if value is None:
             return None
             return None
         elif self.format is None:
         elif self.format is None:

+ 0 - 3
nicegui/elements/group.py

@@ -1,12 +1,9 @@
 from .element import Element
 from .element import Element
 
 
 class Group(Element):
 class Group(Element):
-
     def __enter__(self):
     def __enter__(self):
-
         self.view_stack.append(self.view)
         self.view_stack.append(self.view)
         return self
         return self
 
 
     def __exit__(self, *_):
     def __exit__(self, *_):
-
         self.view_stack.pop()
         self.view_stack.pop()

+ 0 - 4
nicegui/elements/html.py

@@ -2,7 +2,6 @@ import justpy as jp
 from .element import Element
 from .element import Element
 
 
 class Html(Element):
 class Html(Element):
-
     def __init__(self,
     def __init__(self,
                  content: str = '',
                  content: str = '',
                  ):
                  ):
@@ -19,14 +18,11 @@ class Html(Element):
 
 
     @property
     @property
     def content(self):
     def content(self):
-
         return self.content.inner_html
         return self.content.inner_html
 
 
     @content.setter
     @content.setter
     def content(self, content: any):
     def content(self, content: any):
-
         self.set_content(content)
         self.set_content(content)
 
 
     def set_content(self, content: str):
     def set_content(self, content: str):
-
         self.view.inner_html = content
         self.view.inner_html = content

+ 0 - 2
nicegui/elements/icon.py

@@ -2,11 +2,9 @@ import justpy as jp
 from .element import Element
 from .element import Element
 
 
 class Icon(Element):
 class Icon(Element):
-
     def __init__(self,
     def __init__(self,
                  name: str,
                  name: str,
                  ):
                  ):
-
         view = jp.QIcon(name=name, classes=f'q-pt-xs', size='20px')
         view = jp.QIcon(name=name, classes=f'q-pt-xs', size='20px')
 
 
         super().__init__(view)
         super().__init__(view)

+ 0 - 7
nicegui/elements/image.py

@@ -2,7 +2,6 @@ import justpy as jp
 from .group import Group
 from .group import Group
 
 
 class Image(Group):
 class Image(Group):
-
     def __init__(self,
     def __init__(self,
                  source: str = '',
                  source: str = '',
                  ):
                  ):
@@ -19,29 +18,23 @@ class Image(Group):
 
 
     @property
     @property
     def source(self):
     def source(self):
-
         return self.view.src
         return self.view.src
 
 
     @source.setter
     @source.setter
     def source(self, source: any):
     def source(self, source: any):
-
         self.view.src = source
         self.view.src = source
 
 
     def set_source(self, source: str):
     def set_source(self, source: str):
-
         self.source = source
         self.source = source
 
 
     def bind_source_to(self, target, forward=lambda x: x):
     def bind_source_to(self, target, forward=lambda x: x):
-
         self.source.bind_to(target, forward=forward, nesting=1)
         self.source.bind_to(target, forward=forward, nesting=1)
         return self
         return self
 
 
     def bind_source_from(self, target, backward=lambda x: x):
     def bind_source_from(self, target, backward=lambda x: x):
-
         self.source.bind_from(target, backward=backward, nesting=1)
         self.source.bind_from(target, backward=backward, nesting=1)
         return self
         return self
 
 
     def bind_source(self, target, forward=lambda x: x, backward=lambda x: x):
     def bind_source(self, target, forward=lambda x: x, backward=lambda x: x):
-
         self.source.bind(target, forward=forward, backward=backward, nesting=1)
         self.source.bind(target, forward=forward, backward=backward, nesting=1)
         return self
         return self

+ 0 - 1
nicegui/elements/input.py

@@ -3,7 +3,6 @@ from typing import Callable
 from .string_element import StringElement
 from .string_element import StringElement
 
 
 class Input(StringElement):
 class Input(StringElement):
-
     def __init__(self,
     def __init__(self,
                  label: str = None,
                  label: str = None,
                  *,
                  *,

+ 0 - 6
nicegui/elements/joystick.py

@@ -3,9 +3,7 @@ from .custom_view import CustomView
 from .element import Element
 from .element import Element
 
 
 class JoystickView(CustomView):
 class JoystickView(CustomView):
-
     def __init__(self, on_start, on_move, on_end, **options):
     def __init__(self, on_start, on_move, on_end, **options):
-
         super().__init__('joystick', __file__, ['nipplejs.min.js'], **options)
         super().__init__('joystick', __file__, ['nipplejs.min.js'], **options)
 
 
         self.on_start = on_start
         self.on_start = on_start
@@ -18,25 +16,21 @@ class JoystickView(CustomView):
                         onEnd=self.handle_end)
                         onEnd=self.handle_end)
 
 
     def handle_start(self, msg):
     def handle_start(self, msg):
-
         if self.on_start is not None:
         if self.on_start is not None:
             return self.on_start(msg)
             return self.on_start(msg)
         return False
         return False
 
 
     def handle_move(self, msg):
     def handle_move(self, msg):
-
         if self.on_move is not None:
         if self.on_move is not None:
             return self.on_move(msg)
             return self.on_move(msg)
         return False
         return False
 
 
     def handle_end(self, msg):
     def handle_end(self, msg):
-
         if self.on_end is not None:
         if self.on_end is not None:
             return self.on_end(msg)
             return self.on_end(msg)
         return False
         return False
 
 
 class Joystick(Element):
 class Joystick(Element):
-
     def __init__(self,
     def __init__(self,
                  *,
                  *,
                  on_start: Callable = None,
                  on_start: Callable = None,

+ 0 - 7
nicegui/elements/label.py

@@ -2,7 +2,6 @@ import justpy as jp
 from .element import Element
 from .element import Element
 
 
 class Label(Element):
 class Label(Element):
-
     def __init__(self,
     def __init__(self,
                  text: str = '',
                  text: str = '',
                  ):
                  ):
@@ -19,29 +18,23 @@ class Label(Element):
 
 
     @property
     @property
     def text(self):
     def text(self):
-
         return self.view.text
         return self.view.text
 
 
     @text.setter
     @text.setter
     def text(self, text: any):
     def text(self, text: any):
-
         self.view.text = text
         self.view.text = text
 
 
     def set_text(self, text: str):
     def set_text(self, text: str):
-
         self.text = text
         self.text = text
 
 
     def bind_text_to(self, target, forward=lambda x: x):
     def bind_text_to(self, target, forward=lambda x: x):
-
         self.text.bind_to(target, forward=forward, nesting=1)
         self.text.bind_to(target, forward=forward, nesting=1)
         return self
         return self
 
 
     def bind_text_from(self, target, backward=lambda x: x):
     def bind_text_from(self, target, backward=lambda x: x):
-
         self.text.bind_from(target, backward=backward, nesting=1)
         self.text.bind_from(target, backward=backward, nesting=1)
         return self
         return self
 
 
     def bind_text(self, target, forward=lambda x: x, backward=lambda x: x):
     def bind_text(self, target, forward=lambda x: x, backward=lambda x: x):
-
         self.text.bind(target, forward=forward, backward=backward, nesting=1)
         self.text.bind(target, forward=forward, backward=backward, nesting=1)
         return self
         return self

+ 0 - 3
nicegui/elements/line_plot.py

@@ -2,7 +2,6 @@ from typing import List
 from .plot import Plot
 from .plot import Plot
 
 
 class LinePlot(Plot):
 class LinePlot(Plot):
-
     def __init__(self,
     def __init__(self,
                  *,
                  *,
                  n: int = 1,
                  n: int = 1,
@@ -32,13 +31,11 @@ class LinePlot(Plot):
         self.push_counter = 0
         self.push_counter = 0
 
 
     def with_legend(self, titles: List[str], **kwargs):
     def with_legend(self, titles: List[str], **kwargs):
-
         self.fig.gca().legend(titles, **kwargs)
         self.fig.gca().legend(titles, **kwargs)
         self.view.set_figure(self.fig)
         self.view.set_figure(self.fig)
         return self
         return self
 
 
     def push(self, x: List[float], Y: List[List[float]]):
     def push(self, x: List[float], Y: List[List[float]]):
-
         self.push_counter += 1
         self.push_counter += 1
 
 
         self.x = [*self.x, *x][self.slice]
         self.x = [*self.x, *x][self.slice]

+ 0 - 2
nicegui/elements/link.py

@@ -2,12 +2,10 @@ import justpy as jp
 from .element import Element
 from .element import Element
 
 
 class Link(Element):
 class Link(Element):
-
     def __init__(self,
     def __init__(self,
                  text: str = '',
                  text: str = '',
                  href: str = '#',
                  href: str = '#',
                  ):
                  ):
-
         view = jp.A(text=text, href=href, classes='underline text-blue')
         view = jp.A(text=text, href=href, classes='underline text-blue')
 
 
         super().__init__(view)
         super().__init__(view)

+ 0 - 5
nicegui/elements/log.py

@@ -5,13 +5,10 @@ from .custom_view import CustomView
 from .element import Element
 from .element import Element
 
 
 class LogView(CustomView):
 class LogView(CustomView):
-
     def __init__(self, max_lines: int):
     def __init__(self, max_lines: int):
-
         super().__init__('log', __file__, max_lines=max_lines)
         super().__init__('log', __file__, max_lines=max_lines)
 
 
 class Log(Element):
 class Log(Element):
-
     def __init__(self, max_lines: int = None):
     def __init__(self, max_lines: int = None):
         """Log view
         """Log view
 
 
@@ -25,12 +22,10 @@ class Log(Element):
         self.classes('border whitespace-pre font-mono').style('opacity: 1 !important; cursor: text !important')
         self.classes('border whitespace-pre font-mono').style('opacity: 1 !important; cursor: text !important')
 
 
     async def push_async(self, line: str):
     async def push_async(self, line: str):
-
         await asyncio.gather(*[
         await asyncio.gather(*[
             self.view.run_method(f'push("{urllib.parse.quote(line)}")', socket)
             self.view.run_method(f'push("{urllib.parse.quote(line)}")', socket)
             for socket in WebPage.sockets[self.page.page_id].values()
             for socket in WebPage.sockets[self.page.page_id].values()
         ])
         ])
 
 
     def push(self, line: str):
     def push(self, line: str):
-
         asyncio.get_event_loop().create_task(self.push_async(line))
         asyncio.get_event_loop().create_task(self.push_async(line))

+ 0 - 3
nicegui/elements/markdown.py

@@ -3,7 +3,6 @@ from .html import Html
 import re
 import re
 
 
 class Markdown(Html):
 class Markdown(Html):
-
     def __init__(self,
     def __init__(self,
                  content: str = '',
                  content: str = '',
                  ):
                  ):
@@ -17,7 +16,6 @@ class Markdown(Html):
         super().__init__(content)
         super().__init__(content)
 
 
     def set_content(self, content: str):
     def set_content(self, content: str):
-
         html = markdown2.markdown(content, extras=['fenced-code-blocks'])
         html = markdown2.markdown(content, extras=['fenced-code-blocks'])
         # we need explicit markdown styling because tailwind css removes all default styles
         # we need explicit markdown styling because tailwind css removes all default styles
         html = Markdown.apply_tailwind(html)
         html = Markdown.apply_tailwind(html)
@@ -25,7 +23,6 @@ class Markdown(Html):
 
 
     @staticmethod
     @staticmethod
     def apply_tailwind(html: str):
     def apply_tailwind(html: str):
-
         rep = {
         rep = {
             '<h1': '<h1 class="text-5xl mb-4 mt-6"',
             '<h1': '<h1 class="text-5xl mb-4 mt-6"',
             '<h2': '<h2 class="text-4xl mb-3 mt-5"',
             '<h2': '<h2 class="text-4xl mb-3 mt-5"',

+ 0 - 3
nicegui/elements/menu.py

@@ -2,7 +2,6 @@ import justpy as jp
 from .group import Group
 from .group import Group
 
 
 class Menu(Group):
 class Menu(Group):
-
     def __init__(self,
     def __init__(self,
                  *,
                  *,
                  value: bool = False
                  value: bool = False
@@ -19,9 +18,7 @@ class Menu(Group):
         super().__init__(view)
         super().__init__(view)
 
 
     def open(self):
     def open(self):
-
         self.view.value = True
         self.view.value = True
 
 
     def close(self):
     def close(self):
-
         self.view.value = False
         self.view.value = False

+ 0 - 1
nicegui/elements/menu_item.py

@@ -7,7 +7,6 @@ from ..utils import handle_exceptions, provide_arguments
 
 
 
 
 class MenuItem(Element):
 class MenuItem(Element):
-
     def __init__(self,
     def __init__(self,
                  text: str = '',
                  text: str = '',
                  on_click: Callable = None
                  on_click: Callable = None

+ 0 - 2
nicegui/elements/notify.py

@@ -4,7 +4,6 @@ import asyncio
 
 
 
 
 class Notify(Element):
 class Notify(Element):
-
     def __init__(self,
     def __init__(self,
                  message: str,
                  message: str,
                  *,
                  *,
@@ -26,7 +25,6 @@ class Notify(Element):
         asyncio.get_event_loop().create_task(self.notify_async())
         asyncio.get_event_loop().create_task(self.notify_async())
 
 
     async def notify_async(self):
     async def notify_async(self):
-
         self.view.notify = True
         self.view.notify = True
         await self.parent_view.update()
         await self.parent_view.update()
         self.view.notify = False
         self.view.notify = False

+ 0 - 2
nicegui/elements/number.py

@@ -3,7 +3,6 @@ from typing import Callable
 from .float_element import FloatElement
 from .float_element import FloatElement
 
 
 class Number(FloatElement):
 class Number(FloatElement):
-
     def __init__(self,
     def __init__(self,
                  label: str = None,
                  label: str = None,
                  *,
                  *,
@@ -31,7 +30,6 @@ class Number(FloatElement):
         super().__init__(view, value=value, format=format, on_change=on_change)
         super().__init__(view, value=value, format=format, on_change=on_change)
 
 
     def handle_change(self, msg):
     def handle_change(self, msg):
-
         msg['value'] = float(msg['value'])
         msg['value'] = float(msg['value'])
 
 
         return super().handle_change(msg)
         return super().handle_change(msg)

+ 0 - 1
nicegui/elements/page.py

@@ -4,7 +4,6 @@ from pygments.formatters import HtmlFormatter
 from .element import Element
 from .element import Element
 
 
 class Page(jp.QuasarPage):
 class Page(jp.QuasarPage):
-
     default_title: str
     default_title: str
     default_favicon: str
     default_favicon: str
 
 

+ 0 - 3
nicegui/elements/plot.py

@@ -3,7 +3,6 @@ import matplotlib.pyplot as plt
 from .element import Element
 from .element import Element
 
 
 class Plot(Element):
 class Plot(Element):
-
     def __init__(self,
     def __init__(self,
                  *,
                  *,
                  close: bool = True,
                  close: bool = True,
@@ -26,13 +25,11 @@ class Plot(Element):
         super().__init__(view)
         super().__init__(view)
 
 
     def __enter__(self):
     def __enter__(self):
-
         plt.figure(self.fig)
         plt.figure(self.fig)
 
 
         return self
         return self
 
 
     def __exit__(self, *_):
     def __exit__(self, *_):
-
         self.view.set_figure(plt.gcf())
         self.view.set_figure(plt.gcf())
 
 
         if self.close:
         if self.close:

+ 0 - 1
nicegui/elements/radio.py

@@ -3,7 +3,6 @@ from typing import Callable, List, Dict, Union
 from .choice_element import ChoiceElement
 from .choice_element import ChoiceElement
 
 
 class Radio(ChoiceElement):
 class Radio(ChoiceElement):
-
     def __init__(self,
     def __init__(self,
                  options: Union[List, Dict],
                  options: Union[List, Dict],
                  *,
                  *,

+ 0 - 2
nicegui/elements/row.py

@@ -2,9 +2,7 @@ import justpy as jp
 from .group import Group
 from .group import Group
 
 
 class Row(Group):
 class Row(Group):
-
     def __init__(self):
     def __init__(self):
-
         view = jp.QDiv(classes='row items-start', style='gap: 1em', delete_flag=False)
         view = jp.QDiv(classes='row items-start', style='gap: 1em', delete_flag=False)
 
 
         super().__init__(view)
         super().__init__(view)

+ 0 - 3
nicegui/elements/scene.py

@@ -6,7 +6,6 @@ from .page import Page
 from .scene_object3d import Object3D
 from .scene_object3d import Object3D
 
 
 class SceneView(CustomView):
 class SceneView(CustomView):
-
     def __init__(self, *, width: int, height: int, on_click: Callable):
     def __init__(self, *, width: int, height: int, on_click: Callable):
         dependencies = ['three.min.js', 'OrbitControls.js', 'STLLoader.js']
         dependencies = ['three.min.js', 'OrbitControls.js', 'STLLoader.js']
         super().__init__('scene', __file__, dependencies, width=width, height=height)
         super().__init__('scene', __file__, dependencies, width=width, height=height)
@@ -33,7 +32,6 @@ class SceneView(CustomView):
             traceback.print_exc()
             traceback.print_exc()
 
 
 class Scene(Element):
 class Scene(Element):
-
     from .scene_objects import Group as group
     from .scene_objects import Group as group
     from .scene_objects import Box as box
     from .scene_objects import Box as box
     from .scene_objects import Sphere as sphere
     from .scene_objects import Sphere as sphere
@@ -69,7 +67,6 @@ class Scene(Element):
         self.view_stack.pop()
         self.view_stack.pop()
 
 
 class SceneObject:
 class SceneObject:
-
     def __init__(self, view: SceneView, page: Page):
     def __init__(self, view: SceneView, page: Page):
         self.id = 'scene'
         self.id = 'scene'
         self.view = view
         self.view = view

+ 0 - 1
nicegui/elements/scene_object3d.py

@@ -6,7 +6,6 @@ import numpy as np
 from justpy.htmlcomponents import WebPage
 from justpy.htmlcomponents import WebPage
 
 
 class Object3D:
 class Object3D:
-
     stack: list[Object3D] = []
     stack: list[Object3D] = []
 
 
     def __init__(self, type: str, *args):
     def __init__(self, type: str, *args):

+ 0 - 10
nicegui/elements/scene_objects.py

@@ -3,17 +3,14 @@ from typing import Optional
 from .scene_object3d import Object3D
 from .scene_object3d import Object3D
 
 
 class Scene(Object3D):
 class Scene(Object3D):
-
     def __init__(self, view):
     def __init__(self, view):
         super().__init__('scene', view)
         super().__init__('scene', view)
 
 
 class Group(Object3D):
 class Group(Object3D):
-
     def __init__(self):
     def __init__(self):
         super().__init__('group')
         super().__init__('group')
 
 
 class Box(Object3D):
 class Box(Object3D):
-
     def __init__(self,
     def __init__(self,
                  width: float = 1.0,
                  width: float = 1.0,
                  height: float = 1.0,
                  height: float = 1.0,
@@ -23,7 +20,6 @@ class Box(Object3D):
         super().__init__('box', width, height, depth, wireframe)
         super().__init__('box', width, height, depth, wireframe)
 
 
 class Sphere(Object3D):
 class Sphere(Object3D):
-
     def __init__(self,
     def __init__(self,
                  radius: float = 1.0,
                  radius: float = 1.0,
                  width_segments: int = 32,
                  width_segments: int = 32,
@@ -33,7 +29,6 @@ class Sphere(Object3D):
         super().__init__('sphere', radius, width_segments, height_segments, wireframe)
         super().__init__('sphere', radius, width_segments, height_segments, wireframe)
 
 
 class Cylinder(Object3D):
 class Cylinder(Object3D):
-
     def __init__(self,
     def __init__(self,
                  top_radius: float = 1.0,
                  top_radius: float = 1.0,
                  bottom_radius: float = 1.0,
                  bottom_radius: float = 1.0,
@@ -45,7 +40,6 @@ class Cylinder(Object3D):
         super().__init__('cylinder', top_radius, bottom_radius, height, radial_segments, height_segments, wireframe)
         super().__init__('cylinder', top_radius, bottom_radius, height, radial_segments, height_segments, wireframe)
 
 
 class Extrusion(Object3D):
 class Extrusion(Object3D):
-
     def __init__(self,
     def __init__(self,
                  outline: list[list[float, float]],
                  outline: list[list[float, float]],
                  height: float,
                  height: float,
@@ -54,7 +48,6 @@ class Extrusion(Object3D):
         super().__init__('extrusion', outline, height, wireframe)
         super().__init__('extrusion', outline, height, wireframe)
 
 
 class Stl(Object3D):
 class Stl(Object3D):
-
     def __init__(self,
     def __init__(self,
                  url: str,
                  url: str,
                  wireframe: bool = False,
                  wireframe: bool = False,
@@ -62,7 +55,6 @@ class Stl(Object3D):
         super().__init__('stl', url, wireframe)
         super().__init__('stl', url, wireframe)
 
 
 class Line(Object3D):
 class Line(Object3D):
-
     def __init__(self,
     def __init__(self,
                  start: list[float, float, float],
                  start: list[float, float, float],
                  end: list[float, float, float],
                  end: list[float, float, float],
@@ -70,7 +62,6 @@ class Line(Object3D):
         super().__init__('line', start, end)
         super().__init__('line', start, end)
 
 
 class Curve(Object3D):
 class Curve(Object3D):
-
     def __init__(self,
     def __init__(self,
                  start: list[float, float, float],
                  start: list[float, float, float],
                  control1: list[float, float, float],
                  control1: list[float, float, float],
@@ -81,7 +72,6 @@ class Curve(Object3D):
         super().__init__('curve', start, control1, control2, end, num_points)
         super().__init__('curve', start, control1, control2, end, num_points)
 
 
 class Texture(Object3D):
 class Texture(Object3D):
-
     def __init__(self,
     def __init__(self,
                  url: str,
                  url: str,
                  coordinates: list[list[Optional[list[float]]]],
                  coordinates: list[list[Optional[list[float]]]],

+ 0 - 3
nicegui/elements/select.py

@@ -3,7 +3,6 @@ from typing import Callable, List, Dict, Union
 from .choice_element import ChoiceElement
 from .choice_element import ChoiceElement
 
 
 class Select(ChoiceElement):
 class Select(ChoiceElement):
-
     def __init__(self,
     def __init__(self,
                  options: Union[List, Dict],
                  options: Union[List, Dict],
                  *,
                  *,
@@ -22,7 +21,6 @@ class Select(ChoiceElement):
         super().__init__(view, options, value=value, on_change=on_change)
         super().__init__(view, options, value=value, on_change=on_change)
 
 
     def value_to_view(self, value: any):
     def value_to_view(self, value: any):
-
         matches = [o for o in self.view.options if o['value'] == value]
         matches = [o for o in self.view.options if o['value'] == value]
         if any(matches):
         if any(matches):
             return matches[0]['label']
             return matches[0]['label']
@@ -30,7 +28,6 @@ class Select(ChoiceElement):
             return value
             return value
 
 
     def handle_change(self, msg):
     def handle_change(self, msg):
-
         msg['label'] = msg['value']['label']
         msg['label'] = msg['value']['label']
         msg['value'] = msg['value']['value']
         msg['value'] = msg['value']['value']
         return super().handle_change(msg)
         return super().handle_change(msg)

+ 0 - 1
nicegui/elements/slider.py

@@ -3,7 +3,6 @@ import justpy as jp
 from .float_element import FloatElement
 from .float_element import FloatElement
 
 
 class Slider(FloatElement):
 class Slider(FloatElement):
-
     def __init__(self,
     def __init__(self,
                  *,
                  *,
                  min: float,
                  min: float,

+ 0 - 2
nicegui/elements/string_element.py

@@ -3,12 +3,10 @@ from typing import Callable
 from .value_element import ValueElement
 from .value_element import ValueElement
 
 
 class StringElement(ValueElement):
 class StringElement(ValueElement):
-
     def __init__(self,
     def __init__(self,
                  view: jp.HTMLBaseComponent,
                  view: jp.HTMLBaseComponent,
                  *,
                  *,
                  value: float,
                  value: float,
                  on_change: Callable,
                  on_change: Callable,
                  ):
                  ):
-
         super().__init__(view, value=value, on_change=on_change)
         super().__init__(view, value=value, on_change=on_change)

+ 0 - 7
nicegui/elements/svg.py

@@ -2,7 +2,6 @@ import justpy as jp
 from .element import Element
 from .element import Element
 
 
 class Svg(Element):
 class Svg(Element):
-
     def __init__(self,
     def __init__(self,
                  content: str = '',
                  content: str = '',
                  ):
                  ):
@@ -19,30 +18,24 @@ class Svg(Element):
 
 
     @property
     @property
     def content(self):
     def content(self):
-
         return self.view.inner_html()
         return self.view.inner_html()
 
 
     @content.setter
     @content.setter
     def content(self, content: any):
     def content(self, content: any):
-
         self.view.components = []
         self.view.components = []
         jp.parse_html(content, a=self.view)
         jp.parse_html(content, a=self.view)
 
 
     def set_content(self, content: str):
     def set_content(self, content: str):
-
         self.content = content
         self.content = content
 
 
     def bind_content_to(self, target, forward=lambda x: x):
     def bind_content_to(self, target, forward=lambda x: x):
-
         self.content.bind_to(target, forward=forward, nesting=1)
         self.content.bind_to(target, forward=forward, nesting=1)
         return self
         return self
 
 
     def bind_content_from(self, target, backward=lambda x: x):
     def bind_content_from(self, target, backward=lambda x: x):
-
         self.content.bind_from(target, backward=backward, nesting=1)
         self.content.bind_from(target, backward=backward, nesting=1)
         return self
         return self
 
 
     def bind_content(self, target, forward=lambda x: x, backward=lambda x: x):
     def bind_content(self, target, forward=lambda x: x, backward=lambda x: x):
-
         self.content.bind(target, forward=forward, backward=backward, nesting=1)
         self.content.bind(target, forward=forward, backward=backward, nesting=1)
         return self
         return self

+ 0 - 1
nicegui/elements/switch.py

@@ -3,7 +3,6 @@ import justpy as jp
 from .bool_element import BoolElement
 from .bool_element import BoolElement
 
 
 class Switch(BoolElement):
 class Switch(BoolElement):
-
     def __init__(self,
     def __init__(self,
                  text: str = '',
                  text: str = '',
                  *,
                  *,

+ 0 - 1
nicegui/elements/toggle.py

@@ -3,7 +3,6 @@ from typing import Callable, List, Dict, Union
 from .choice_element import ChoiceElement
 from .choice_element import ChoiceElement
 
 
 class Toggle(ChoiceElement):
 class Toggle(ChoiceElement):
-
     def __init__(self,
     def __init__(self,
                  options: Union[List, Dict],
                  options: Union[List, Dict],
                  *,
                  *,

+ 0 - 2
nicegui/elements/upload.py

@@ -5,7 +5,6 @@ from .element import Element
 from ..utils import handle_exceptions
 from ..utils import handle_exceptions
 
 
 class Upload(Element):
 class Upload(Element):
-
     def __init__(self,
     def __init__(self,
                  *,
                  *,
                  multiple: bool = False,
                  multiple: bool = False,
@@ -25,7 +24,6 @@ class Upload(Element):
         super().__init__(view)
         super().__init__(view)
 
 
     def submit(self, _, msg):
     def submit(self, _, msg):
-
         for form_data in msg.form_data:
         for form_data in msg.form_data:
             if form_data.type == 'file':
             if form_data.type == 'file':
                 self.on_upload([base64.b64decode(f.file_content) for f in form_data.files])
                 self.on_upload([base64.b64decode(f.file_content) for f in form_data.files])

+ 0 - 7
nicegui/elements/value_element.py

@@ -6,7 +6,6 @@ from .element import Element
 from ..utils import EventArguments
 from ..utils import EventArguments
 
 
 class ValueElement(Element):
 class ValueElement(Element):
-
     value = BindableProperty()
     value = BindableProperty()
 
 
     def __init__(self,
     def __init__(self,
@@ -15,7 +14,6 @@ class ValueElement(Element):
                  value: Any,
                  value: Any,
                  on_change: Callable,
                  on_change: Callable,
                  ):
                  ):
-
         super().__init__(view)
         super().__init__(view)
 
 
         self.on_change = on_change
         self.on_change = on_change
@@ -23,11 +21,9 @@ class ValueElement(Element):
         self.value.bind_to(self.view.value, forward=self.value_to_view)
         self.value.bind_to(self.view.value, forward=self.value_to_view)
 
 
     def value_to_view(self, value):
     def value_to_view(self, value):
-
         return value
         return value
 
 
     def handle_change(self, msg):
     def handle_change(self, msg):
-
         self.value = msg['value']
         self.value = msg['value']
 
 
         if self.on_change is not None:
         if self.on_change is not None:
@@ -40,16 +36,13 @@ class ValueElement(Element):
                 traceback.print_exc()
                 traceback.print_exc()
 
 
     def bind_value_to(self, target, forward=lambda x: x):
     def bind_value_to(self, target, forward=lambda x: x):
-
         self.value.bind_to(target, forward=forward, nesting=1)
         self.value.bind_to(target, forward=forward, nesting=1)
         return self
         return self
 
 
     def bind_value_from(self, target, backward=lambda x: x):
     def bind_value_from(self, target, backward=lambda x: x):
-
         self.value.bind_from(target, backward=backward, nesting=1)
         self.value.bind_from(target, backward=backward, nesting=1)
         return self
         return self
 
 
     def bind_value(self, target, forward=lambda x: x, backward=lambda x: x):
     def bind_value(self, target, forward=lambda x: x, backward=lambda x: x):
-
         self.value.bind(target, forward=forward, backward=backward, nesting=1)
         self.value.bind(target, forward=forward, backward=backward, nesting=1)
         return self
         return self

+ 0 - 2
nicegui/lifecycle.py

@@ -3,11 +3,9 @@ from typing import Awaitable, Callable, List, Union
 startup_tasks: List[Union[Callable, Awaitable]] = []
 startup_tasks: List[Union[Callable, Awaitable]] = []
 
 
 def on_startup(self, task: Union[Callable, Awaitable]):
 def on_startup(self, task: Union[Callable, Awaitable]):
-
     self.startup_tasks.append(task)
     self.startup_tasks.append(task)
 
 
 shutdown_tasks: List[Union[Callable, Awaitable]] = []
 shutdown_tasks: List[Union[Callable, Awaitable]] = []
 
 
 def on_shutdown(self, task: Union[Callable, Awaitable]):
 def on_shutdown(self, task: Union[Callable, Awaitable]):
-
     self.shutdown_tasks.append(task)
     self.shutdown_tasks.append(task)

+ 0 - 2
nicegui/run.py

@@ -6,14 +6,12 @@ from .config import config  # NOTE: before justpy
 import justpy as jp
 import justpy as jp
 
 
 if not config.interactive and config.reload and not inspect.stack()[-2].filename.endswith('spawn.py'):
 if not config.interactive and config.reload and not inspect.stack()[-2].filename.endswith('spawn.py'):
-
     if config.show:
     if config.show:
         webbrowser.open(f'http://{config.host}:{config.port}/')
         webbrowser.open(f'http://{config.host}:{config.port}/')
     uvicorn.run('nicegui:app', host=config.host, port=config.port, lifespan='on', reload=True)
     uvicorn.run('nicegui:app', host=config.host, port=config.port, lifespan='on', reload=True)
     sys.exit()
     sys.exit()
 
 
 def run(self, *, host='0.0.0.0', port=80, title='NiceGUI', favicon='favicon.ico', reload=True, show=True):
 def run(self, *, host='0.0.0.0', port=80, title='NiceGUI', favicon='favicon.ico', reload=True, show=True):
-
     if config.interactive or reload == False:  # NOTE: if reload == True we already started uvicorn above
     if config.interactive or reload == False:  # NOTE: if reload == True we already started uvicorn above
         if show:
         if show:
             webbrowser.open(f'http://{host if host != "0.0.0.0" else "127.0.0.1"}:{port}/')
             webbrowser.open(f'http://{host if host != "0.0.0.0" else "127.0.0.1"}:{port}/')

+ 4 - 2
nicegui/static/templates/local/materialdesignicons/iconfont/README.md

@@ -1,8 +1,10 @@
 The recommended way to use the Material Icons font is by linking to the web font hosted on Google Fonts:
 The recommended way to use the Material Icons font is by linking to the web font hosted on Google Fonts:
 
 
 ```html
 ```html
-<link href="https://fonts.googleapis.com/icon?family=Material+Icons"
-      rel="stylesheet">
+<link
+  href="https://fonts.googleapis.com/icon?family=Material+Icons"
+  rel="stylesheet"
+/>
 ```
 ```
 
 
 Read more in our full usage guide:
 Read more in our full usage guide:

+ 0 - 3
nicegui/timer.py

@@ -7,7 +7,6 @@ from .elements.element import Element
 from .utils import handle_exceptions, handle_awaitable
 from .utils import handle_exceptions, handle_awaitable
 
 
 class Timer:
 class Timer:
-
     tasks = []
     tasks = []
 
 
     active = BindableProperty
     active = BindableProperty
@@ -29,13 +28,11 @@ class Timer:
         self.active = active
         self.active = active
 
 
         async def timeout():
         async def timeout():
-
             await asyncio.sleep(interval)
             await asyncio.sleep(interval)
             await handle_exceptions(handle_awaitable(callback))()
             await handle_exceptions(handle_awaitable(callback))()
             await parent.update()
             await parent.update()
 
 
         async def loop():
         async def loop():
-
             while True:
             while True:
                 try:
                 try:
                     start = time.time()
                     start = time.time()

+ 0 - 1
nicegui/ui.py

@@ -1,5 +1,4 @@
 class Ui:
 class Ui:
-
     from .run import run, config  # NOTE: before justpy
     from .run import run, config  # NOTE: before justpy
 
 
     from .elements.button import Button as button
     from .elements.button import Button as button

+ 0 - 2
nicegui/utils.py

@@ -2,9 +2,7 @@ import asyncio
 import traceback
 import traceback
 
 
 class EventArguments:
 class EventArguments:
-
     def __init__(self, sender, **kwargs):
     def __init__(self, sender, **kwargs):
-
         self.sender = sender
         self.sender = sender
         for key, value in kwargs.items():
         for key, value in kwargs.items():
             setattr(self, key, value)
             setattr(self, key, value)