Globals/__init__.py

changeset 6630
bddd12f27a4c
parent 6589
613426e62983
child 6645
ad476851d7e0
--- a/Globals/__init__.py	Fri Dec 14 19:52:38 2018 +0100
+++ b/Globals/__init__.py	Sat Dec 15 16:21:38 2018 +0100
@@ -12,6 +12,10 @@
 #
 
 from __future__ import unicode_literals
+try:
+    str = unicode       # __IGNORE_EXCEPTION__
+except NameError:
+    pass
 
 import sys
 import os
@@ -19,7 +23,7 @@
 import shutil
 
 from PyQt5.QtCore import QDir, QLibraryInfo, QByteArray, QCoreApplication, \
-    QT_VERSION_STR, QT_VERSION
+    QT_VERSION_STR, QT_VERSION, QProcess, qVersion
 
 # names of the various settings objects
 settingsNameOrganization = "Eric6"
@@ -468,5 +472,29 @@
     else:
         return value
 
+
+###############################################################################
+## functions for web browser variant detection
+###############################################################################
+
+
+def getWebBrowserSupport():
+    """
+    Module function to determine the supported web browser variant.
+    
+    @return string indicating the supported web browser variant ("QtWebEngine",
+        "QtWebKit" or "None")
+    @rtype str
+    """
+    from eric6config import getConfig
+    scriptPath = os.path.join(getConfig("ericDir"), "Tools",
+                              "webBrowserSupport.py")
+    proc = QProcess()
+    proc.start(sys.executable, [scriptPath, qVersion()])
+    if proc.waitForFinished(10000):
+        variant = str(proc.readAllStandardOutput(), "utf-8", 'replace').strip()
+    else:
+        variant = "None"
+    return variant
 #
 # eflag: noqa = M801

eric ide

mercurial