Falko Schindler пре 3 година
родитељ
комит
19d0b26a10
44 измењених фајлова са 99 додато и 45 уклоњено
  1. 1 0
      LICENSE
  2. 1 0
      README.md
  3. 1 0
      main.py
  4. 1 1
      nicegui/config.py
  5. 1 0
      nicegui/elements/bool_element.py
  6. 1 0
      nicegui/elements/button.py
  7. 7 2
      nicegui/elements/card.py
  8. 1 0
      nicegui/elements/checkbox.py
  9. 1 0
      nicegui/elements/choice_element.py
  10. 5 3
      nicegui/elements/column.py
  11. 2 0
      nicegui/elements/custom_example.py
  12. 1 1
      nicegui/elements/dialog.py
  13. 11 8
      nicegui/elements/element.py
  14. 1 0
      nicegui/elements/float_element.py
  15. 1 0
      nicegui/elements/group.py
  16. 1 1
      nicegui/elements/html.py
  17. 1 0
      nicegui/elements/icon.py
  18. 1 1
      nicegui/elements/image.py
  19. 1 0
      nicegui/elements/input.py
  20. 2 1
      nicegui/elements/joystick.py
  21. 1 1
      nicegui/elements/label.py
  22. 1 1
      nicegui/elements/line_plot.py
  23. 1 0
      nicegui/elements/link.py
  24. 2 1
      nicegui/elements/log.py
  25. 1 1
      nicegui/elements/markdown.py
  26. 2 2
      nicegui/elements/menu.py
  27. 3 5
      nicegui/elements/menu_item.py
  28. 2 2
      nicegui/elements/notify.py
  29. 1 1
      nicegui/elements/number.py
  30. 1 1
      nicegui/elements/plot.py
  31. 1 1
      nicegui/elements/radio.py
  32. 5 3
      nicegui/elements/row.py
  33. 2 0
      nicegui/elements/scene.py
  34. 10 0
      nicegui/elements/scene_objects.py
  35. 1 1
      nicegui/elements/select.py
  36. 1 0
      nicegui/elements/slider.py
  37. 1 0
      nicegui/elements/string_element.py
  38. 1 1
      nicegui/elements/svg.py
  39. 1 0
      nicegui/elements/switch.py
  40. 1 1
      nicegui/elements/toggle.py
  41. 1 0
      nicegui/elements/upload.py
  42. 11 3
      nicegui/run.py
  43. 2 2
      nicegui/ui.py
  44. 4 0
      nicegui/utils.py

+ 1 - 0
LICENSE

@@ -8,6 +8,7 @@ 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.
 
 

+ 1 - 0
README.md

@@ -59,6 +59,7 @@ You can call `ui.run()` with optional arguments for some high-level configuratio
 - `favicon` (default: `'favicon.ico'`)
 - `favicon` (default: `'favicon.ico'`)
 - `reload`: automatically reload the ui on file changes (default: `True`)
 - `reload`: automatically reload the ui on file changes (default: `True`)
 - `show`: automatically open the ui in a browser tab (default: `True`)
 - `show`: automatically open the ui in a browser tab (default: `True`)
+- `uvicorn_logging_level`: logging level for uvicorn server (default: `'warning'`)
 - `interactive`: used internally when run in interactive Python shell (default: `False`)
 - `interactive`: used internally when run in interactive Python shell (default: `False`)
 
 
 ## Docker
 ## Docker

+ 1 - 0
main.py

@@ -292,6 +292,7 @@ Just pass a property of the model as parameter to these methods to create the bi
 '''
 '''
 with example(binding):
 with example(binding):
     class Demo:
     class Demo:
+
         def __init__(self):
         def __init__(self):
             self.number = 1
             self.number = 1
 
 

+ 1 - 1
nicegui/config.py

@@ -11,8 +11,8 @@ class Config(BaseModel):
     favicon: str = 'favicon.ico'
     favicon: str = 'favicon.ico'
     reload: bool = True
     reload: bool = True
     show: bool = True
     show: bool = True
+    uvicorn_logging_level = 'warning'
     interactive: bool = False
     interactive: bool = False
