src/eric7/eric7_browser.py

branch
eric7
changeset 10308
d19766190e17
parent 10303
ee1aadab1215
child 10321
4a017fdf316f
--- a/src/eric7/eric7_browser.py	Mon Nov 13 17:38:06 2023 +0100
+++ b/src/eric7/eric7_browser.py	Mon Nov 13 19:18:38 2023 +0100
@@ -12,102 +12,13 @@
 of the integrated web browser. It is based on QtWebEngine.
 """
 
-import argparse
 import os
 import sys
 
 from PyQt6.QtGui import QGuiApplication
 
 from eric7 import Globals
-
-
-def createArgparseNamespace():
-    """
-    Function to create an argument parser.
-
-    @return created argument parser object
-    @rtype argparse.ArgumentParser
-    """
-    from eric7.UI.Info import Version
-
-    # 1. create the argument parser
-    parser = argparse.ArgumentParser(
-        description="Web Browser application of the eric tool suite.",
-        epilog="Copyright (c) 2002 - 2023 Detlev Offenbach <detlev@die-offenbachs.de>.",
-    )
-
-    # 2. add the arguments
-    parser.add_argument(
-        "-V",
-        "--version",
-        action="version",
-        version="%(prog)s {0}".format(Version),
-        help="show version information and exit",
-    )
-    parser.add_argument(
-        "--config",
-        metavar="config_dir",
-        help="use the given directory as the one containing the config files",
-    )
-    parser.add_argument(
-        "--settings",
-        metavar="settings_dir",
-        help="use the given directory to store the settings files",
-    )
-    parser.add_argument(
-        "--name",
-        metavar="browser name",
-        default="",
-        help="name to be used for the browser instance",
-    )
-    parser.add_argument(
-        "--new-tab",
-        metavar="URL",
-        action="append",
-        help="open a new tab for the given URL",
-    )
-    parser.add_argument(
-        "--private",
-        action="store_true",
-        help="start the browser in private browsing mode",
-    )
-    parser.add_argument(
-        "--qthelp",
-        action="store_true",
-        help="start the browser with support for QtHelp",
-    )
-    parser.add_argument(
-        "--quiet",
-        action="store_true",
-        help="don't show any startup error messages",
-    )
-    parser.add_argument(
-        "--search",
-        metavar="searchword",
-        help="search for the given word",
-    )
-    parser.add_argument(
-        "--shutdown",
-        action="store_true",
-        help="shut down the browser instance",
-    )
-    parser.add_argument(
-        "--single",
-        action="store_true",
-        help="start the browser as a single application",
-    )
-    parser.add_argument(
-        "home",
-        nargs="?",
-        default="",
-        metavar="file | URL",
-        help="open a file or URL",
-    )
-
-    # 3. create the Namespace object by parsing the command line
-    args = parser.parse_args()
-    return args
-
+from eric7.WebBrowser.WebBrowserArgumentsCreator import createArgparseNamespace
 
 args = createArgparseNamespace()
 if args.config:
@@ -200,7 +111,7 @@
         | QWebEngineUrlScheme.Flag.ContentSecurityPolicyIgnored
     )
     QWebEngineUrlScheme.registerScheme(scheme)
-    if "--qthelp" in sys.argv:
+    if args.qthelp:
         scheme = QWebEngineUrlScheme(b"qthelp")
         scheme.setSyntax(QWebEngineUrlScheme.Syntax.Path)
         scheme.setFlags(QWebEngineUrlScheme.Flag.SecureScheme)

eric ide

mercurial