Переглянути джерело

provide get/set for "always_on_top"

Rodja Trappe 2 роки тому
батько
коміт
9989d217bc
2 змінених файлів з 14 додано та 0 видалено
  1. 8 0
      nicegui/native.py
  2. 6 0
      nicegui/native_mode.py

+ 8 - 0
nicegui/native.py

@@ -19,6 +19,14 @@ class WindowProxy(webview.Window):
     def __init__(self):
         pass  # NOTE we don't call super().__init__ here because this is just a proxy to the actual window
 
+    async def is_always_on_top(self) -> bool:
+        """whether the window is always on top"""
+        return await self._send_async()
+
+    def set_always_on_top(self, on_top: bool) -> None:
+        """set whether the window is always on top"""
+        self._send(on_top)
+
     async def get_size(self) -> Tuple[int, int]:
         return await self._send_async()
 

+ 6 - 0
nicegui/native_mode.py

@@ -60,6 +60,12 @@ def start_window_method_executor(
                         while pending_executions:
                             pending_executions.pop().join()
                     continue
+                if method == 'is_always_on_top':
+                    response_queue.put(window.on_top)
+                    continue
+                if method == 'set_always_on_top':
+                    window.on_top = args[0]
+                    continue
                 if method == 'get_position':
                     response_queue.put((int(window.x), int(window.y)))
                     continue