Merge remote-tracking branch 'nicolaisi/ntj01' into develop
This commit is contained in:
commit
021addcf0e
@ -30,6 +30,8 @@ Contributors
|
||||
* Mikhail Terekhov
|
||||
* Pietro Zambelli
|
||||
* Stefan Holzmann
|
||||
* Nicholas TJ
|
||||
* John David Reaver
|
||||
|
||||
Requirements
|
||||
------------
|
||||
|
@ -357,10 +357,6 @@ class ScatterPlotItem(GraphicsObject):
|
||||
for i in range(len(spots)):
|
||||
spot = spots[i]
|
||||
for k in spot:
|
||||
#if k == 'pen':
|
||||
#newData[k] = fn.mkPen(spot[k])
|
||||
#elif k == 'brush':
|
||||
#newData[k] = fn.mkBrush(spot[k])
|
||||
if k == 'pos':
|
||||
pos = spot[k]
|
||||
if isinstance(pos, QtCore.QPointF):
|
||||
@ -369,10 +365,12 @@ class ScatterPlotItem(GraphicsObject):
|
||||
x,y = pos[0], pos[1]
|
||||
newData[i]['x'] = x
|
||||
newData[i]['y'] = y
|
||||
elif k in ['x', 'y', 'size', 'symbol', 'pen', 'brush', 'data']:
|
||||
elif k == 'pen':
|
||||
newData[i][k] = fn.mkPen(spot[k])
|
||||
elif k == 'brush':
|
||||
newData[i][k] = fn.mkBrush(spot[k])
|
||||
elif k in ['x', 'y', 'size', 'symbol', 'brush', 'data']:
|
||||
newData[i][k] = spot[k]
|
||||
#elif k == 'data':
|
||||
#self.pointData[i] = spot[k]
|
||||
else:
|
||||
raise Exception("Unknown spot parameter: %s" % k)
|
||||
elif 'y' in kargs:
|
||||
|
@ -48,6 +48,38 @@ def test_scatterplotitem():
|
||||
spot.setPen('g')
|
||||
spot.setSymbol('o')
|
||||
spot.setData(None)
|
||||
app.processEvents()
|
||||
|
||||
plot.clear()
|
||||
|
||||
|
||||
def test_init_spots():
|
||||
spots = [
|
||||
{'x': 0, 'y': 1},
|
||||
{'pos': (1, 2), 'pen': None, 'brush': None, 'data': 'zzz'},
|
||||
]
|
||||
s = pg.ScatterPlotItem(spots=spots)
|
||||
|
||||
# Check we can display without errors
|
||||
plot.addItem(s)
|
||||
app.processEvents()
|
||||
plot.clear()
|
||||
|
||||
# check data is correct
|
||||
spots = s.points()
|
||||
|
||||
defPen = pg.mkPen(pg.getConfigOption('foreground'))
|
||||
|
||||
assert spots[0].pos().x() == 0
|
||||
assert spots[0].pos().y() == 1
|
||||
assert spots[0].pen() == defPen
|
||||
assert spots[0].data() is None
|
||||
|
||||
assert spots[1].pos().x() == 1
|
||||
assert spots[1].pos().y() == 2
|
||||
assert spots[1].pen() == pg.mkPen(None)
|
||||
assert spots[1].brush() == pg.mkBrush(None)
|
||||
assert spots[1].data() == 'zzz'
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
Loading…
x
Reference in New Issue
Block a user