Quellcode durchsuchen

added frameless parameter and changed exception catch

smug vor 1 Jahr
Ursprung
Commit
d62eb74add
1 geänderte Dateien mit 6 neuen und 5 gelöschten Zeilen
  1. 6 5
      nicegui/native_mode.py

+ 6 - 5
nicegui/native_mode.py

@@ -25,13 +25,14 @@ except ModuleNotFoundError:
 
 
 def open_window(
-    host: str, port: int, title: str, width: int, height: int, fullscreen: bool,
+    host: str, port: int, title: str, width: int, height: int, fullscreen: bool, frameless: bool,
     method_queue: mp.Queue, response_queue: mp.Queue,
 ) -> None:
     while not helpers.is_port_open(host, port):
         time.sleep(0.1)
 
-    window_kwargs = dict(url=f'http://{host}:{port}', title=title, width=width, height=height, fullscreen=fullscreen)
+    window_kwargs = dict(url=f'http://{host}:{port}', title=title, width=width,
+                         height=height, fullscreen=fullscreen, frameless=frameless)
     window_kwargs.update(globals.app.native.window_args)
 
     try:
@@ -40,7 +41,7 @@ def open_window(
         window.events.closing += closing.set
         start_window_method_executor(window, method_queue, response_queue, closing)
         webview.start(storage_path=tempfile.mkdtemp(), **globals.app.native.start_args)
-    except NameError:
+    except AttributeError:
         logging.error('''Native mode is not supported in this configuration.
 Please run "pip install pywebview" to use it.''')
         sys.exit(1)
@@ -90,7 +91,7 @@ def start_window_method_executor(
     Thread(target=window_method_executor).start()
 
 
-def activate(host: str, port: int, title: str, width: int, height: int, fullscreen: bool) -> None:
+def activate(host: str, port: int, title: str, width: int, height: int, fullscreen: bool, frameless: bool) -> None:
     def check_shutdown() -> None:
         while process.is_alive():
             time.sleep(0.1)
@@ -100,7 +101,7 @@ def activate(host: str, port: int, title: str, width: int, height: int, fullscre
         _thread.interrupt_main()
 
     mp.freeze_support()
-    args = host, port, title, width, height, fullscreen, native.method_queue, native.response_queue
+    args = host, port, title, width, height, fullscreen, frameless, native.method_queue, native.response_queue
     process = mp.Process(target=open_window, args=args, daemon=False)
     process.start()