Procházet zdrojové kódy

allowing to set main page classes via run config

Rodja Trappe před 3 roky
rodič
revize
e1fc99ca65
3 změnil soubory, kde provedl 3 přidání a 1 odebrání
  1. 1 0
      nicegui/config.py
  2. 1 1
      nicegui/nicegui.py
  3. 1 0
      nicegui/run.py

+ 1 - 0
nicegui/config.py

@@ -14,6 +14,7 @@ class Config(BaseModel):
     show: bool = True
     uvicorn_logging_level = 'warning'
     interactive: bool = False
+    main_page_classes = 'q-ma-md column items-start'
 
 
 excluded_endings = (

+ 1 - 1
nicegui/nicegui.py

@@ -33,6 +33,6 @@ def safe_invoke(func: Callable):
 app = globals.app = jp.app
 ui = Ui()
 
-page = ui.page('/')
+page = ui.page('/', classes=globals.config.main_page_classes)
 page.__enter__()
 jp.justpy(lambda: page, start_server=False)

+ 1 - 0
nicegui/run.py

@@ -20,6 +20,7 @@ def run(self, *,
         reload: bool = True,
         show: bool = True,
         uvicorn_logging_level: str = 'warning',
+        main_page_classes: str = 'q-ma-md column items-start',
         ):
 
     if globals.config.interactive or reload == False:  # NOTE: if reload == True we already started uvicorn above