-    uvicron_logging_level = 'warning'
 
 
 
 
 excluded_endings = (
 excluded_endings = (

+ 1 - 0
nicegui/elements/bool_element.py

@@ -3,6 +3,7 @@ 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,
                  *,
                  *,

+ 1 - 0
nicegui/elements/button.py

@@ -4,6 +4,7 @@ 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 = '',
                  *,
                  *,

+ 7 - 2
nicegui/elements/card.py

@@ -1,14 +1,18 @@
-from nicegui.elements.element import Design
 import justpy as jp
 import justpy as jp
+from .element import Design
 from .group import Group
 from .group import Group
 
 
 class Card(Group):
 class Card(Group):
+
     def __init__(self, design: Design = Design.default):
     def __init__(self, design: Design = Design.default):
         """Card Element
         """Card Element
 
 
         Provides a container with a dropped shadow.
         Provides a container with a dropped shadow.
 
 
-        :param design: Design.plain does not apply any stylings to the underlying Quasar card. If ommitted Design.default configures padding and spacing. When using 'plain' design, content expandes to the edges. To provide margins for other content you can use ui.card_section.
+        :param design: `Design.plain` does not apply any stylings to the underlying Quasar card.
+            If ommitted, `Design.default` configures padding and spacing.
+            When using `Design.plain`, content expands to the edges.
+            To provide margins for other content you can use `ui.card_section`.
         """
         """
         if design == design.default:
         if design == design.default:
             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)
@@ -19,6 +23,7 @@ class Card(Group):
         super().__init__(view)
         super().__init__(view)
 
 
 class CardSection(Group):
 class CardSection(Group):
+
     def __init__(self):
     def __init__(self):
         view = jp.QCardSection(delete_flag=False)
         view = jp.QCardSection(delete_flag=False)
         super().__init__(view)
         super().__init__(view)

+ 1 - 0
nicegui/elements/checkbox.py

@@ -3,6 +3,7 @@ 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 = '',
                  *,
                  *,

+ 1 - 0
nicegui/elements/choice_element.py

@@ -3,6 +3,7 @@ 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],

+ 5 - 3
nicegui/elements/column.py

@@ -1,14 +1,16 @@
-from nicegui.elements.element import Design
 import justpy as jp
 import justpy as jp
+from .element import Design
 from .group import Group
 from .group import Group
 
 
 class Column(Group):
 class Column(Group):
+
     def __init__(self, design: Design = Design.default):
     def __init__(self, design: Design = Design.default):
         '''Row Element
         '''Row Element
 
 
-        Provides a container which arranges it's child in a row.
+        Provides a container which arranges its child in a row.
 
 
-        :param design: Design.plain does not apply any stylings. If ommitted Design.default configures padding and spacing.
+        :param design: `Design.plain` does not apply any stylings.
+            If ommitted, `Design.default` configures padding and spacing.
         '''
         '''
         if design == design.default:
         if design == design.default:
             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)

+ 2 - 0
nicegui/elements/custom_example.py

@@ -2,6 +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)
 
 
@@ -16,6 +17,7 @@ class CustomExampleView(CustomView):
         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))
 
 

+ 1 - 1
nicegui/elements/dialog.py

@@ -2,6 +2,7 @@ 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
@@ -12,7 +13,6 @@ class Dialog(Group):
 
 
         :param value: whether the dialog is already opened (default: False)
         :param value: whether the dialog is already opened (default: False)
         """
         """
