manuskript/manuskript/ui/views/webView.py
Jan Wester 239e66e7cb Comprehensively log all version information
Manuskript now logs the versions of modules and libraries powering them
for as far those are easily accessible. This includes all the optional
modules, too. None of this is visible on the terminal of course - unless
Manuskript is run with the --verbose flag. This clears up the last bit
of unnecessary console spam, leaving our users blissfully unaware.

Until we (and/or Qt) break something again, that is...
2021-04-08 18:44:28 +02:00

35 lines
846 B
Python

#!/usr/bin/env python
# --!-- coding: utf8 --!--
import PyQt5
import os
features = {'qtwebkit': False, 'qtwebengine': False}
if 'QT_WEB' in os.environ:
features[os.environ['QT_WEB']] = True
else:
try:
import PyQt5.QtWebKitWidgets
features['qtwebkit'] = True
except:
features['qtwebkit'] = False
try:
import PyQt5.QtWebEngineWidgets
features['qtwebengine'] = True
except:
features['qtwebengine'] = False
if features['qtwebkit']:
from PyQt5.QtWebKitWidgets import QWebView
webEngine = "QtWebKit"
webView = QWebView
elif features['qtwebengine']:
from PyQt5 import QtWebEngineWidgets
webEngine = "QtWebEngine"
webView = QtWebEngineWidgets.QWebEngineView
else:
from PyQt5.QtWidgets import QTextEdit
webEngine = "QTextEdit"
webView = QTextEdit