forked from minorua/Qgis2threejs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
q3dview.py
53 lines (39 loc) · 1.27 KB
/
q3dview.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# -*- coding: utf-8 -*-
# (C) 2023 Minoru Akagi
# SPDX-License-Identifier: GPL-2.0-or-later
# begin: 2023-10-03
from .conf import PREFER_WEBKIT
from .tools import logMessage
USE_WEBKIT = False
USE_WEBENGINE = False
if PREFER_WEBKIT:
try:
from PyQt5.QtWebKitWidgets import QWebView
USE_WEBKIT = True
except ModuleNotFoundError:
pass
if not USE_WEBKIT:
try:
from PyQt5.QtWebEngineWidgets import QWebEngineView
USE_WEBENGINE = True
except ModuleNotFoundError:
pass
else:
try:
from PyQt5.QtWebEngineWidgets import QWebEngineView
USE_WEBENGINE = True
except ModuleNotFoundError:
pass
if not USE_WEBENGINE:
try:
from PyQt5.QtWebKitWidgets import QWebView
USE_WEBKIT = True
except ModuleNotFoundError:
pass
if USE_WEBKIT:
from .q3dwebkitview import Q3DWebKitView as Q3DView, Q3DWebKitPage as Q3DWebPage
elif USE_WEBENGINE:
from .q3dwebengineview import Q3DWebEngineView as Q3DView, Q3DWebEnginePage as Q3DWebPage
else:
from .q3ddummyview import Q3DDummyView as Q3DView, Q3DDummyPage as Q3DWebPage
logMessage("Both webkit widgets and web engine widgets modules not found. The preview gets disabled.")