-
         view = jp.QDialog(
         view = jp.QDialog(
             value=value,
             value=value,
             classes='row items-start bg-red-400',
             classes='row items-start bg-red-400',

+ 11 - 8
nicegui/elements/element.py

@@ -1,5 +1,5 @@
-from enum import Enum
 import justpy as jp
 import justpy as jp
+from enum import Enum
 from binding.binding import BindableProperty
 from binding.binding import BindableProperty
 
 
 class Element:
 class Element:
@@ -47,8 +47,9 @@ class Element:
         return self
         return self
 
 
     def classes(self, add: str = '', *, remove: str = '', replace: str = ''):
     def classes(self, add: str = '', *, remove: str = '', replace: str = ''):
-        '''`html classes to modify the look of the element.
-        Every class in the 'remove' parameter will be removed from the element. Classes are seperated with a blank space.
+        '''HTML classes to modify the look of the element.
+        Every class in the `remove` parameter will be removed from the element.
+        Classes are seperated with a blank space.
         This can be helpful if the predefined classes by NiceGUI are not wanted in a particular styling.
         This can be helpful if the predefined classes by NiceGUI are not wanted in a particular styling.
         '''
         '''
         class_list = [] if replace else self.view.classes.split()
         class_list = [] if replace else self.view.classes.split()
@@ -60,8 +61,9 @@ class Element:
         return self
         return self
 
 
     def style(self, add: str = '', *, remove: str = '', replace: str = ''):
     def style(self, add: str = '', *, remove: str = '', replace: str = ''):
-        '''`CSS style sheet definitions to modify the look of the element.
-        Every style in the 'remove' parameter will be removed from the element. Styles are seperated with a semicolon.
+        '''CSS style sheet definitions to modify the look of the element.
+        Every style in the `remove` parameter will be removed from the element.
+        Styles are seperated with a semicolon.
         This can be helpful if the predefined style sheet definitions by NiceGUI are not wanted in a particular styling.
         This can be helpful if the predefined style sheet definitions by NiceGUI are not wanted in a particular styling.
         '''
         '''
         style_list = [] if replace else self.view.style.split(';')
         style_list = [] if replace else self.view.style.split(';')
@@ -73,9 +75,10 @@ class Element:
         return self
         return self
 
 
     def props(self, add: str = '', *, remove: str = '', replace: str = ''):
     def props(self, add: str = '', *, remove: str = '', replace: str = ''):
-        '''`Quasar props <https://quasar.dev/vue-components/button#design>`_ to modify the look of the element.
-        Boolean pops will automatically activated if they appear in the list of the 'add' property. Props are seperated with a blank space.
-        Every prop passed to the 'remove' parameter will be removed from the element. 
+        '''Quasar props https://quasar.dev/vue-components/button#design to modify the look of the element.
+        Boolean props will automatically activated if they appear in the list of the `add` property.
+        Props are seperated with a blank space.
+        Every prop passed to the `remove` parameter will be removed from the element.
         This can be helpful if the predefined props by NiceGUI are not wanted in a particular styling.
         This can be helpful if the predefined props by NiceGUI are not wanted in a particular styling.
         '''
         '''
         for prop in remove.split() + replace.split():
         for prop in remove.split() + replace.split():

+ 1 - 0
nicegui/elements/float_element.py

@@ -3,6 +3,7 @@ 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,
                  *,
                  *,

+ 1 - 0
nicegui/elements/group.py

@@ -1,6 +1,7 @@
 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

+ 1 - 1
nicegui/elements/html.py

@@ -2,6 +2,7 @@ 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 = '',
                  ):
                  ):
@@ -11,7 +12,6 @@ class Html(Element):
 
 
         :param content: the HTML code to be displayed
         :param content: the HTML code to be displayed
         """
         """
-
         view = jp.QDiv()
         view = jp.QDiv()
         super().__init__(view)
         super().__init__(view)
         self.content = content
         self.content = content

+ 1 - 0
nicegui/elements/icon.py

@@ -2,6 +2,7 @@ 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,
                  ):
                  ):

+ 1 - 1
nicegui/elements/image.py

@@ -2,6 +2,7 @@ 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 = '',
                  ):
                  ):
@@ -11,7 +12,6 @@ class Image(Group):
 
 
         :param source: the source of the image; can be an url or a base64 string
         :param source: the source of the image; can be an url or a base64 string
         """
         """
-
         view = jp.QImg(src=source)
         view = jp.QImg(src=source)
 
 
         super().__init__(view)
         super().__init__(view)

+ 1 - 0
nicegui/elements/input.py

@@ -3,6 +3,7 @@ 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,
                  *,
                  *,

+ 2 - 1
nicegui/elements/joystick.py

@@ -3,6 +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)
 
 
@@ -31,6 +32,7 @@ class JoystickView(CustomView):
         return False
         return False
 
 
 class Joystick(Element):
 class Joystick(Element):
+
     def __init__(self,
     def __init__(self,
                  *,
                  *,
                  on_start: Callable = None,
                  on_start: Callable = None,
@@ -47,5 +49,4 @@ class Joystick(Element):
         :param on_end: callback for when the user releases the joystick
         :param on_end: callback for when the user releases the joystick
         :param options: arguments like `color` which should be passed to the `underlying nipple.js library <https://github.com/yoannmoinet/nipplejs#options>`_
         :param options: arguments like `color` which should be passed to the `underlying nipple.js library <https://github.com/yoannmoinet/nipplejs#options>`_
         """
         """
-
         super().__init__(JoystickView(on_start, on_move, on_end, **options))
         super().__init__(JoystickView(on_start, on_move, on_end, **options))

+ 1 - 1
nicegui/elements/label.py

@@ -2,6 +2,7 @@ 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 = '',
                  ):
                  ):
