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):
extra = []
qtLib = str(self.ui.qtLibCombo.currentText())
gfxSys = str(self.ui.graphicsSystemCombo.currentText())
env = None
if qtLib != 'default':
extra.append(qtLib.lower())
elif gfxSys != 'default':
extra.append(gfxSys)
env = dict(os.environ, PYQTGRAPH_QT_LIB=qtLib)
if edited:
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')
proc.stdin.write(code)
proc.stdin.close()
@ -364,9 +361,14 @@ class ExampleLoader(QtGui.QMainWindow):
if fn is None:
return
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:
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):
fn = self.currentFile()

View File

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

View File

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

View File

@ -12,7 +12,6 @@ from pyqtgraph.Qt import QtGui, QtCore
import numpy as np
import pyqtgraph as pg
#QtGui.QApplication.setGraphicsSystem('raster')
app = pg.mkQApp("Plotting Example")
#mw = QtGui.QMainWindow()
#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
"""
## Add path to library (just for examples; you do not need this)
import initExample
import argparse
import sys
@ -26,6 +29,11 @@ except ImportError:
cp = None
_has_cupy = False
try:
from pyqtgraph.widgets.RawImageWidget import RawImageGLWidget
except ImportError:
RawImageGLWidget = None
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('--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'")
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")
win = QtGui.QMainWindow()
@ -46,10 +59,7 @@ ui = ui_template.Ui_MainWindow()
ui.setupUi(win)
win.show()
try:
from pyqtgraph.widgets.RawImageWidget import RawImageGLWidget
except ImportError:
RawImageGLWidget = None
if RawImageGLWidget is None:
ui.rawGLRadio.setEnabled(False)
ui.rawGLRadio.setText(ui.rawGLRadio.text() + " (OpenGL not available)")
else:

View File

@ -33,30 +33,6 @@
</column>
</widget>
</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">
<widget class="QComboBox" name="qtLibCombo">
<item>
@ -86,13 +62,6 @@
</item>
</widget>
</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">
<widget class="QLabel" name="label">
<property name="text">

View File

@ -2,10 +2,9 @@
# 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
# run again. Do not edit this file unless you know what you are doing.
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
@ -30,13 +29,6 @@ class Ui_Form(object):
self.exampleTree.headerItem().setText(0, "1")
self.exampleTree.header().setVisible(False)
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.setObjectName("qtLibCombo")
self.qtLibCombo.addItem("")
@ -45,9 +37,6 @@ class Ui_Form(object):
self.qtLibCombo.addItem("")
self.qtLibCombo.addItem("")
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.setObjectName("label")
self.gridLayout.addWidget(self.label, 1, 0, 1, 1)
@ -81,15 +70,10 @@ class Ui_Form(object):
def retranslateUi(self, Form):
_translate = QtCore.QCoreApplication.translate
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(1, _translate("Form", "PyQt5"))
self.qtLibCombo.setItemText(2, _translate("Form", "PySide2"))
self.qtLibCombo.setItemText(3, _translate("Form", "PySide6"))
self.qtLibCombo.setItemText(4, _translate("Form", "PyQt6"))
self.label_2.setText(_translate("Form", "Graphics System:"))
self.label.setText(_translate("Form", "Qt Library:"))
self.loadBtn.setText(_translate("Form", "Run Example"))

View File

@ -1,6 +1,6 @@
# 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
# 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.header().setVisible(False)
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.setObjectName("qtLibCombo")
self.qtLibCombo.addItem("")
@ -43,9 +36,6 @@ class Ui_Form(object):
self.qtLibCombo.addItem("")
self.qtLibCombo.addItem("")
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.setObjectName("label")
self.gridLayout.addWidget(self.label, 1, 0, 1, 1)
@ -79,15 +69,10 @@ class Ui_Form(object):
def retranslateUi(self, Form):
_translate = QtCore.QCoreApplication.translate
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(1, _translate("Form", "PyQt5"))
self.qtLibCombo.setItemText(2, _translate("Form", "PySide2"))
self.qtLibCombo.setItemText(3, _translate("Form", "PySide6"))
self.qtLibCombo.setItemText(4, _translate("Form", "PyQt6"))
self.label_2.setText(_translate("Form", "Graphics System:"))
self.label.setText(_translate("Form", "Qt Library:"))
self.loadBtn.setText(_translate("Form", "Run Example"))

View File

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

View File

@ -37,15 +37,6 @@ class Ui_Form(object):
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.addItem("")
self.qtLibCombo.addItem("")
@ -56,11 +47,6 @@ class Ui_Form(object):
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.setObjectName(u"label")
@ -106,18 +92,12 @@ class Ui_Form(object):
def retranslateUi(self, Form):
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(1, QCoreApplication.translate("Form", u"PyQt5", None))
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("")

View File

@ -20,25 +20,8 @@ if not hasattr(sys, 'frozen'):
sys.path.remove(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
## 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))
print("Using", pg.Qt.QT_LIB)
## Enable fault handling to give more helpful error messages on crash.
## Only available in python 3.3+

View File

@ -12,7 +12,6 @@ from pyqtgraph.Qt import QtGui, QtCore
import numpy as np
import pyqtgraph as pg
#QtGui.QApplication.setGraphicsSystem('raster')
app = pg.mkQApp("Linked Views Example")
#mw = QtGui.QMainWindow()
#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)
name, file = f
@ -210,15 +210,11 @@ def testExamples(frontend, f, graphicsSystem=None):
sys.stdout.flush()
import1 = "import %s" % frontend if frontend != '' else ''
import2 = os.path.splitext(os.path.split(fn)[1])[0]
graphicsSystem = (
'' if graphicsSystem is None else "pg.QtGui.QApplication.setGraphicsSystem('%s')" % graphicsSystem
)
code = """
try:
%s
import initExample
import pyqtgraph as pg
%s
import %s
import sys
print("test complete")
@ -231,7 +227,7 @@ except:
print("test failed")
raise
""" % (import1, graphicsSystem, import2)
""" % (import1, import2)
if sys.platform.startswith('win'):
process = subprocess.Popen([sys.executable],
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
useOpenGL = False
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).')
if QtGui.QApplication.setGraphicsSystem:
QtGui.QApplication.setGraphicsSystem('raster') ## work around a variety of bugs in the native graphics system
print('Warning: QApplication was created before pyqtgraph was imported; there may be problems.')
else:
useOpenGL = False ## on windows there's a more even performance / bugginess tradeoff.