Merge pull request #1599 from pijyoi/choose_binding

fix Example App launch of VideoSpeedTest
This commit is contained in:
Ogi Moore 2021-02-22 13:31:50 -08:00 committed by GitHub
commit c1900aa71a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 82 additions and 225 deletions

View File

@ -344,18 +344,15 @@ class ExampleLoader(QtGui.QMainWindow):
def loadFile(self, edited=False): def loadFile(self, edited=False):
extra = []
qtLib = str(self.ui.qtLibCombo.currentText()) qtLib = str(self.ui.qtLibCombo.currentText())
gfxSys = str(self.ui.graphicsSystemCombo.currentText())
env = None
if qtLib != 'default': if qtLib != 'default':
extra.append(qtLib.lower()) env = dict(os.environ, PYQTGRAPH_QT_LIB=qtLib)
elif gfxSys != 'default':
extra.append(gfxSys)
if edited: if edited:
path = os.path.abspath(os.path.dirname(__file__)) path = os.path.abspath(os.path.dirname(__file__))
proc = subprocess.Popen([sys.executable, '-'] + extra, stdin=subprocess.PIPE, cwd=path) proc = subprocess.Popen([sys.executable, '-'], stdin=subprocess.PIPE, cwd=path, env=env)
code = str(self.ui.codeView.toPlainText()).encode('UTF-8') code = str(self.ui.codeView.toPlainText()).encode('UTF-8')
proc.stdin.write(code) proc.stdin.write(code)
proc.stdin.close() proc.stdin.close()
@ -364,9 +361,14 @@ class ExampleLoader(QtGui.QMainWindow):
if fn is None: if fn is None:
return return
if sys.platform.startswith('win'): if sys.platform.startswith('win'):
os.spawnl(os.P_NOWAIT, sys.executable, '"'+sys.executable+'"', '"' + fn + '"', *extra) args = [os.P_NOWAIT, sys.executable, '"'+sys.executable+'"', '"' + fn + '"']
else: else:
os.spawnl(os.P_NOWAIT, sys.executable, sys.executable, fn, *extra) args = [os.P_NOWAIT, sys.executable, sys.executable, fn]
if env is None:
os.spawnl(*args)
else:
args.append(env)
os.spawnle(*args)
def showFile(self): def showFile(self):
fn = self.currentFile() fn = self.currentFile()

View File

@ -11,7 +11,6 @@ from pyqtgraph.Qt import QtGui, QtCore
import numpy as np import numpy as np
import pyqtgraph as pg import pyqtgraph as pg
#QtGui.QApplication.setGraphicsSystem('raster')
app = pg.mkQApp("Plot Auto Range Example") app = pg.mkQApp("Plot Auto Range Example")
#mw = QtGui.QMainWindow() #mw = QtGui.QMainWindow()
#mw.resize(800,800) #mw.resize(800,800)

View File

@ -12,7 +12,6 @@ from pyqtgraph.Qt import QtGui, QtCore
import numpy as np import numpy as np
import pyqtgraph as pg import pyqtgraph as pg
#QtGui.QApplication.setGraphicsSystem('raster')
app = pg.mkQApp() app = pg.mkQApp()
mw = QtGui.QMainWindow() mw = QtGui.QMainWindow()
mw.setWindowTitle('pyqtgraph example: PlotWidget') mw.setWindowTitle('pyqtgraph example: PlotWidget')

View File

@ -12,7 +12,6 @@ from pyqtgraph.Qt import QtGui, QtCore
import numpy as np import numpy as np
import pyqtgraph as pg import pyqtgraph as pg
#QtGui.QApplication.setGraphicsSystem('raster')
app = pg.mkQApp("Plotting Example") app = pg.mkQApp("Plotting Example")
#mw = QtGui.QMainWindow() #mw = QtGui.QMainWindow()
#mw.resize(800,800) #mw.resize(800,800)

View File