@@ -11,7 +12,6 @@ class Label(Element):
 
 
         :param text: the content of the label
         :param text: the content of the label
         """
         """
-
         view = jp.Div(text=text)
         view = jp.Div(text=text)
 
 
         super().__init__(view)
         super().__init__(view)

+ 1 - 1
nicegui/elements/line_plot.py

@@ -2,6 +2,7 @@ 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,
@@ -20,7 +21,6 @@ class LinePlot(Plot):
         :param close: whether the figure should be closed after exiting the context; set to `False` if you want to update it later, default is `True`
         :param close: whether the figure should be closed after exiting the context; set to `False` if you want to update it later, default is `True`
         :param kwargs: arguments like `figsize` which should be passed to `pyplot.figure <https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.figure.html>`_
         :param kwargs: arguments like `figsize` which should be passed to `pyplot.figure <https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.figure.html>`_
         """
         """
-
         super().__init__(close=close, **kwargs)
         super().__init__(close=close, **kwargs)
 
 
         self.x = []
         self.x = []

+ 1 - 0
nicegui/elements/link.py

@@ -2,6 +2,7 @@ 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 = '#',

+ 2 - 1
nicegui/elements/log.py

@@ -5,10 +5,12 @@ 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
 
 
@@ -16,7 +18,6 @@ class Log(Element):
 
 
         :param max_lines: maximum number of lines before dropping oldest ones (default: None)
         :param max_lines: maximum number of lines before dropping oldest ones (default: None)
         """
         """
-
         super().__init__(LogView(max_lines=max_lines))
         super().__init__(LogView(max_lines=max_lines))
 
 
         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')

+ 1 - 1
nicegui/elements/markdown.py

@@ -3,6 +3,7 @@ from .html import Html
 import re
 import re
 
 
 class Markdown(Html):
 class Markdown(Html):
+
     def __init__(self,
     def __init__(self,
                  content: str = '',
                  content: str = '',
                  ):
                  ):
@@ -12,7 +13,6 @@ class Markdown(Html):
 
 
         :param content: the markdown content to be displayed
         :param content: the markdown content to be displayed
         """
         """
-
         super().__init__(content)
         super().__init__(content)
 
 
     def set_content(self, content: str):
     def set_content(self, content: str):

+ 2 - 2
nicegui/elements/menu.py

@@ -2,9 +2,10 @@ 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,
                  ):
                  ):
         """Menu
         """Menu
 
 
@@ -12,7 +13,6 @@ class Menu(Group):
 
 
         :param value: whether the menu is already opened (default: False)
         :param value: whether the menu is already opened (default: False)
         """
         """
-
         view = jp.QMenu(value=value)
         view = jp.QMenu(value=value)
 
 
         super().__init__(view)
         super().__init__(view)

+ 3 - 5
nicegui/elements/menu_item.py

@@ -1,24 +1,22 @@
 from typing import Callable
 from typing import Callable
-
 import justpy as jp
 import justpy as jp
-
 from .element import Element
 from .element import Element
 from ..utils import handle_exceptions, provide_arguments
 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,
                  ):
                  ):
         """Menu Item Element
         """Menu Item Element
 
 
         A menu item to be added to a menu.
         A menu item to be added to a menu.
 
 
         :param text: label of the menu item
         :param text: label of the menu item
-        :param on_click: function to be executed when selecting the menu item
+        :param on_click: callback to be executed when selecting the menu item
         """
         """
-
         view = jp.QItem(text=text, clickable=True)
         view = jp.QItem(text=text, clickable=True)
 
 
         if on_click is not None:
         if on_click is not None:

+ 2 - 2
nicegui/elements/notify.py

@@ -4,11 +4,12 @@ import asyncio
 
 
 
 
 class Notify(Element):
 class Notify(Element):
+
     def __init__(self,
     def __init__(self,
                  message: str,
                  message: str,
                  *,
                  *,
                  position: str = 'bottom',
                  position: str = 'bottom',
-                 close_button: str = None
+                 close_button: str = None,
                  ):
                  ):
         """Notification
         """Notification
 
 
