Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 603
Edge app#663
base:main
Are you sure you want to change the base?
Uh oh!
There was an error while loading. Please reload this page.
Edge app #663
Changes from all commits
0ea5a250c243dd463f81d60857734c86c90d69ae821fb06d7File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -9,3 +9,4 @@ Eel.egg-info | ||
| *.swp | ||
| venv/ | ||
| .tox | ||
| .vscode | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,20 +1,48 @@ | ||
| import platform | ||
| import os | ||
| import subprocess as sps | ||
| import sys | ||
| from typing import List | ||
| from eel.types import OptionsDictT | ||
| name: str = 'Edge' | ||
| name: str = "Edge" | ||
| def run(_path: str, options: OptionsDictT, start_urls: List[str]) -> None: | ||
| cmd = 'start microsoft-edge:{}'.format(start_urls[0]) | ||
| sps.Popen(cmd, stdout=sys.stdout, stderr=sys.stderr, stdin=sps.PIPE, shell=True) | ||
| def run(path: str, options: OptionsDictT, start_urls: List[str]) -> None: | ||
| if path != "edge_legacy": | ||
Contributor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would propose passing back the string
| ||
| if options["app_mode"]: | ||
| for url in start_urls: | ||
| sps.Popen([path, "--app=%s" % url] + options["cmdline_args"], stdout=sps.PIPE, stderr=sps.PIPE, stdin=sps.PIPE) | ||
Contributor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For consistency I'd suggest you break the long lines here for the calls to | ||
| else: | ||
| args = options["cmdline_args"] + start_urls | ||
| sps.Popen([path, "--new-window"] + args, stdout=sps.PIPE, stderr=sps.PIPE, stdin=sps.PIPE) | ||
| else: | ||
| cmd = "start microsoft-edge:{}".format(start_urls[0]) | ||
| sps.Popen(cmd, stdout=sps.PIPE, stderr=sps.PIPE, stdin=sps.PIPE, shell=True) | ||
| def find_path() -> bool: | ||
Contributor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
| ||
| if platform.system() == 'Windows': | ||
| return True | ||
| if sys.platform in ["win32", "win64"]: | ||
| return _find_edge_win() | ||
| else: | ||
| return None | ||
| return False | ||
| def _find_edge_win(): | ||
Contributor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This function needs a return type annotation, | ||
| import winreg as reg | ||
| reg_path = r"SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\msedge.exe" | ||
Contributor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. While semi-obvious, it would be good to annotate | ||
| for install_type in reg.HKEY_CURRENT_USER, reg.HKEY_LOCAL_MACHINE: | ||
| try: | ||
| reg_key = reg.OpenKey(install_type, reg_path, 0, reg.KEY_READ) | ||
| edge_path = reg.QueryValue(reg_key, None) | ||
| reg_key.Close() | ||
| if not os.path.isfile(edge_path): | ||
| continue | ||
| except WindowsError: | ||
| edge_path = "edge_legacy" | ||
| else: | ||
| break | ||
| return edge_path | ||
Contributor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see two potential issues with this loop:
| ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Although admittedly there are a few inconsistencies, the eel package generally prefers single quotes for strings. I think it would be good if you could change these back throughout.