Skip to content

Commit 141c53f

Browse files
committed
Signal pyside2, fix issue #1012
1 parent ca1951b commit 141c53f

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

src/Display/qtDisplay.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,6 @@
2727

2828
QtCore, QtGui, QtWidgets, QtOpenGL = get_qt_modules()
2929

30-
# check if signal available, not available
31-
# on PySide
32-
HAVE_PYQT_SIGNAL = hasattr(QtCore, "pyqtSignal")
33-
3430
logging.basicConfig(stream=sys.stdout, level=logging.DEBUG)
3531
log = logging.getLogger(__name__)
3632

@@ -67,8 +63,13 @@ class qtViewer3d(qtBaseViewer):
6763

6864
# emit signal when selection is changed
6965
# is a list of TopoDS_*
70-
if HAVE_PYQT_SIGNAL:
66+
HAVE_PYQT_SIGNAL = False
67+
if hasattr(QtCore, "pyqtSignal"): # PyQt
7168
sig_topods_selected = QtCore.pyqtSignal(list)
69+
HAVE_PYQT_SIGNAL = True
70+
elif hasattr(QtCore, "Signal"): # PySide2
71+
sig_topods_selected = QtCore.Signal(list)
72+
HAVE_PYQT_SIGNAL = True
7273

7374
def __init__(self, *kargs):
7475
qtBaseViewer.__init__(self, *kargs)
@@ -215,7 +216,8 @@ def mouseReleaseEvent(self, event):
215216
# single select otherwise
216217
self._display.Select(pt.x(), pt.y())
217218

218-
if (self._display.selected_shapes is not None) and HAVE_PYQT_SIGNAL:
219+
if (self._display.selected_shapes is not None) and self.HAVE_PYQT_SIGNAL:
220+
219221
self.sig_topods_selected.emit(self._display.selected_shapes)
220222

221223
elif event.button() == QtCore.Qt.RightButton:

0 commit comments

Comments
 (0)