@@ -18,7 +19,6 @@ class Notify(Element):
         :param position: position on the screen ("top-left", "top-right", "bottom-left","bottom-right, "top", "bottom", "left", "right" or "center", default: "bottom")
         :param position: position on the screen ("top-left", "top-right", "bottom-left","bottom-right, "top", "bottom", "left", "right" or "center", default: "bottom")
         :param close_button: optional label of a button to dismiss the notification (default: None)
         :param close_button: optional label of a button to dismiss the notification (default: None)
         """
         """
-
         view = jp.QNotify(message=message, position=position, closeBtn=close_button)
         view = jp.QNotify(message=message, position=position, closeBtn=close_button)
 
 
         super().__init__(view)
         super().__init__(view)

+ 1 - 1
nicegui/elements/number.py

@@ -3,6 +3,7 @@ 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,
                  *,
                  *,
@@ -19,7 +20,6 @@ class Number(FloatElement):
         :param format: a string like '%.2f' to format the displayed value
         :param format: a string like '%.2f' to format the displayed value
         :param on_change: callback to execute when the input is confirmed by leaving the focus
         :param on_change: callback to execute when the input is confirmed by leaving the focus
         """
         """
-
         view = jp.QInput(
         view = jp.QInput(
             type='number',
             type='number',
             label=label,
             label=label,

+ 1 - 1
nicegui/elements/plot.py

@@ -3,6 +3,7 @@ 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,
@@ -15,7 +16,6 @@ class Plot(Element):
         :param close: whether the figure should be closed after exiting the context; set to `False` if you want to update it later, default is `True`
         :param close: whether the figure should be closed after exiting the context; set to `False` if you want to update it later, default is `True`
         :param kwargs: arguments like `figsize` which should be passed to `pyplot.figure <https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.figure.html>`_
         :param kwargs: arguments like `figsize` which should be passed to `pyplot.figure <https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.figure.html>`_
         """
         """
-
         self.close = close
         self.close = close
         self.fig = plt.figure(**kwargs)
         self.fig = plt.figure(**kwargs)
 
 

+ 1 - 1
nicegui/elements/radio.py

@@ -3,6 +3,7 @@ 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],
                  *,
                  *,
@@ -15,7 +16,6 @@ class Radio(ChoiceElement):
         :param value: the inital value
         :param value: the inital value
         :param on_change: callback to execute when selection changes
         :param on_change: callback to execute when selection changes
         """
         """
-
         view = jp.QOptionGroup(options=options, input=self.handle_change)
         view = jp.QOptionGroup(options=options, input=self.handle_change)
 
 
         super().__init__(view, options, value=value, on_change=on_change)
         super().__init__(view, options, value=value, on_change=on_change)

+ 5 - 3
nicegui/elements/row.py

@@ -1,14 +1,16 @@
-from nicegui.elements.element import Design
 import justpy as jp
 import justpy as jp
+from .element import Design
 from .group import Group
 from .group import Group
 
 
 class Row(Group):
 class Row(Group):
+
     def __init__(self, design: Design = Design.default):
     def __init__(self, design: Design = Design.default):
         '''Row Element
         '''Row Element
 
 
-        Provides a container which arranges it's child in a row.
+        Provides a container which arranges its child in a row.
 
 
-        :param design: Design.plain does not apply any stylings. If ommitted Design.default configures padding and spacing.
+        :param design: `Design.plain` does not apply any stylings.
+            If ommitted, `Design.default` configures padding and spacing.
         '''
         '''
         if design == design.default:
         if design == design.default:
             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)

+ 2 - 0
nicegui/elements/scene.py

@@ -6,6 +6,7 @@ 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)
@@ -67,6 +68,7 @@ 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

+ 10 - 0
nicegui/elements/scene_objects.py

@@ -3,14 +3,17 @@ 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,
@@ -20,6 +23,7 @@ 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,
@@ -29,6 +33,7 @@ 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,
@@ -40,6 +45,7 @@ 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,
@@ -48,6 +54,7 @@ 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,
@@ -55,6 +62,7 @@ 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],
@@ -62,6 +70,7 @@ 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],
@@ -72,6 +81,7 @@ 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]]]],

+ 1 - 1
nicegui/elements/select.py

@@ -3,6 +3,7 @@ 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],
                  *,
                  *,
@@ -15,7 +16,6 @@ class Select(ChoiceElement):
         :param value: the inital value
         :param value: the inital value
         :param on_change: callback to execute when selection changes
         :param on_change: callback to execute when selection changes
         """
         """
-
         view = jp.QSelect(options=options, input=self.handle_change)
         view = jp.QSelect(options=options, input=self.handle_change)
 
 
         super().__init__(view, options, value=value, on_change=on_change)
         super().__init__(view, options, value=value, on_change=on_change)

+ 1 - 0
nicegui/elements/slider.py

