Exemplo n.º 1
0
def _new_webbrowser_profile():
    if is_command("google-chrome"):
        return _make_chrome("google-chrome")
    elif is_command("firefox"):
        new_firefox = webbrowser.Mozilla()
        new_firefox.name = "firefox"
        profile_directory = tempfile.mkdtemp()
        new_firefox.remote_args = [
            "-profile",
            profile_directory,
            "-new-instance",
            "-no-remote",
            "-url",
            "%s",
        ]
        return new_firefox
    elif sys.platform == "darwin":
        config = get_config()
        chrome_path = config.get("chrome-path")
        if os.path.exists(chrome_path):
            return _make_chrome(chrome_path)
        else:
            return webbrowser
    else:
        return webbrowser
Exemplo n.º 2
0
def new_webbrowser_profile():
    if is_command("google-chrome"):
        webbrowser = _make_chrome()
    elif is_command("firefox"):
        webbrowser = _make_firefox()
    elif sys.platform == "darwin":
        chrome_path = config.get("chrome-path")
        if os.path.exists(chrome_path):
            webbrowser = _make_chrome()
        else:
            # Assumption firefox exists
            webbrowser = _make_firefox()
    else:
        # Assumption firefox exists
        webbrowser = _make_firefox()

    browsers.append(webbrowser)
    return webbrowser
Exemplo n.º 3
0
def new_webbrowser_profile():
    if is_command('google-chrome'):
        new_chrome = webbrowser.Chrome()
        new_chrome.name = 'google-chrome'
        profile_directory = tempfile.mkdtemp()
        new_chrome.remote_args = webbrowser.Chrome.remote_args + [
            '--user-data-dir="{}"'.format(profile_directory)
        ]
        return new_chrome
    elif is_command('firefox'):
        new_firefox = webbrowser.Mozilla()
        new_firefox.name = 'firefox'
        profile_directory = tempfile.mkdtemp()
        new_firefox.remote_args = [
            '-profile',
            profile_directory,
            '-new-instance',
            '-no-remote',
            '-url',
            '%s',
        ]
        return new_firefox
    else:
        return webbrowser