js注入改为开始时注入, 窗口增加hide和show 2个回调
parent
ece744aafe
commit
3062354338
|
@ -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)
|
||||
|
|
|
@ -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):
|
||||
|
|
Loading…
Reference in New Issue