@@ -3,6 +3,7 @@ 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,

+ 1 - 0
nicegui/elements/string_element.py

@@ -3,6 +3,7 @@ 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,
                  *,
                  *,

+ 1 - 1
nicegui/elements/svg.py

@@ -2,6 +2,7 @@ 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 = '',
                  ):
                  ):
@@ -11,7 +12,6 @@ class Svg(Element):
 
 
         :param content: the svg definition
         :param content: the svg definition
         """
         """
-
         view = jp.Div(style="padding:0;width:100%;height:100%")
         view = jp.Div(style="padding:0;width:100%;height:100%")
         super().__init__(view)
         super().__init__(view)
         self.content = content
         self.content = content

+ 1 - 0
nicegui/elements/switch.py

@@ -3,6 +3,7 @@ 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 = '',
                  *,
                  *,

+ 1 - 1
nicegui/elements/toggle.py

@@ -3,6 +3,7 @@ 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],
                  *,
                  *,
@@ -15,7 +16,6 @@ class Toggle(ChoiceElement):
         :param value: the inital value
         :param value: the inital value
         :param on_change: callback to execute when selection changes
         :param on_change: callback to execute when selection changes
         """
         """
-
         view = jp.QBtnToggle(input=self.handle_change)
         view = jp.QBtnToggle(input=self.handle_change)
 
 
         super().__init__(view, options, value=value, on_change=on_change)
         super().__init__(view, options, value=value, on_change=on_change)

+ 1 - 0
nicegui/elements/upload.py

@@ -5,6 +5,7 @@ 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,

+ 11 - 3
nicegui/run.py

@@ -9,11 +9,19 @@ if not config.interactive and config.reload and not inspect.stack()[-2].filename
     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',
     uvicorn.run('nicegui:app', host=config.host, port=config.port, lifespan='on',
-                reload=True, log_level=config.uvicron_logging_level)
+                reload=True, log_level=config.uvicorn_logging_level)
     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: str = '0.0.0.0',
+        port: int = 80,
+        title: str = 'NiceGUI',
+        favicon: str = 'favicon.ico',
+        reload: bool = True,
+        show: bool = True,
+        uvicorn_logging_level: str = 'warning',
+        ):
     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}/')
-        uvicorn.run(jp.app, host=host, port=port, log_level=config.uvicron_logging_level, lifespan='on')
+        uvicorn.run(jp.app, host=host, port=port, log_level=config.uvicorn_logging_level, lifespan='on')

+ 2 - 2
nicegui/ui.py

@@ -46,7 +46,7 @@ class Ui:
     def get(self, path: str):
     def get(self, path: str):
         """
         """
         Use as a decorator for a function like @ui.get('/another/route/{id}').
         Use as a decorator for a function like @ui.get('/another/route/{id}').
-        :param path: String that starts with a '/'.
+        :param path: string that starts with a '/'
         :return:
         :return:
         """
         """
         def decorator(func):
         def decorator(func):
@@ -57,7 +57,7 @@ class Ui:
 
 
     def add_route(self, route):
     def add_route(self, route):
         """
         """
-        :param route: A starlette Route including a path and a function to be called.
+        :param route: starlette route including a path and a function to be called
         :return:
         :return:
         """
         """
         self.app.routes.insert(0, route)
         self.app.routes.insert(0, route)

+ 4 - 0
nicegui/utils.py

@@ -2,11 +2,13 @@ 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)
 
 
+
 def provide_arguments(func, *keys):
 def provide_arguments(func, *keys):
     def inner_function(sender, event):
     def inner_function(sender, event):
         try:
         try:
@@ -15,6 +17,7 @@ def provide_arguments(func, *keys):
             return func(EventArguments(sender, **{key: event[key] for key in keys}))
             return func(EventArguments(sender, **{key: event[key] for key in keys}))
     return inner_function
     return inner_function
 
 
+
 def handle_exceptions(func):
 def handle_exceptions(func):
     def inner_function(*args, **kwargs):
     def inner_function(*args, **kwargs):
         try:
         try:
@@ -23,6 +26,7 @@ def handle_exceptions(func):
             traceback.print_exc()
             traceback.print_exc()
     return inner_function
     return inner_function
 
 
+
 def handle_awaitable(func):
 def handle_awaitable(func):
     async def inner_function(*args, **kwargs):
     async def inner_function(*args, **kwargs):
         if asyncio.iscoroutinefunction(func):
         if asyncio.iscoroutinefunction(func):