Skip to content

Commit 13b1ee5

Browse files
authored
Force WebView2 backend on Windows and drop winforms import (#46)
1 parent 94c2172 commit 13b1ee5

2 files changed

Lines changed: 15 additions & 8 deletions

File tree

VinylFlow.spec

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,23 @@ if not FFMPEG_PATH:
1313

1414
DATA_FILES = [('backend/static', 'backend/static')]
1515

16+
HIDDEN_IMPORTS = [
17+
'backend.api',
18+
'webview',
19+
]
20+
21+
if sys.platform.startswith('win'):
22+
HIDDEN_IMPORTS.append('webview.platforms.edgechromium')
23+
elif sys.platform == 'darwin':
24+
HIDDEN_IMPORTS.append('webview.platforms.cocoa')
25+
1626

1727
a = Analysis(
1828
['desktop_launcher.py'],
1929
pathex=[],
2030
binaries=[(FFMPEG_PATH, 'ffmpeg_bin')],
2131
datas=DATA_FILES,
22-
hiddenimports=[
23-
'backend.api',
24-
'webview',
25-
'webview.platforms.cocoa',
26-
'webview.platforms.edgechromium',
27-
'webview.platforms.winforms',
28-
],
32+
hiddenimports=HIDDEN_IMPORTS,
2933
hookspath=[],
3034
hooksconfig={},
3135
runtime_hooks=[],

desktop_launcher.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,10 @@ def main() -> None:
134134
min_size=(900, 700),
135135
js_api=DesktopApi(),
136136
)
137-
webview.start()
137+
if sys.platform.startswith("win"):
138+
webview.start(gui="edgechromium")
139+
else:
140+
webview.start()
138141

139142

140143
if __name__ == "__main__":

0 commit comments

Comments
 (0)