-
Notifications
You must be signed in to change notification settings - Fork 607
Edge app #663
base: main
Are you sure you want to change the base?
Edge app #663
Changes from 1 commit
0ea5a25
0c243dd
463f81d
6085773
4c86c90
d69ae82
1fb06d7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
…issue fix
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,31 +2,38 @@ | |
| import subprocess as sps | ||
| import sys | ||
|
|
||
| name = 'Edge' | ||
| name = "Edge" | ||
|
|
||
|
|
||
| def run(path, options, start_urls): | ||
| if path != 'edge_legacy': | ||
| if options['app_mode']: | ||
| if path != "edge_legacy": | ||
| 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) | ||
| 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=sys.stderr, stdin=sps.PIPE) | ||
| 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=sys.stdout, stderr=sys.stderr, stdin=sps.PIPE, shell=True) | ||
| 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(): | ||
| if sys.platform in ['win32', 'win64']: | ||
| if sys.platform in ["win32", "win64"]: | ||
| return _find_edge_win() | ||
| else: | ||
| return None | ||
|
|
||
|
|
||
| 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' | ||
|
|
||
| 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: | ||
|
|
@@ -36,8 +43,8 @@ def _find_edge_win(): | |
| if not os.path.isfile(edge_path): | ||
| continue | ||
| except WindowsError: | ||
| edge_path = 'edge_legacy' | ||
| edge_path = "edge_legacy" | ||
| else: | ||
| break | ||
|
|
||
| return edge_path | ||
| 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.
I would propose passing back the string
'start microsoft-edge'from _find_edge_win(). For two reasons:None.