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):