initExample.py 817 Bytes
Newer Older
Luke Campagnola's avatar
Luke Campagnola committed
1 2
## make this version of pyqtgraph importable before any others
import sys, os
3 4
path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
path.rstrip(os.path.sep)
5
if 'pyqtgraph' in os.listdir(path):
6
    sys.path.insert(0, path) ## examples adjacent to pyqtgraph (as in source)
7 8
elif path.endswith('pyqtgraph'):
    sys.path.insert(0, os.path.abspath(os.path.join(path, '..')))  ## examples installed inside pyqtgraph package
9

10 11
## should force example to use PySide instead of PyQt
if 'pyside' in sys.argv:  
12
    from PySide import QtGui
13
elif 'pyqt' in sys.argv: 
14 15 16 17
    from PyQt4 import QtGui
else:
    from pyqtgraph.Qt import QtGui
    
18
## Force use of a specific graphics system
19 20 21 22 23
for gs in ['raster', 'native', 'opengl']:
    if gs in sys.argv:
        QtGui.QApplication.setGraphicsSystem(gs)
        break