@ -6,6 +6,9 @@ it is being scaled and/or converted by lookup table, and whether OpenGL
is used by the view widget is used by the view widget
""" """
## Add path to library (just for examples; you do not need this)
import initExample
import argparse import argparse
import sys import sys
@ -26,6 +29,11 @@ except ImportError:
cp = None cp = None
_has_cupy = False _has_cupy = False
try:
from pyqtgraph.widgets.RawImageWidget import RawImageGLWidget
except ImportError:
RawImageGLWidget = None
parser = argparse.ArgumentParser(description="Benchmark for testing video performance") parser = argparse.ArgumentParser(description="Benchmark for testing video performance")
parser.add_argument('--cuda', default=False, action='store_true', help="Use CUDA to process on the GPU", dest="cuda") parser.add_argument('--cuda', default=False, action='store_true', help="Use CUDA to process on the GPU", dest="cuda")
parser.add_argument('--dtype', default='uint8', choices=['uint8', 'uint16', 'float'], help="Image dtype (uint8, uint16, or float)") parser.add_argument('--dtype', default='uint8', choices=['uint8', 'uint16', 'float'], help="Image dtype (uint8, uint16, or float)")
@ -37,7 +45,12 @@ parser.add_argument('--lut-alpha', default=False, action='store_true', help="Use
parser.add_argument('--size', default='512x512', type=lambda s: tuple([int(x) for x in s.split('x')]), help="WxH image dimensions default='512x512'") parser.add_argument('--size', default='512x512', type=lambda s: tuple([int(x) for x in s.split('x')]), help="WxH image dimensions default='512x512'")
args = parser.parse_args(sys.argv[1:]) args = parser.parse_args(sys.argv[1:])
#QtGui.QApplication.setGraphicsSystem('raster') if RawImageGLWidget is not None:
# don't limit frame rate to vsync
sfmt = QtGui.QSurfaceFormat()
sfmt.setSwapInterval(0)
QtGui.QSurfaceFormat.setDefaultFormat(sfmt)
app = pg.mkQApp("Video Speed Test Example") app = pg.mkQApp("Video Speed Test Example")
win = QtGui.QMainWindow() win = QtGui.QMainWindow()
@ -46,10 +59,7 @@ ui = ui_template.Ui_MainWindow()
ui.setupUi(win) ui.setupUi(win)
win.show() win.show()
try: if RawImageGLWidget is None:
from pyqtgraph.widgets.RawImageWidget import RawImageGLWidget
except ImportError:
RawImageGLWidget = None
ui.rawGLRadio.setEnabled(False) ui.rawGLRadio.setEnabled(False)
ui.rawGLRadio.setText(ui.rawGLRadio.text() + " (OpenGL not available)") ui.rawGLRadio.setText(ui.rawGLRadio.text() + " (OpenGL not available)")
else: else:

View File

@ -33,30 +33,6 @@
</column> </column>
</widget> </widget>
</item> </item>
<item row="2" column="1">
<widget class="QComboBox" name="graphicsSystemCombo">
<item>
<property name="text">
<string>default</string>
</property>
</item>
<item>
<property name="text">
<string>native</string>
</property>
</item>
<item>
<property name="text">
<string>raster</string>
</property>
</item>
<item>
<property name="text">
<string>opengl</string>
</property>
</item>
</widget>
</item>
<item row="1" column="1"> <item row="1" column="1">
<widget class="QComboBox" name="qtLibCombo"> <widget class="QComboBox" name="qtLibCombo">
<item> <item>
@ -86,13 +62,6 @@
</item> </item>
</widget> </widget>
</item> </item>
<item row="2" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Graphics System:</string>
</property>
</widget>
</item>
<item row="1" column="0"> <item row="1" column="0">
<widget class="QLabel" name="label"> <widget class="QLabel" name="label">
<property name="text"> <property name="text">

View File

@ -2,10 +2,9 @@
# Form implementation generated from reading ui file 'exampleLoaderTemplate.ui' # Form implementation generated from reading ui file 'exampleLoaderTemplate.ui'
# #
# Created by: PyQt5 UI code generator 5.15.2 # Created by: PyQt5 UI code generator 5.12.3
# #
# WARNING: Any manual changes made to this file will be lost when pyuic5 is # WARNING! All changes made in this file will be lost!
# run again. Do not edit this file unless you know what you are doing.
from PyQt5 import QtCore, QtGui, QtWidgets from PyQt5 import QtCore, QtGui, QtWidgets
@ -30,13 +29,6 @@ class Ui_Form(object):
self.exampleTree.headerItem().setText(0, "1") self.exampleTree.headerItem().setText(0, "1")
self.exampleTree.header().setVisible(False) self.exampleTree.header().setVisible(False)
self.gridLayout.addWidget(self.exampleTree, 0, 0, 1, 2) self.gridLayout.addWidget(self.exampleTree, 0, 0, 1, 2)
self.graphicsSystemCombo = QtWidgets.QComboBox(self.widget)
self.graphicsSystemCombo.setObjectName("graphicsSystemCombo")
self.graphicsSystemCombo.addItem("")
self.graphicsSystemCombo.addItem("")
self.graphicsSystemCombo.addItem("")
self.graphicsSystemCombo.addItem("")
self.gridLayout.addWidget(self.graphicsSystemCombo, 2, 1, 1, 1)
self.qtLibCombo = QtWidgets.QComboBox(self.widget) self.qtLibCombo = QtWidgets.QComboBox(self.widget)
self.qtLibCombo.setObjectName("qtLibCombo") self.qtLibCombo.setObjectName("qtLibCombo")
self.qtLibCombo.addItem("") self.qtLibCombo.addItem("")
@ -45,9 +37,6 @@ class Ui_Form(object):
self.qtLibCombo.addItem("") self.qtLibCombo.addItem("")
self.qtLibCombo.addItem("") self.qtLibCombo.addItem("")
self.gridLayout.addWidget(self.qtLibCombo, 1, 1, 1, 1) self.gridLayout.addWidget(self.qtLibCombo, 1, 1, 1, 1)
self.label_2 = QtWidgets.QLabel(self.widget)
self.label_2.setObjectName("label_2")
self.gridLayout.addWidget(self.label_2, 2, 0, 1, 1)
self.label = QtWidgets.QLabel(self.widget) self.label = QtWidgets.QLabel(self.widget)
self.label.setObjectName("label") self.label.setObjectName("label")
self.gridLayout.addWidget(self.label, 1, 0, 1, 1) self.gridLayout.addWidget(self.label, 1, 0, 1, 1)
@ -81,15 +70,10 @@ class Ui_Form(object):
def retranslateUi(self, Form): def retranslateUi(self, Form):
_translate = QtCore.QCoreApplication.translate _translate = QtCore.QCoreApplication.translate
Form.setWindowTitle(_translate("Form", "PyQtGraph")) Form.setWindowTitle(_translate("Form", "PyQtGraph"))
self.graphicsSystemCombo.setItemText(0, _translate("Form", "default"))
self.graphicsSystemCombo.setItemText(1, _translate("Form", "native"))
self.graphicsSystemCombo.setItemText(2, _translate("Form", "raster"))
self.graphicsSystemCombo.setItemText(3, _translate("Form", "opengl"))
self.qtLibCombo.setItemText(0, _translate("Form", "default")) self.qtLibCombo.setItemText(0, _translate("Form", "default"))
self.qtLibCombo.setItemText(1, _translate("Form", "PyQt5")) self.qtLibCombo.setItemText(1, _translate("Form", "PyQt5"))
self.qtLibCombo.setItemText(2, _translate("Form", "PySide2")) self.qtLibCombo.setItemText(2, _translate("Form", "PySide2"))
self.qtLibCombo.setItemText(3, _translate("Form", "PySide6")) self.qtLibCombo.setItemText(3, _translate("Form", "PySide6"))
self.qtLibCombo.setItemText(4, _translate("Form", "PyQt6")) self.qtLibCombo.setItemText(4, _translate("Form", "PyQt6"))
self.label_2.setText(_translate("Form", "Graphics System:"))
self.label.setText(_translate("Form", "Qt Library:")) self.label.setText(_translate("Form", "Qt Library:"))
self.loadBtn.setText(_translate("Form", "Run Example")) self.loadBtn.setText(_translate("Form", "Run Example"))

View File

@ -1,6 +1,6 @@
# Form implementation generated from reading ui file 'exampleLoaderTemplate.ui' # Form implementation generated from reading ui file 'exampleLoaderTemplate.ui'
# #
# Created by: PyQt6 UI code generator 6.0.0 # Created by: PyQt6 UI code generator 6.0.1
# #
# WARNING: Any manual changes made to this file will be lost when pyuic6 is # WARNING: Any manual changes made to this file will be lost when pyuic6 is
# run again. Do not edit this file unless you know what you are doing. # run again. Do not edit this file unless you know what you are doing.
@ -28,13 +28,6 @@ class Ui_Form(object):
self.exampleTree.headerItem().setText(0, "1") self.exampleTree.headerItem().setText(0, "1")
self.exampleTree.header().setVisible(False) self.exampleTree.header().setVisible(False)
self.gridLayout.addWidget(self.exampleTree, 0, 0, 1, 2) self.gridLayout.addWidget(self.exampleTree, 0, 0, 1, 2)
self.graphicsSystemCombo = QtWidgets.QComboBox(self.widget)
self.graphicsSystemCombo.setObjectName("graphicsSystemCombo")
self.graphicsSystemCombo.addItem("")
self.graphicsSystemCombo.addItem("")
self.graphicsSystemCombo.addItem("")
self.graphicsSystemCombo.addItem("")
self.gridLayout.addWidget(self.graphicsSystemCombo, 2, 1, 1, 1)
self.qtLibCombo = QtWidgets.QComboBox(self.widget) self.qtLibCombo = QtWidgets.QComboBox(self.widget)
self.qtLibCombo.setObjectName("qtLibCombo") self.qtLibCombo.setObjectName("qtLibCombo")
self.qtLibCombo.addItem("") self.qtLibCombo.addItem("")
@ -43,9 +36,6 @@ class Ui_Form(object):
self.qtLibCombo.addItem("") self.qtLibCombo.addItem("")
self.qtLibCombo.addItem("") self.qtLibCombo.addItem("")
self.gridLayout.addWidget(self.qtLibCombo, 1, 1, 1, 1) self.gridLayout.addWidget(self.qtLibCombo, 1, 1, 1, 1)
self.label_2 = QtWidgets.QLabel(self.widget)
self.label_2.setObjectName("label_2")
self.gridLayout.addWidget(self.label_2, 2, 0, 1, 1)
self.label = QtWidgets.QLabel(self.widget) self.label = QtWidgets.QLabel(self.widget)
self.label.setObjectName("label") self.label.setObjectName("label")
self.gridLayout.addWidget(self.label, 1, 0, 1, 1) self.gridLayout.addWidget(self.label, 1, 0, 1, 1)
@ -79,15 +69,10 @@ class Ui_Form(object):
def retranslateUi(self, Form): def retranslateUi(self, Form):
_translate = QtCore.QCoreApplication.translate _translate = QtCore.QCoreApplication.translate
Form.setWindowTitle(_translate("Form", "PyQtGraph")) Form.setWindowTitle(_translate("Form", "PyQtGraph"))
self.graphicsSystemCombo.setItemText(0, _translate("Form", "default"))
self.graphicsSystemCombo.setItemText(1, _translate("Form", "native"))
self.graphicsSystemCombo.setItemText(2, _translate("Form", "raster"))
self.graphicsSystemCombo.setItemText(3, _translate("Form", "opengl"))
self.qtLibCombo.setItemText(0, _translate("Form", "default")) self.qtLibCombo.setItemText(0, _translate("Form", "default"))
self.qtLibCombo.setItemText(1, _translate("Form", "PyQt5")) self.qtLibCombo.setItemText(1, _translate("Form", "PyQt5"))
self.qtLibCombo.setItemText(2, _translate("Form", "PySide2")) self.qtLibCombo.setItemText(2, _translate("Form", "PySide2"))
self.qtLibCombo.setItemText(3, _translate("Form", "PySide6")) self.qtLibCombo.setItemText(3, _translate("Form", "PySide6"))
self.qtLibCombo.setItemText(4, _translate("Form", "PyQt6")) self.qtLibCombo.setItemText(4, _translate("Form", "PyQt6"))
self.label_2.setText(_translate("Form", "Graphics System:"))
self.label.setText(_translate("Form", "Qt Library:")) self.label.setText(_translate("Form", "Qt Library:"))
self.loadBtn.setText(_translate("Form", "Run Example")) self.loadBtn.setText(_translate("Form", "Run Example"))

View File

@ -1,125 +1,79 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
################################################################################ # Form implementation generated from reading ui file 'exampleLoaderTemplate.ui',
## Form generated from reading UI file 'exampleLoaderTemplate.ui' # licensing of 'exampleLoaderTemplate.ui' applies.
## #
## Created by: Qt User Interface Compiler version 5.15.2 # Created: Mon Feb 22 18:33:36 2021
## # by: pyside2-uic running on PySide2 5.12.6
## WARNING! All changes made in this file will be lost when recompiling UI file! #
################################################################################ # WARNING! All changes made in this file will be lost!
from PySide2.QtCore import *
from PySide2.QtGui import *
from PySide2.QtWidgets import *
from PySide2 import QtCore, QtGui, QtWidgets
class Ui_Form(object): class Ui_Form(object):
def setupUi(self, Form): def setupUi(self, Form):
if not Form.objectName(): Form.setObjectName("Form")
Form.setObjectName(u"Form")
Form.resize(846, 552) Form.resize(846, 552)
self.gridLayout_2 = QGridLayout(Form) self.gridLayout_2 = QtWidgets.QGridLayout(Form)
self.gridLayout_2.setObjectName(u"gridLayout_2") self.gridLayout_2.setObjectName("gridLayout_2")
self.splitter = QSplitter(Form) self.splitter = QtWidgets.QSplitter(Form)
self.splitter.setObjectName(u"splitter") self.splitter.setOrientation(QtCore.Qt.Horizontal)
self.splitter.setOrientation(Qt.Horizontal) self.splitter.setObjectName("splitter")
self.widget = QWidget(self.splitter) self.widget = QtWidgets.QWidget(self.splitter)
self.widget.setObjectName(u"widget") self.widget.setObjectName("widget")
self.gridLayout = QGridLayout(self.widget) self.gridLayout = QtWidgets.QGridLayout(self.widget)
self.gridLayout.setObjectName(u"gridLayout")
self.gridLayout.setContentsMargins(0, 0, 0, 0) self.gridLayout.setContentsMargins(0, 0, 0, 0)
self.exampleTree = QTreeWidget(self.widget) self.gridLayout.setObjectName("gridLayout")
__qtreewidgetitem = QTreeWidgetItem() self.exampleTree = QtWidgets.QTreeWidget(self.widget)
__qtreewidgetitem.setText(0, u"1"); self.exampleTree.setObjectName("exampleTree")
self.exampleTree.setHeaderItem(__qtreewidgetitem) self.exampleTree.headerItem().setText(0, "1")
self.exampleTree.setObjectName(u"exampleTree")
self.exampleTree.header().setVisible(False) self.exampleTree.header().setVisible(False)
self.gridLayout.addWidget(self.exampleTree, 0, 0, 1, 2) self.gridLayout.addWidget(self.exampleTree, 0, 0, 1, 2)
self.qtLibCombo = QtWidgets.QComboBox(self.widget)
self.graphicsSystemCombo = QComboBox(self.widget) self.qtLibCombo.setObjectName("qtLibCombo")
self.graphicsSystemCombo.addItem("")
self.graphicsSystemCombo.addItem("")
self.graphicsSystemCombo.addItem("")
self.graphicsSystemCombo.addItem("")
self.graphicsSystemCombo.setObjectName(u"graphicsSystemCombo")
self.gridLayout.addWidget(self.graphicsSystemCombo, 2, 1, 1, 1)
self.qtLibCombo = QComboBox(self.widget)
self.qtLibCombo.addItem("") self.qtLibCombo.addItem("")
self.qtLibCombo.addItem("") self.qtLibCombo.addItem("")
self.qtLibCombo.addItem("") self.qtLibCombo.addItem("")
self.qtLibCombo.addItem("") self.qtLibCombo.addItem("")
self.qtLibCombo.addItem("") self.qtLibCombo.addItem("")
self.qtLibCombo.setObjectName(u"qtLibCombo")
self.gridLayout.addWidget(self.qtLibCombo, 1, 1, 1, 1) self.gridLayout.addWidget(self.qtLibCombo, 1, 1, 1, 1)
self.label = QtWidgets.QLabel(self.widget)
self.label_2 = QLabel(self.widget) self.label.setObjectName("label")
self.label_2.setObjectName(u"label_2")
self.gridLayout.addWidget(self.label_2, 2, 0, 1, 1)
self.label = QLabel(self.widget)
self.label.setObjectName(u"label")
self.gridLayout.addWidget(self.label, 1, 0, 1, 1) self.gridLayout.addWidget(self.label, 1, 0, 1, 1)
self.loadBtn = QtWidgets.QPushButton(self.widget)
self.loadBtn = QPushButton(self.widget) self.loadBtn.setObjectName("loadBtn")
self.loadBtn.setObjectName(u"loadBtn")
self.gridLayout.addWidget(self.loadBtn, 3, 1, 1, 1) self.gridLayout.addWidget(self.loadBtn, 3, 1, 1, 1)
self.widget1 = QtWidgets.QWidget(self.splitter)
self.splitter.addWidget(self.widget) self.widget1.setObjectName("widget1")
self.widget1 = QWidget(self.splitter) self.verticalLayout = QtWidgets.QVBoxLayout(self.widget1)
self.widget1.setObjectName(u"widget1")
self.verticalLayout = QVBoxLayout(self.widget1)
self.verticalLayout.setObjectName(u"verticalLayout")
self.verticalLayout.setContentsMargins(0, 0, 0, 0) self.verticalLayout.setContentsMargins(0, 0, 0, 0)
self.loadedFileLabel = QLabel(self.widget1) self.verticalLayout.setObjectName("verticalLayout")
self.loadedFileLabel.setObjectName(u"loadedFileLabel") self.loadedFileLabel = QtWidgets.QLabel(self.widget1)
font = QFont() font = QtGui.QFont()
font.setBold(True) font.setBold(True)
self.loadedFileLabel.setFont(font) self.loadedFileLabel.setFont(font)
self.loadedFileLabel.setAlignment(Qt.AlignCenter) self.loadedFileLabel.setText("")
self.loadedFileLabel.setAlignment(QtCore.Qt.AlignCenter)
self.loadedFileLabel.setObjectName("loadedFileLabel")
self.verticalLayout.addWidget(self.loadedFileLabel) self.verticalLayout.addWidget(self.loadedFileLabel)
self.codeView = QtWidgets.QPlainTextEdit(self.widget1)
self.codeView = QPlainTextEdit(self.widget1) font = QtGui.QFont()
self.codeView.setObjectName(u"codeView") font.setFamily("Courier New")
font1 = QFont() self.codeView.setFont(font)
font1.setFamily(u"Courier New") self.codeView.setObjectName("codeView")
self.codeView.setFont(font1)
self.verticalLayout.addWidget(self.codeView) self.verticalLayout.addWidget(self.codeView)
self.splitter.addWidget(self.widget1)
self.gridLayout_2.addWidget(self.splitter, 0, 0, 1, 1) self.gridLayout_2.addWidget(self.splitter, 0, 0, 1, 1)
self.retranslateUi(Form) self.retranslateUi(Form)
QtCore.QMetaObject.connectSlotsByName(Form)
QMetaObject.connectSlotsByName(Form)
# setupUi
def retranslateUi(self, Form): def retranslateUi(self, Form):
Form.setWindowTitle(QCoreApplication.translate("Form", u"PyQtGraph", None)) Form.setWindowTitle(QtWidgets.QApplication.translate("Form", "PyQtGraph", None, -1))
self.graphicsSystemCombo.setItemText(0, QCoreApplication.translate("Form", u"default", None)) self.qtLibCombo.setItemText(0, QtWidgets.QApplication.translate("Form", "default", None, -1))
self.graphicsSystemCombo.setItemText(1, QCoreApplication.translate("Form", u"native", None)) self.qtLibCombo.setItemText(1, QtWidgets.QApplication.translate("Form", "PyQt5", None, -1))
self.graphicsSystemCombo.setItemText(2, QCoreApplication.translate("Form", u"raster", None)) self.qtLibCombo.setItemText(2, QtWidgets.QApplication.translate("Form", "PySide2", None, -1))
self.graphicsSystemCombo.setItemText(3, QCoreApplication.translate("Form", u"opengl", None)) self.qtLibCombo.setItemText(3, QtWidgets.QApplication.translate("Form", "PySide6", None, -1))
self.qtLibCombo.setItemText(4, QtWidgets.QApplication.translate("Form", "PyQt6", None, -1))
self.qtLibCombo.setItemText(0, QCoreApplication.translate("Form", u"default", None)) self.label.setText(QtWidgets.QApplication.translate("Form", "Qt Library:", None, -1))
self.qtLibCombo.setItemText(1, QCoreApplication.translate("Form", u"PyQt5", None)) self.loadBtn.setText(QtWidgets.QApplication.translate("Form", "Run Example", None, -1))
self.qtLibCombo.setItemText(2, QCoreApplication.translate("Form", u"PySide2", None))
self.qtLibCombo.setItemText(3, QCoreApplication.translate("Form", u"PySide6", None))
self.qtLibCombo.setItemText(4, QCoreApplication.translate("Form", u"PyQt6", None))
self.label_2.setText(QCoreApplication.translate("Form", u"Graphics System:", None))
self.label.setText(QCoreApplication.translate("Form", u"Qt Library:", None))
self.loadBtn.setText(QCoreApplication.translate("Form", u"Run Example", None))
self.loadedFileLabel.setText("")
# retranslateUi

View File

@ -37,15 +37,6 @@ class Ui_Form(object):
self.gridLayout.addWidget(self.exampleTree, 0, 0, 1, 2) self.gridLayout.addWidget(self.exampleTree, 0, 0, 1, 2)
self.graphicsSystemCombo = QComboBox(self.widget)
self.graphicsSystemCombo.addItem("")
self.graphicsSystemCombo.addItem("")
self.graphicsSystemCombo.addItem("")
self.graphicsSystemCombo.addItem("")
self.graphicsSystemCombo.setObjectName(u"graphicsSystemCombo")
self.gridLayout.addWidget(self.graphicsSystemCombo, 2, 1, 1, 1)
self.qtLibCombo = QComboBox(self.widget) self.qtLibCombo = QComboBox(self.widget)
self.qtLibCombo.addItem("") self.qtLibCombo.addItem("")
self.qtLibCombo.addItem("") self.qtLibCombo.addItem("")
@ -56,11 +47,6 @@ class Ui_Form(object):
self.gridLayout.addWidget(self.qtLibCombo, 1, 1, 1, 1) self.gridLayout.addWidget(self.qtLibCombo, 1, 1, 1, 1)
self.label_2 = QLabel(self.widget)
self.label_2.setObjectName(u"label_2")
self.gridLayout.addWidget(self.label_2, 2, 0, 1, 1)
self.label = QLabel(self.widget) self.label = QLabel(self.widget)
self.label.setObjectName(u"label") self.label.setObjectName(u"label")
@ -106,18 +92,12 @@ class Ui_Form(object):
def retranslateUi(self, Form): def retranslateUi(self, Form):
Form.setWindowTitle(QCoreApplication.translate("Form", u"PyQtGraph", None)) Form.setWindowTitle(QCoreApplication.translate("Form", u"PyQtGraph", None))
self.graphicsSystemCombo.setItemText(0, QCoreApplication.translate("Form", u"default", None))
self.graphicsSystemCombo.setItemText(1, QCoreApplication.translate("Form", u"native", None))
self.graphicsSystemCombo.setItemText(2, QCoreApplication.translate("Form", u"raster", None))
self.graphicsSystemCombo.setItemText(3, QCoreApplication.translate("Form", u"opengl", None))
self.qtLibCombo.setItemText(0, QCoreApplication.translate("Form", u"default", None)) self.qtLibCombo.setItemText(0, QCoreApplication.translate("Form", u"default", None))
self.qtLibCombo.setItemText(1, QCoreApplication.translate("Form", u"PyQt5", None)) self.qtLibCombo.setItemText(1, QCoreApplication.translate("Form", u"PyQt5", None))
self.qtLibCombo.setItemText(2, QCoreApplication.translate("Form", u"PySide2", None)) self.qtLibCombo.setItemText(2, QCoreApplication.translate("Form", u"PySide2", None))
self.qtLibCombo.setItemText(3, QCoreApplication.translate("Form", u"PySide6", None)) self.qtLibCombo.setItemText(3, QCoreApplication.translate("Form", u"PySide6", None))
self.qtLibCombo.setItemText(4, QCoreApplication.translate("Form", u"PyQt6", None)) self.qtLibCombo.setItemText(4, QCoreApplication.translate("Form", u"PyQt6", None))
self.label_2.setText(QCoreApplication.translate("Form", u"Graphics System:", None))
self.label.setText(QCoreApplication.translate("Form", u"Qt Library:", None)) self.label.setText(QCoreApplication.translate("Form", u"Qt Library:", None))
self.loadBtn.setText(QCoreApplication.translate("Form", u"Run Example", None)) self.loadBtn.setText(QCoreApplication.translate("Form", u"Run Example", None))
self.loadedFileLabel.setText("") self.loadedFileLabel.setText("")

View File

@ -20,25 +20,8 @@ if not hasattr(sys, 'frozen'):
sys.path.remove(p) sys.path.remove(p)
sys.path.insert(0, p) sys.path.insert(0, p)
## should force example to use PySide instead of PyQt
for module in ['PyQt5', 'PySide2', 'PySide6', 'PyQt6']:
if module.lower() in sys.argv:
QtGui = importlib.import_module(module + '.QtGui')
break
else:
from pyqtgraph.Qt import QtGui
import pyqtgraph as pg import pyqtgraph as pg
print("Using", pg.Qt.QT_LIB)
## Force use of a specific graphics system
use_gs = 'default'
for gs in ['raster', 'native', 'opengl']:
if gs in sys.argv:
use_gs = gs
QtGui.QApplication.setGraphicsSystem(gs)
break
print("Using %s (%s graphics system)" % (pg.Qt.QT_LIB, use_gs))
## Enable fault handling to give more helpful error messages on crash. ## Enable fault handling to give more helpful error messages on crash.
## Only available in python 3.3+ ## Only available in python 3.3+

View File

@ -12,7 +12,6 @@ from pyqtgraph.Qt import QtGui, QtCore
import numpy as np import numpy as np
import pyqtgraph as pg import pyqtgraph as pg
#QtGui.QApplication.setGraphicsSystem('raster')
app = pg.mkQApp("Linked Views Example") app = pg.mkQApp("Linked Views Example")
#mw = QtGui.QMainWindow() #mw = QtGui.QMainWindow()
#mw.resize(800,800) #mw.resize(800,800)

View File

@ -199,7 +199,7 @@ conditionalExamples = {
) )
] ]
) )
def testExamples(frontend, f, graphicsSystem=None): def testExamples(frontend, f):
# runExampleFile(f[0], f[1], sys.executable, frontend) # runExampleFile(f[0], f[1], sys.executable, frontend)
name, file = f name, file = f
@ -210,15 +210,11 @@ def testExamples(frontend, f, graphicsSystem=None):
sys.stdout.flush() sys.stdout.flush()
import1 = "import %s" % frontend if frontend != '' else '' import1 = "import %s" % frontend if frontend != '' else ''
import2 = os.path.splitext(os.path.split(fn)[1])[0] import2 = os.path.splitext(os.path.split(fn)[1])[0]
graphicsSystem = (
'' if graphicsSystem is None else "pg.QtGui.QApplication.setGraphicsSystem('%s')" % graphicsSystem
)
code = """ code = """
try: try:
%s %s
import initExample import initExample
import pyqtgraph as pg import pyqtgraph as pg
%s
import %s import %s
import sys import sys
print("test complete") print("test complete")
@ -231,7 +227,7 @@ except:
print("test failed") print("test failed")
raise raise
""" % (import1, graphicsSystem, import2) """ % (import1, import2)
if sys.platform.startswith('win'): if sys.platform.startswith('win'):
process = subprocess.Popen([sys.executable], process = subprocess.Popen([sys.executable],
stdin=subprocess.PIPE, stdin=subprocess.PIPE,

View File

@ -37,9 +37,7 @@ if 'linux' in sys.platform: ## linux has numerous bugs in opengl implementation
elif 'darwin' in sys.platform: ## openGL can have a major impact on mac, but also has serious bugs elif 'darwin' in sys.platform: ## openGL can have a major impact on mac, but also has serious bugs
useOpenGL = False useOpenGL = False
if QtGui.QApplication.instance() is not None: if QtGui.QApplication.instance() is not None:
print('Warning: QApplication was created before pyqtgraph was imported; there may be problems (to avoid bugs, call QApplication.setGraphicsSystem("raster") before the QApplication is created).') print('Warning: QApplication was created before pyqtgraph was imported; there may be problems.')
if QtGui.QApplication.setGraphicsSystem:
QtGui.QApplication.setGraphicsSystem('raster') ## work around a variety of bugs in the native graphics system
else: else:
useOpenGL = False ## on windows there's a more even performance / bugginess tradeoff. useOpenGL = False ## on windows there's a more even performance / bugginess tradeoff.