eric6_browser: added a '--quiet' option to suppress startup error messages.

Fri, 14 Dec 2018 19:51:12 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Fri, 14 Dec 2018 19:51:12 +0100
changeset 6628
c3f0f6bffd21
parent 6627
acd62f281a99
child 6629
643ec3a53d17

eric6_browser: added a '--quiet' option to suppress startup error messages.

eric6_browser.py file | annotate | diff | comparison | revisions
--- a/eric6_browser.py	Fri Dec 14 19:49:55 2018 +0100
+++ b/eric6_browser.py	Fri Dec 14 19:51:12 2018 +0100
@@ -37,16 +37,17 @@
 
 
 if qVersionTuple() < (5, 6, 0):
-    from PyQt5.QtCore import QTimer
-    from PyQt5.QtWidgets import QApplication
-    from E5Gui import E5MessageBox
-    app = QApplication([])
-    QTimer.singleShot(0, lambda: E5MessageBox.critical(
-        None,
-        "eric6 Web Browser",
-        "You need at least Qt Version 5.6.0 to execute the web browser.")
-    )
-    app.exec_()
+    if "--quiet" not in sys.argv:
+        from PyQt5.QtCore import QTimer
+        from PyQt5.QtWidgets import QApplication
+        from E5Gui import E5MessageBox
+        app = QApplication([])
+        QTimer.singleShot(0, lambda: E5MessageBox.critical(
+            None,
+            "eric6 Web Browser",
+            "You need at least Qt Version 5.6.0 to execute the web browser.")
+        )
+        app.exec_()
     sys.exit(100)
 
 SettingsDir = None
@@ -75,16 +76,17 @@
 try:
     from PyQt5 import QtWebEngineWidgets    # __IGNORE_WARNING__
 except ImportError:
-    from PyQt5.QtCore import QTimer
-    from PyQt5.QtWidgets import QApplication
-    from E5Gui import E5MessageBox          # __IGNORE_WARNING__
-    app = QApplication([])
-    QTimer.singleShot(0, lambda: E5MessageBox.critical(
-        None,
-        "eric6 Web Browser",
-        "QtWebEngineWidgets is not installed but needed to execute the"
-        " web browser."))
-    app.exec_()
+    if "--quiet" not in sys.argv:
+        from PyQt5.QtCore import QTimer
+        from PyQt5.QtWidgets import QApplication
+        from E5Gui import E5MessageBox          # __IGNORE_WARNING__
+        app = QApplication([])
+        QTimer.singleShot(0, lambda: E5MessageBox.critical(
+            None,
+            "eric6 Web Browser",
+            "QtWebEngineWidgets is not installed but needed to execute the"
+            " web browser."))
+        app.exec_()
     sys.exit(100)
 
 import Globals
@@ -129,6 +131,9 @@
         elif arg == "--qthelp":
             qthelp = True
             argv.remove(arg)
+        elif arg == "--quiet":
+            # only needed until we reach this point
+            argv.remove(arg)
         elif arg == "--single":
             single = True
             argv.remove(arg)
@@ -156,6 +161,7 @@
          "use the given directory as the one containing the config files"),
         ("--private", "start the browser in private browsing mode"),
         ("--qthelp", "start the browser with support for QtHelp"),
+        ("--quiet", "don't show any startup error messages"),
         ("--search=word", "search for the given word"),
         ("--settings=settingsDir",
          "use the given directory to store the settings files"),

eric ide

mercurial