diff --git a/examples/ExampleApp.py b/examples/ExampleApp.py index 458daf76..c54d79b2 100644 --- a/examples/ExampleApp.py +++ b/examples/ExampleApp.py @@ -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() diff --git a/examples/VideoSpeedTest.py b/examples/VideoSpeedTest.py index d7ae7ed7..ecae3b30 100644 --- a/examples/VideoSpeedTest.py +++ b/examples/VideoSpeedTest.py @@ -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 diff --git a/examples/initExample.py b/examples/initExample.py index 97f46108..9b868803 100644 --- a/examples/initExample.py +++ b/examples/initExample.py @@ -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+