Skip to content

Commit 56d89d1

Browse files
committed
Update pywebview requirement to avoid crash on older macOS
1 parent 2445c23 commit 56d89d1

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

emailproxy.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2461,10 +2461,13 @@ def handle_authorisation_windows(self):
24612461
setattr(webview.platforms.cocoa.BrowserView.BrowserDelegate, 'webView_didReceiveServerRedirectForProvisional'
24622462
'Navigation_',
24632463
ProvisionalNavigationBrowserDelegate.webView_didReceiveServerRedirectForProvisionalNavigation_)
2464-
setattr(webview.platforms.cocoa.BrowserView.WebKitHost, 'performKeyEquivalentBase_',
2465-
webview.platforms.cocoa.BrowserView.WebKitHost.performKeyEquivalent_)
2466-
setattr(webview.platforms.cocoa.BrowserView.WebKitHost, 'performKeyEquivalent_',
2467-
ProvisionalNavigationBrowserDelegate.performKeyEquivalent_)
2464+
try:
2465+
setattr(webview.platforms.cocoa.BrowserView.WebKitHost, 'performKeyEquivalentBase_',
2466+
webview.platforms.cocoa.BrowserView.WebKitHost.performKeyEquivalent_)
2467+
setattr(webview.platforms.cocoa.BrowserView.WebKitHost, 'performKeyEquivalent_',
2468+
ProvisionalNavigationBrowserDelegate.performKeyEquivalent_)
2469+
except TypeError:
2470+
pass
24682471

24692472
# also needed only on macOS because otherwise closing the last remaining webview window exits the application
24702473
dummy_window = webview.create_window('%s hidden (dummy) window' % APP_NAME, html='<html></html>', hidden=True)

requirements.txt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,10 @@ timeago # for displaying the last authenticated activity hint
88
# force pystray version with dummy GUI fix for headless deployments (https://github.com/moses-palmer/pystray/issues/118)
99
pystray>=0.19.4
1010

11-
# force pywebview 4.0.2+ on Windows to fix PyInstaller/pythonw issue (https://github.com/r0x0r/pywebview/issues/1044)
12-
pywebview; sys_platform != 'win32' # (specify platform to avoid double requirement error with older pip versions)
13-
pywebview>=4.0.2; sys_platform == 'win32'
11+
# force pywebview 4.0.2+ to fix Windows issue with PyInstaller/pythonw (https://github.com/r0x0r/pywebview/issues/1044)
12+
# and macOS pre-Mojave crash when opening browser windows (https://github.com/r0x0r/pywebview/pull/1047) - we could do,
13+
# e.g., platform_release < '18' to allow Linux and other macOS versions more flexibility, but that seems over-the-top
14+
pywebview>=4.0.2
1415

1516
# macOS: improve menu bar interaction, provide native notifications and handle system events
1617
pyobjc-framework-Cocoa; sys_platform == 'darwin'

0 commit comments

Comments
 (0)