Skip to content

Commit

Permalink
[CEF] fix master uid not found
Browse files Browse the repository at this point in the history
  • Loading branch information
r0x0r committed Oct 27, 2022
1 parent c0bc9d8 commit dfd554c
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 17 deletions.
15 changes: 8 additions & 7 deletions docs/examples/on_top.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
# Topmost window

Create a window that stays on top of, or in front of, other windows.
Create a window that stays on top of other windows.

``` python
import pywebview
import webview
import time


def deactivate(window):
#window starts on top and is changed later
time.sleep(5)
#window starts as on top of and reverts back to normal after 20 seconds
time.sleep(20)
window.on_top = False
window.load_html("<h1>This window is no longer on top of other windows</h1>")


if __name__ == '__main__':
# Create webview window that stays on top of, or in front of, all other windows
window = webview.create_window('Topmost window',
'https://pywebview.flowrl.com/hello',
# Create webview window that stays on top of, all other windows
window = webview.create_window('Topmost window', html="<h1>This window is on top of other windows</h1>",
on_top=True)
webview.start(deactivate, window)
```
10 changes: 5 additions & 5 deletions examples/on_top.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
"""

def deactivate(window):
#window starts on top and is changed later
time.sleep(5)
#window starts as on top of and reverts back to normal after 20 seconds
time.sleep(20)
window.on_top = False
window.load_html("<h1>This window is no longer on top of other windows</h1>")


if __name__ == '__main__':
# Create webview window that stays on top of, or in front of, all other windows
window = webview.create_window('Topmost window',
'https://pywebview.flowrl.com/hello',
# Create webview window that stays on top of, all other windows
window = webview.create_window('Topmost window', html="<h1>This window is on top of other windows</h1>",
on_top=True)
webview.start(deactivate, window)
3 changes: 2 additions & 1 deletion webview/platforms/cef.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,9 +258,10 @@ def _create():

cef_browser.SetJavascriptBindings(bindings)
cef_browser.SetClientHandler(LoadHandler())

instances[window.uid] = browser
window.events.shown.set()
cef_browser.SendFocusEvent(True)


window_info = cef.WindowInfo()
window_info.SetAsChild(handle)
Expand Down
7 changes: 3 additions & 4 deletions webview/platforms/winforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,10 +238,9 @@ def on_activated(self, sender, args):
CEF.focus(self.uid)

def on_shown(self, sender, args):
if is_cef:
CEF.focus(self.uid)
else:
self.shown.set()
self.shown.set()

if not is_cef:
self.browser.web_view.Focus()

def on_close(self, sender, args):
Expand Down

0 comments on commit dfd554c

Please sign in to comment.