Fix VideoSpeedTest to disable RawImageGLWidget when openGL is unavailable
This commit is contained in:
parent
15c58de5d6
commit
a0e4301b38
@ -25,14 +25,22 @@ else:
|
||||
|
||||
#QtGui.QApplication.setGraphicsSystem('raster')
|
||||
app = QtGui.QApplication([])
|
||||
#mw = QtGui.QMainWindow()
|
||||
#mw.resize(800,800)
|
||||
|
||||
win = QtGui.QMainWindow()
|
||||
win.setWindowTitle('pyqtgraph example: VideoSpeedTest')
|
||||
ui = VideoTemplate.Ui_MainWindow()
|
||||
ui.setupUi(win)
|
||||
win.show()
|
||||
|
||||
try:
|
||||
from pyqtgraph.widgets.RawImageWidget import RawImageGLWidget
|
||||
except ImportError:
|
||||
ui.rawGLRadio.setEnabled(False)
|
||||
ui.rawGLRadio.setText(ui.rawGLRadio.text() + " (OpenGL not available)")
|
||||
else:
|
||||
ui.rawGLImg = RawImageGLWidget()
|
||||
ui.stack.addWidget(ui.rawGLImg)
|
||||
|
||||
ui.maxSpin1.setOpts(value=255, step=1)
|
||||
ui.minSpin1.setOpts(value=0, step=1)
|
||||
|
||||
|
@ -51,7 +51,7 @@
|
||||
<item row="0" column="0">
|
||||
<widget class="QStackedWidget" name="stack">
|
||||
<property name="currentIndex">
|
||||
<number>2</number>
|
||||
<number>1</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="page">
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
@ -74,13 +74,6 @@
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="page_3">
|
||||
<layout class="QGridLayout" name="gridLayout_5">
|
||||
<item row="0" column="0">
|
||||
<widget class="RawImageGLWidget" name="rawGLImg" native="true"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
@ -340,12 +333,6 @@
|
||||
<extends>QDoubleSpinBox</extends>
|
||||
<header>pyqtgraph</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>RawImageGLWidget</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>pyqtgraph.widgets.RawImageWidget</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
|
@ -1,9 +1,8 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Form implementation generated from reading ui file './examples/VideoTemplate.ui'
|
||||
# Form implementation generated from reading ui file 'examples/VideoTemplate.ui'
|
||||
#
|
||||
# Created: Mon Feb 17 20:39:30 2014
|
||||
# by: PyQt4 UI code generator 4.10.3
|
||||
# Created by: PyQt4 UI code generator 4.11.4
|
||||
#
|
||||
# WARNING! All changes made in this file will be lost!
|
||||
|
||||
@ -69,14 +68,6 @@ class Ui_MainWindow(object):
|
||||
self.rawImg.setObjectName(_fromUtf8("rawImg"))
|
||||
self.gridLayout_4.addWidget(self.rawImg, 0, 0, 1, 1)
|
||||
self.stack.addWidget(self.page_2)
|
||||
self.page_3 = QtGui.QWidget()
|
||||
self.page_3.setObjectName(_fromUtf8("page_3"))
|
||||
self.gridLayout_5 = QtGui.QGridLayout(self.page_3)
|
||||
self.gridLayout_5.setObjectName(_fromUtf8("gridLayout_5"))
|
||||
self.rawGLImg = RawImageGLWidget(self.page_3)
|
||||
self.rawGLImg.setObjectName(_fromUtf8("rawGLImg"))
|
||||
self.gridLayout_5.addWidget(self.rawGLImg, 0, 0, 1, 1)
|
||||
self.stack.addWidget(self.page_3)
|
||||
self.gridLayout.addWidget(self.stack, 0, 0, 1, 1)
|
||||
self.rawGLRadio = QtGui.QRadioButton(self.centralwidget)
|
||||
self.rawGLRadio.setObjectName(_fromUtf8("rawGLRadio"))
|
||||
@ -193,7 +184,7 @@ class Ui_MainWindow(object):
|
||||
MainWindow.setCentralWidget(self.centralwidget)
|
||||
|
||||
self.retranslateUi(MainWindow)
|
||||
self.stack.setCurrentIndex(2)
|
||||
self.stack.setCurrentIndex(1)
|
||||
QtCore.QMetaObject.connectSlotsByName(MainWindow)
|
||||
|
||||
def retranslateUi(self, MainWindow):
|
||||
@ -217,5 +208,5 @@ class Ui_MainWindow(object):
|
||||
self.rgbCheck.setText(_translate("MainWindow", "RGB", None))
|
||||
self.label_5.setText(_translate("MainWindow", "Image size", None))
|
||||
|
||||
from pyqtgraph.widgets.RawImageWidget import RawImageGLWidget, RawImageWidget
|
||||
from pyqtgraph import GradientWidget, SpinBox, GraphicsView
|
||||
from pyqtgraph import GradientWidget, GraphicsView, SpinBox
|
||||
from pyqtgraph.widgets.RawImageWidget import RawImageWidget
|
||||
|
@ -1,9 +1,9 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Form implementation generated from reading ui file './examples/VideoTemplate.ui'
|
||||
# Form implementation generated from reading ui file 'examples/VideoTemplate.ui'
|
||||
#
|
||||
# Created: Mon Feb 17 20:39:30 2014
|
||||
# by: pyside-uic 0.2.14 running on PySide 1.1.2
|
||||
# Created: Wed Oct 26 09:21:01 2016
|
||||
# by: pyside-uic 0.2.15 running on PySide 1.2.2
|
||||
#
|
||||
# WARNING! All changes made in this file will be lost!
|
||||
|
||||
@ -55,14 +55,6 @@ class Ui_MainWindow(object):
|
||||
self.rawImg.setObjectName("rawImg")
|
||||
self.gridLayout_4.addWidget(self.rawImg, 0, 0, 1, 1)
|
||||
self.stack.addWidget(self.page_2)
|
||||
self.page_3 = QtGui.QWidget()
|
||||
self.page_3.setObjectName("page_3")
|
||||
self.gridLayout_5 = QtGui.QGridLayout(self.page_3)
|
||||
self.gridLayout_5.setObjectName("gridLayout_5")
|
||||
self.rawGLImg = RawImageGLWidget(self.page_3)
|
||||
self.rawGLImg.setObjectName("rawGLImg")
|
||||
self.gridLayout_5.addWidget(self.rawGLImg, 0, 0, 1, 1)
|
||||
self.stack.addWidget(self.page_3)
|
||||
self.gridLayout.addWidget(self.stack, 0, 0, 1, 1)
|
||||
self.rawGLRadio = QtGui.QRadioButton(self.centralwidget)
|
||||
self.rawGLRadio.setObjectName("rawGLRadio")
|
||||
@ -179,7 +171,7 @@ class Ui_MainWindow(object):
|
||||
MainWindow.setCentralWidget(self.centralwidget)
|
||||
|
||||
self.retranslateUi(MainWindow)
|
||||
self.stack.setCurrentIndex(2)
|
||||
self.stack.setCurrentIndex(1)
|
||||
QtCore.QMetaObject.connectSlotsByName(MainWindow)
|
||||
|
||||
def retranslateUi(self, MainWindow):
|
||||
@ -203,5 +195,5 @@ class Ui_MainWindow(object):
|
||||
self.rgbCheck.setText(QtGui.QApplication.translate("MainWindow", "RGB", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.label_5.setText(QtGui.QApplication.translate("MainWindow", "Image size", None, QtGui.QApplication.UnicodeUTF8))
|
||||
|
||||
from pyqtgraph.widgets.RawImageWidget import RawImageGLWidget, RawImageWidget
|
||||
from pyqtgraph import GradientWidget, SpinBox, GraphicsView
|
||||
from pyqtgraph.widgets.RawImageWidget import RawImageWidget
|
||||
from pyqtgraph import SpinBox, GradientWidget, GraphicsView
|
||||
|
@ -61,6 +61,7 @@ class RawImageWidget(QtGui.QWidget):
|
||||
#p.drawPixmap(self.rect(), self.pixmap)
|
||||
p.end()
|
||||
|
||||
|
||||
if HAVE_OPENGL:
|
||||
class RawImageGLWidget(QtOpenGL.QGLWidget):
|
||||
"""
|
||||
|
Loading…
Reference in New Issue
Block a user