From 306235433855ee9aec4c587830240747dff7deb6 Mon Sep 17 00:00:00 2001 From: yutent Date: Wed, 13 Sep 2023 14:04:51 +0800 Subject: [PATCH] =?UTF-8?q?js=E6=B3=A8=E5=85=A5=E6=94=B9=E4=B8=BA=E5=BC=80?= =?UTF-8?q?=E5=A7=8B=E6=97=B6=E6=B3=A8=E5=85=A5,=20=E7=AA=97=E5=8F=A3?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0hide=E5=92=8Cshow=202=E4=B8=AA=E5=9B=9E?= =?UTF-8?q?=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- usr/lib/python3/dist-packages/webengine/gtk3/_inject.py | 2 +- usr/lib/python3/dist-packages/webengine/gtk3/_webengine.py | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/usr/lib/python3/dist-packages/webengine/gtk3/_inject.py b/usr/lib/python3/dist-packages/webengine/gtk3/_inject.py index 69e197e..0f448ca 100644 --- a/usr/lib/python3/dist-packages/webengine/gtk3/_inject.py +++ b/usr/lib/python3/dist-packages/webengine/gtk3/_inject.py @@ -17,7 +17,7 @@ class Inject: code = open(self.abspath('./inject.js'), 'r').read() frame = WebKit2.UserContentInjectedFrames.ALL_FRAMES - time = WebKit2.UserScriptInjectionTime.END + time = WebKit2.UserScriptInjectionTime.START code = code.replace("'{{env}}'", json.dumps(env)) code = code.replace("{{uuid}}", webview.uuid) diff --git a/usr/lib/python3/dist-packages/webengine/gtk3/_webengine.py b/usr/lib/python3/dist-packages/webengine/gtk3/_webengine.py index a82f925..fd354f5 100644 --- a/usr/lib/python3/dist-packages/webengine/gtk3/_webengine.py +++ b/usr/lib/python3/dist-packages/webengine/gtk3/_webengine.py @@ -96,7 +96,11 @@ class WebEngine(WebKit2.WebView): # 允许前端 widnow.close() 关闭窗口 self.connect('close', self.close_window) - win.connect("destroy", self.remove_from_opener) # 通过外部关闭窗口时从父级中移除 + + # 通过外部关闭窗口时从父级中移除 + win.connect("destroy", self.remove_from_opener) + win.connect('hide', lambda w: self.call_js('hide')) + win.connect('show', lambda w: self.call_js('show')) def remove_from_opener(self, win = None):