code cleanup--removed old tests

This commit is contained in:
Luke Campagnola 2012-05-31 16:09:52 -04:00
parent 26c73d3583
commit 6129df2019
4 changed files with 3 additions and 141 deletions

View File

@ -83,22 +83,3 @@ class ColorButton(QtGui.QPushButton):
def widgetGroupInterface(self):
return (self.sigColorChanged, ColorButton.saveState, ColorButton.restoreState)
if __name__ == '__main__':
app = QtGui.QApplication([])
win = QtGui.QMainWindow()
btn = ColorButton()
win.setCentralWidget(btn)
win.show()
def change(btn):
print("change", btn.color())
def done(btn):
print("done", btn.color())
btn.sigColorChanging.connect(change)
btn.sigColorChanged.connect(done)
## Start Qt event loop unless running in interactive mode.
import sys
if sys.flags.interactive != 1:
app.exec_()

View File

@ -81,26 +81,3 @@ class DataTreeWidget(QtGui.QTreeWidget):
#node = QtGui.QTreeWidgetItem([unicode(name), unicode(v)])
#return node
if __name__ == '__main__':
app = QtGui.QApplication([])
d = {
'list1': [1,2,3,4,5,6, {'nested1': 'aaaaa', 'nested2': 'bbbbb'}, "seven"],
'dict1': {
'x': 1,
'y': 2,
'z': 'three'
},
'array1 (20x20)': np.ones((10,10))
}
tree = DataTreeWidget(data=d)
tree.show()
tree.resize(600,600)
## Start Qt event loop unless running in interactive mode.
import sys
if sys.flags.interactive != 1:
app.exec_()

View File

@ -160,8 +160,9 @@ class SpinBox(QtGui.QAbstractSpinBox):
if self.opts['int']:
if 'step' in opts:
step = opts['step']
if int(step) != step:
raise Exception('Integer SpinBox must have integer step size.')
## not necessary..
#if int(step) != step:
#raise Exception('Integer SpinBox must have integer step size.')
else:
self.opts['step'] = int(self.opts['step'])
@ -486,61 +487,3 @@ class SpinBox(QtGui.QAbstractSpinBox):
#def widgetGroupInterface(self):
#return (self.valueChanged, SpinBox.value, SpinBox.setValue)
if __name__ == '__main__':
import sys
app = QtGui.QApplication([])
def valueChanged(sb):
#sb = QtCore.QObject.sender()
print(str(sb) + " valueChanged: %s" % str(sb.value()))
def valueChanging(sb, value):
#sb = QtCore.QObject.sender()
print(str(sb) + " valueChanging: %s" % str(sb.value()))
def mkWin():
win = QtGui.QMainWindow()
g = QtGui.QFormLayout()
w = QtGui.QWidget()
w.setLayout(g)
win.setCentralWidget(w)
s1 = SpinBox(value=5, step=0.1, bounds=[-1.5, None], suffix='units')
t1 = QtGui.QLineEdit()
g.addRow(s1, t1)
s2 = SpinBox(value=10e-6, dec=True, step=0.1, minStep=1e-6, suffix='A', siPrefix=True)
t2 = QtGui.QLineEdit()
g.addRow(s2, t2)
s3 = SpinBox(value=1000, dec=True, step=0.5, minStep=1e-6, bounds=[1, 1e9], suffix='Hz', siPrefix=True)
t3 = QtGui.QLineEdit()
g.addRow(s3, t3)
s4 = SpinBox(int=True, dec=True, step=1, minStep=1, bounds=[-10, 1000])
t4 = QtGui.QLineEdit()
g.addRow(s4, t4)
win.show()
import sys
for sb in [s1, s2, s3,s4]:
#QtCore.QObject.connect(sb, QtCore.SIGNAL('valueChanged(double)'), lambda v: sys.stdout.write(str(sb) + " valueChanged\n"))
#QtCore.QObject.connect(sb, QtCore.SIGNAL('editingFinished()'), lambda: sys.stdout.write(str(sb) + " editingFinished\n"))
sb.sigValueChanged.connect(valueChanged)
sb.sigValueChanging.connect(valueChanging)
sb.editingFinished.connect(lambda: sys.stdout.write(str(sb) + " editingFinished\n"))
return win, w, [s1, s2, s3, s4]
a = mkWin()
def test(n=100):
for i in range(n):
win, w, sb = mkWin()
for s in sb:
w.setParent(None)
s.setParent(None)
s.valueChanged.disconnect()
s.editingFinished.disconnect()
## Start Qt event loop unless running in interactive mode.
if sys.flags.interactive != 1:
app.exec_()

View File

@ -1,7 +1,4 @@
# -*- coding: utf-8 -*-
if __name__ == '__main__':
import sys, os
sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..'))
from pyqtgraph.Qt import QtGui, QtCore
from weakref import *
@ -156,39 +153,3 @@ class TreeWidget(QtGui.QTreeWidget):
else:
item.setFlags(item.flags() | QtCore.Qt.ItemIsDropEnabled)
if __name__ == '__main__':
app = QtGui.QApplication([])
w = TreeWidget()
w.setColumnCount(2)
w.show()
i1 = QtGui.QTreeWidgetItem(["Item 1"])
i11 = QtGui.QTreeWidgetItem(["Item 1.1"])
i12 = QtGui.QTreeWidgetItem(["Item 1.2"])
i2 = QtGui.QTreeWidgetItem(["Item 2"])
i21 = QtGui.QTreeWidgetItem(["Item 2.1"])
i211 = QtGui.QTreeWidgetItem(["Item 2.1.1"])
i212 = QtGui.QTreeWidgetItem(["Item 2.1.2"])
i22 = QtGui.QTreeWidgetItem(["Item 2.2"])
i3 = QtGui.QTreeWidgetItem(["Item 3"])
i4 = QtGui.QTreeWidgetItem(["Item 4"])
i5 = QtGui.QTreeWidgetItem(["Item 5"])
w.addTopLevelItem(i1)
w.addTopLevelItem(i2)
w.addTopLevelItem(i3)
w.addTopLevelItem(i4)
w.addTopLevelItem(i5)
i1.addChild(i11)
i1.addChild(i12)
i2.addChild(i21)
i21.addChild(i211)
i21.addChild(i212)
i2.addChild(i22)
b1 = QtGui.QPushButton("B1")
w.setItemWidget(i1, 1, b1)
app.exec_()