Skip to content

Commit

Permalink
Merge pull request #346 from astrofrog/fix-qt6
Browse files Browse the repository at this point in the history
Fix compatibilty with Qt6
  • Loading branch information
pkgw authored Feb 22, 2023
2 parents 4ae8627 + 9878543 commit 2a9c816
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
11 changes: 7 additions & 4 deletions pywwt/qt.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import time

from qtpy.QtWebEngineWidgets import QWebEngineView, QWebEnginePage, WEBENGINE
from qtpy import QtWidgets, QtGui, QtCore
from qtpy import QtWidgets, QtGui, QtCore, PYQT6, PYSIDE6

from .app import get_qapp
from .core import BaseWWTWidget
Expand Down Expand Up @@ -148,10 +148,13 @@ class WWTQtWidget(QtWidgets.QWidget):
def __init__(self, url, parent=None):
super(WWTQtWidget, self).__init__(parent=parent)

self.web = WWTWebEngineView()
self.page = WWTQWebEnginePage()
self.page.setView(self.web)
self.web.setPage(self.page)
if PYQT6 or PYSIDE6:
self.web = WWTWebEngineView(self.page)
else:
self.web = WWTWebEngineView()
self.page.setView(self.web)
self.web.setPage(self.page)
self.web.setUrl(QtCore.QUrl(url))

layout = QtWidgets.QVBoxLayout()
Expand Down
4 changes: 4 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,10 @@
'PyQt5;python_version>="3"',
'PyQtWebEngine;python_version>="3"',
],
"qt6": [
'PyQt6;python_version>="3"',
'PyQt6-WebEngine;python_version>="3"',
],
"lab": [
"jupyterlab",
"notebook",
Expand Down

0 comments on commit 2a9c816

Please sign in to comment.