Skip to content

Commit

Permalink
Added app mode support for micorsoft edge, IE mode for internet explo…
Browse files Browse the repository at this point in the history
…rer and increase timeout for test run. (#744)

* Added msie mode for internet explorer and fixed app mode for edge browser.

Added MSIE mode to support device which does not have edge installed by default ( win <10).

Added support in edge to support edge mode or new window mode if app mode is not requested.
  • Loading branch information
Meenapintu authored Nov 19, 2024
1 parent 27ddbbe commit 094d446
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
- name: Setup test execution environment.
run: pip3 install -r requirements-meta.txt
- name: Run tox tests
run: tox -- --durations=0 --timeout=30
run: tox -- --durations=0 --timeout=240

typecheck:
strategy:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ Additional options can be passed to `eel.start()` as keyword arguments.
Some of the options include the mode the app is in (e.g. 'chrome'), the port the app runs on, the host name of the app, and adding additional command line flags.

As of Eel v0.12.0, the following options are available to `start()`:
- **mode**, a string specifying what browser to use (e.g. `'chrome'`, `'electron'`, `'edge'`, `'custom'`). Can also be `None` or `False` to not open a window. *Default: `'chrome'`*
- **mode**, a string specifying what browser to use (e.g. `'chrome'`, `'electron'`, `'edge'`,`'msie'`, `'custom'`). Can also be `None` or `False` to not open a window. *Default: `'chrome'`*
- **host**, a string specifying what hostname to use for the Bottle server. *Default: `'localhost'`)*
- **port**, an int specifying what port to use for the Bottle server. Use `0` for port to be picked automatically. *Default: `8000`*.
- **block**, a bool saying whether or not the call to `start()` should block the calling thread. *Default: `True`*
Expand Down
4 changes: 3 additions & 1 deletion eel/browsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@
import eel.chrome as chm
import eel.electron as ele
import eel.edge as edge
import eel.msIE as ie
#import eel.firefox as ffx TODO
#import eel.safari as saf TODO

_browser_paths: Dict[str, str] = {}
_browser_modules: Dict[str, ModuleType] = {'chrome': chm,
'electron': ele,
'edge': edge}
'edge': edge,
'msie':ie}


def _build_url_from_dict(page: Dict[str, str], options: OptionsDictT) -> str:
Expand Down
13 changes: 10 additions & 3 deletions eel/edge.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,16 @@


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)

if not isinstance(options['cmdline_args'], list):
raise TypeError("'cmdline_args' option must be of type List[str]")
args: List[str] = options['cmdline_args']
if options['app_mode']:
cmd = 'start msedge --app={} '.format(start_urls[0])
cmd = cmd + (" ".join(args))
sps.Popen(cmd, stdout=sys.stdout, stderr=sys.stderr, stdin=sps.PIPE, shell=True)
else:
cmd = "start msedge --new-window "+(" ".join(args)) +" "+(start_urls[0])
sps.Popen(cmd,stdout=sys.stdout, stderr=sys.stderr, stdin=sps.PIPE, shell=True)

def find_path() -> bool:
if platform.system() == 'Windows':
Expand Down
20 changes: 20 additions & 0 deletions eel/msIE.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import platform
import subprocess as sps
import sys
from typing import List

from eel.types import OptionsDictT

name: str = 'MSIE'


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 find_path() -> bool:
if platform.system() == 'Windows':
return True

return False

0 comments on commit 094d446

Please sign in to comment.