Browse Source

Merge branch 'main' of github.com:zauberzeug/nicegui

Falko Schindler 1 year ago
parent
commit
e744d012c4

+ 1 - 0
nicegui/native/native_config.py

@@ -9,4 +9,5 @@ from .native import WindowProxy
 class NativeConfig:
     start_args: Dict[str, Any] = field(default_factory=dict)
     window_args: Dict[str, Any] = field(default_factory=dict)
+    settings: Dict[str, Any] = field(default_factory=dict)
     main_window: Optional[WindowProxy] = None

+ 1 - 0
nicegui/native/native_mode.py

@@ -42,6 +42,7 @@ def _open_window(
         'frameless': frameless,
         **core.app.native.window_args,
     }
+    webview.settings.update(**core.app.native.settings)
     window = webview.create_window(**window_kwargs)
     closed = Event()
     window.events.closed += closed.set

+ 3 - 0
website/documentation/content/section_configuration_deployment.py

@@ -33,6 +33,8 @@ doc.intro(run_documentation)
     for the `webview.create_window` and `webview.start` functions.
     Note that these keyword arguments will take precedence over the parameters defined in `ui.run`.
 
+    Additionally, you can change `webview.settings` via `app.native.settings`.
+
     In native mode the `app.native.main_window` object allows you to access the underlying window.
     It is an async version of [`Window` from pywebview](https://pywebview.flowrl.com/guide/api.html#window-object).
 ''', tab=lambda: ui.label('NiceGUI'))
@@ -41,6 +43,7 @@ def native_mode_demo():
 
     app.native.window_args['resizable'] = False
     app.native.start_args['debug'] = True
+    app.native.settings['ALLOW_DOWNLOADS'] = True
 
     ui.label('app running in native mode')
     # ui.button('enlarge', on_click=lambda: app.native.main_window.resize(1000, 700))