2012-03-17 11:47:20 -04:00
|
|
|
## make this version of pyqtgraph importable before any others
|
2012-12-29 21:51:29 -05:00
|
|
|
## we do this to make sure that, when running examples, the correct library
|
|
|
|
## version is imported (if there are multiple versions present).
|
2012-03-17 11:47:20 -04:00
|
|
|
import sys, os
|
2021-01-14 12:24:09 +08:00
|
|
|
import importlib
|
2012-12-29 21:51:29 -05:00
|
|
|
|
|
|
|
if not hasattr(sys, 'frozen'):
|
2013-02-25 13:03:21 -05:00
|
|
|
if __file__ == '<stdin>':
|
|
|
|
path = os.getcwd()
|
|
|
|
else:
|
|
|
|
path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
|
2012-12-29 21:51:29 -05:00
|
|
|
path.rstrip(os.path.sep)
|
|
|
|
if 'pyqtgraph' in os.listdir(path):
|
|
|
|
sys.path.insert(0, path) ## examples adjacent to pyqtgraph (as in source tree)
|
|
|
|
else:
|
|
|
|
for p in sys.path:
|
|
|
|
if len(p) < 3:
|
|
|
|
continue
|
|
|
|
if path.startswith(p): ## If the example is already in an importable location, promote that location
|
|
|
|
sys.path.remove(p)
|
|
|
|
sys.path.insert(0, p)
|
|
|
|
|
2015-02-28 10:32:34 -05:00
|
|
|
import pyqtgraph as pg
|
2021-02-22 18:03:06 +08:00
|
|
|
print("Using", pg.Qt.QT_LIB)
|
2015-02-28 10:32:34 -05:00
|
|
|
|
2013-11-17 14:12:00 -05:00
|
|
|
## Enable fault handling to give more helpful error messages on crash.
|
|
|
|
## Only available in python 3.3+
|
|
|
|
try:
|
|
|
|
import faulthandler
|
|
|
|
faulthandler.enable()
|
|
|
|
except ImportError:
|
|
|
|
pass
|