Permalink
Browse files

- Major reorganization; we now follow the standard python package str…

…ucture.

- Overhaul of SVG export system. Seems to work well.
- Fixed image export bugs
- Added basic 3D line plot class
  • Loading branch information...
2 parents a157d9c + 51b0ba0 commit 45048467b39a155f974e1272685a681703c97787 @campagnola campagnola committed Dec 26, 2012
Showing 330 changed files with 889 additions and 249 deletions.
@@ -1,4 +1,4 @@
-Copyright (c) 2011 University of North Carolina at Chapel Hill
+Copyright (c) 2012 University of North Carolina at Chapel Hill
Luke Campagnola ('luke.campagnola@%s.com' % 'gmail')
The MIT License
View
@@ -1,6 +1,6 @@
PyQtGraph - A pure-Python graphics library for PyQt/PySide
-Copyright 2011 Luke Campagnola, University of North Carolina at Chapel Hill
-http://http://luke.campagnola.me/code/pyqtgraph
+Copyright 2012 Luke Campagnola, University of North Carolina at Chapel Hill
+http://www.pyqtgraph.org
Authors:
Luke Campagnola ('luke.campagnola@%s.com' % 'gmail')
@@ -9,30 +9,29 @@ Authors:
Requirements:
PyQt 4.7+ or PySide
- python 2.7+ (no python 3 support yet)
+ python 2.6, 2.7, or 3.x
numpy, scipy
-
+ For 3D graphics: pyopengl
Known to run on Windows, Linux, and Mac.
Support:
Post at the mailing list / forum:
https://groups.google.com/forum/?fromgroups#!forum/pyqtgraph
-Installation:
- Pyqtgraph currently does not have (or really require) any installation
- scripts. All that is needed is for the pyqtgraph folder to be placed
- someplace importable. Most people will prefer to simply place this folder
- within a larger project folder. If you want to make pyqtgraph available
- system-wide, copy the folder to one of the directories listed in python's
- sys.path list.
+Installation Methods:
+ - To use with a specific project, simply copy the pyqtgraph subdirectory
+ anywhere that is importable from your project
+ - To install system-wide from source distribution:
+ $ python setup.py install
+ - For instalation packages, see the website (pyqtgraph.org)
Documentation:
- There are many examples; run "python -m pyqtgraph.examples" for a menu
+ There are many examples; run "python -m pyqtgraph.examples" for a menu.
Some (incomplete) documentation exists at this time.
- Easiest place to get documentation is at
- http://http://luke.campagnola.me/code/pyqtgraph/documentation
+ http://www.pyqtgraph.org/documentation
- If you acquired this code as a .tar.gz file from the website, then you can also look in
- pyqtgraph/documentation/html.
+ doc/html.
- If you acquired this code via BZR, then you can build the documentation using sphinx.
From the documentation directory, run:
$ make html
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -1,7 +1,6 @@
# -*- coding: utf-8 -*-
## Add path to library (just for examples; you do not need this)
-import sys, os
-sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', '..'))
+import initExample
from pyqtgraph.Qt import QtCore, QtGui
import pyqtgraph.opengl as gl
@@ -4,8 +4,7 @@
## (a hydrogen orbital) into a mesh for 3D display.
## Add path to library (just for examples; you do not need this)
-import sys, os
-sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', '..'))
+import initExample
from pyqtgraph.Qt import QtCore, QtGui
import pyqtgraph as pg
@@ -0,0 +1,47 @@
+# -*- coding: utf-8 -*-
+## Add path to library (just for examples; you do not need this)
+import initExample
+
+from pyqtgraph.Qt import QtCore, QtGui
+import pyqtgraph.opengl as gl
+import pyqtgraph as pg
+import numpy as np
+
+app = QtGui.QApplication([])
+w = gl.GLViewWidget()
+w.opts['distance'] = 40
+w.show()
+
+gx = gl.GLGridItem()
+gx.rotate(90, 0, 1, 0)
+gx.translate(-10, 0, 0)
+w.addItem(gx)
+gy = gl.GLGridItem()
+gy.rotate(90, 1, 0, 0)
+gy.translate(0, -10, 0)
+w.addItem(gy)
+gz = gl.GLGridItem()
+gz.translate(0, 0, -10)
+w.addItem(gz)
+
+def fn(x, y):
+ return np.cos((x**2 + y**2)**0.5)
+
+n = 51
+y = np.linspace(-10,10,n)
+x = np.linspace(-10,10,100)
+for i in range(n):
+ yi = np.array([y[i]]*100)
+ d = (x**2 + yi**2)**0.5
+ z = 10 * np.cos(d) / (d+1)
+ pts = np.vstack([x,yi,z]).transpose()
+ plt = gl.GLLinePlotItem(pos=pts, color=pg.glColor((i,n*1.3)))
+ w.addItem(plt)
+
+
+
+## Start Qt event loop unless running in interactive mode.
+if __name__ == '__main__':
+ import sys
+ if (sys.flags.interactive != 1) or not hasattr(QtCore, 'PYQT_VERSION'):
+ QtGui.QApplication.instance().exec_()
@@ -5,8 +5,7 @@
"""
## Add path to library (just for examples; you do not need this)
-import sys, os
-sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', '..'))
+import initExample
from pyqtgraph.Qt import QtCore, QtGui
import pyqtgraph as pg
@@ -1,7 +1,6 @@
# -*- coding: utf-8 -*-
## Add path to library (just for examples; you do not need this)
-import sys, os
-sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', '..'))
+import initExample
from pyqtgraph.Qt import QtCore, QtGui
import pyqtgraph.opengl as gl
@@ -5,8 +5,7 @@
## Add path to library (just for examples; you do not need this)
-import sys, os
-sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', '..'))
+import initExample
from pyqtgraph.Qt import QtCore, QtGui
import pyqtgraph as pg
@@ -1,7 +1,6 @@
# -*- coding: utf-8 -*-
## Add path to library (just for examples; you do not need this)
-import sys, os
-sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', '..'))
+import initExample
from pyqtgraph.Qt import QtCore, QtGui
import pyqtgraph.opengl as gl
@@ -1,7 +1,6 @@
# -*- coding: utf-8 -*-
## Add path to library (just for examples; you do not need this)
-import sys, os
-sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', '..'))
+import initExample
from pyqtgraph.Qt import QtCore, QtGui
import pyqtgraph.opengl as gl
@@ -6,8 +6,7 @@
## Add path to library (just for examples; you do not need this)
-import sys, os
-sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', '..'))
+import initExample
from pyqtgraph.Qt import QtCore, QtGui
import pyqtgraph as pg
@@ -1,7 +1,6 @@
# -*- coding: utf-8 -*-
## Add path to library (just for examples; you do not need this)
-import sys, os
-sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', '..'))
+import initExample
import numpy as np
from pyqtgraph.Qt import QtGui, QtCore
@@ -1,6 +1,5 @@
## Add path to library (just for examples; you do not need this)
-import sys, os
-sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', '..'))
+import initExample
from pyqtgraph.Qt import QtGui, QtCore
import pyqtgraph as pg
@@ -1,7 +1,6 @@
# -*- coding: utf-8 -*-
## Add path to library (just for examples; you do not need this)
-import sys, os
-sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', '..'))
+import initExample
from pyqtgraph.Qt import QtCore, QtGui
import pyqtgraph as pg
@@ -1,7 +1,6 @@
# -*- coding: utf-8 -*-
## Add path to library (just for examples; you do not need this)
-import sys, os
-sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', '..'))
+import initExample
import numpy as np
import scipy.ndimage as ndi
@@ -1,7 +1,6 @@
# -*- coding: utf-8 -*-
## Add path to library (just for examples; you do not need this)
-import sys, os
-sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', '..'))
+import initExample
from pyqtgraph.Qt import QtCore, QtGui
import numpy as np
@@ -1,8 +1,6 @@
# -*- coding: utf-8 -*-
## Add path to library (just for examples; you do not need this)
-import sys, os
-sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', '..'))
-
+import initExample
import numpy as np
import scipy
@@ -1,8 +1,7 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
## Add path to library (just for examples; you do not need this)
-import sys, os
-sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', '..'))
+import initExample
from scipy import random
@@ -1,8 +1,7 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
## Add path to library (just for examples; you do not need this)
-import sys, os
-sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', '..'))
+import initExample
from pyqtgraph.Qt import QtGui, QtCore
@@ -1,8 +1,7 @@
#!/usr/bin/python -i
# -*- coding: utf-8 -*-
## Add path to library (just for examples; you do not need this)
-import sys, os
-sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', '..'))
+import initExample
from pyqtgraph.Qt import QtCore, QtGui
@@ -1,8 +1,7 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
## Add path to library (just for examples; you do not need this)
-import sys, os
-sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', '..'))
+import initExample
from pyqtgraph.Qt import QtGui, QtCore, USE_PYSIDE
View
@@ -1,8 +1,7 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
## Add path to library (just for examples; you do not need this)
-import sys, os
-sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', '..'))
+import initExample
## This example uses a ViewBox to create a PlotWidget-like interface
View
@@ -1,6 +1,6 @@
import sys, os, subprocess, time
-## make sure this pyqtgraph is importable before any others
-sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', '..'))
+
+import initExample
from pyqtgraph.Qt import QtCore, QtGui, USE_PYSIDE
if USE_PYSIDE:
@@ -47,6 +47,7 @@
('Surface Plot', 'GLSurfacePlot.py'),
('Scatter Plot', 'GLScatterPlotItem.py'),
('Shaders', 'GLshaders.py'),
+ ('Line Plot', 'GLLinePlotItem.py'),
('Mesh', 'GLMeshItem.py'),
('Image', 'GLImageItem.py'),
])),
@@ -126,6 +127,9 @@ def loadFile(self):
extra.append('pyqt')
elif self.ui.pysideCheck.isChecked():
extra.append('pyside')
+
+ if self.ui.forceGraphicsCheck.isChecked():
+ extra.append(str(self.ui.forceGraphicsCombo.currentText()))
if fn is None:
return
@@ -163,22 +167,26 @@ def buildFileList(examples, files=None):
buildFileList(val, files)
return files
-def testFile(name, f, exe, lib):
+def testFile(name, f, exe, lib, graphicsSystem=None):
global path
fn = os.path.join(path,f)
#print "starting process: ", fn
-
+ os.chdir(path)
sys.stdout.write(name)
sys.stdout.flush()
+ import1 = "import %s" % lib if lib != '' 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 pyqtgraph as pg
+ %s
import %s
import sys
print("test complete")
sys.stdout.flush()
- import pyqtgraph as pg
import time
while True: ## run a little event loop
pg.QtGui.QApplication.processEvents()
@@ -187,8 +195,8 @@ def testFile(name, f, exe, lib):
print("test failed")
raise
-""" % ("import %s" % lib if lib != '' else "", os.path.splitext(os.path.split(fn)[1])[0])
- #print code
+""" % (import1, graphicsSystem, import2)
+
process = subprocess.Popen(['exec %s -i' % (exe)], shell=True, stdin=subprocess.PIPE, stderr=subprocess.PIPE, stdout=subprocess.PIPE)
process.stdin.write(code.encode('UTF-8'))
#process.stdin.close()
@@ -58,6 +58,36 @@
</layout>
</item>
<item>
+ <layout class="QHBoxLayout" name="horizontalLayout_2">
+ <item>
+ <widget class="QCheckBox" name="forceGraphicsCheck">
+ <property name="text">
+ <string>Force Graphics System:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QComboBox" name="forceGraphicsCombo">
+ <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>
+ </layout>
+ </item>
+ <item>
<widget class="QPushButton" name="loadBtn">
<property name="text">
<string>Load Example</string>
Oops, something went wrong.

0 comments on commit 4504846

Please sign in to comment.