Bugfixes:

- added workaround for Qt bug: https://bugreports.qt-project.org/browse/QTBUG-18616
  - allow pxMode argument in PlotDataItem.setData()
This commit is contained in:
Luke Campagnola 2012-06-12 16:02:48 -04:00
parent b9d0fd9c9f
commit e53c2165e6
3 changed files with 19 additions and 4 deletions

View File

@ -19,3 +19,10 @@ class GraphicsObject(GraphicsItem, QtGui.QGraphicsObject):
return ret return ret
def setParentItem(self, parent):
## Workaround for Qt bug: https://bugreports.qt-project.org/browse/QTBUG-18616
pscene = parent.scene()
if pscene is not None and self.scene() is not pscene:
pscene.addItem(self)
return QtGui.QGraphicsObject.setParentItem(self, parent)

View File

@ -52,3 +52,10 @@ class GraphicsWidget(GraphicsItem, QtGui.QGraphicsWidget):
return p return p
def setParentItem(self, parent):
## Workaround for Qt bug: https://bugreports.qt-project.org/browse/QTBUG-18616
pscene = parent.scene()
if pscene is not None and self.scene() is not pscene:
pscene.addItem(self)
return QtGui.QGraphicsWidget.setParentItem(self, parent)

View File

@ -128,7 +128,7 @@ class PlotDataItem(GraphicsObject):
'symbolSize': 10, 'symbolSize': 10,
'symbolPen': (200,200,200), 'symbolPen': (200,200,200),
'symbolBrush': (50, 50, 150), 'symbolBrush': (50, 50, 150),
'identical': False, 'pxMode': True,
'data': None, 'data': None,
} }
@ -355,7 +355,7 @@ class PlotDataItem(GraphicsObject):
curveArgs[v] = self.opts[k] curveArgs[v] = self.opts[k]
scatterArgs = {} scatterArgs = {}
for k,v in [('symbolPen','pen'), ('symbolBrush','brush'), ('symbol','symbol'), ('symbolSize', 'size'), ('data', 'data')]: for k,v in [('symbolPen','pen'), ('symbolBrush','brush'), ('symbol','symbol'), ('symbolSize', 'size'), ('data', 'data'), ('pxMode', 'pxMode')]:
if k in self.opts: if k in self.opts:
scatterArgs[v] = self.opts[k] scatterArgs[v] = self.opts[k]
@ -371,6 +371,7 @@ class PlotDataItem(GraphicsObject):
#self.curves.append(curve) #self.curves.append(curve)
if scatterArgs['symbol'] is not None: if scatterArgs['symbol'] is not None:
print scatterArgs
self.scatter.setData(x=x, y=y, **scatterArgs) self.scatter.setData(x=x, y=y, **scatterArgs)
self.scatter.show() self.scatter.show()
else: else:
@ -489,7 +490,7 @@ def dataType(obj):
if isSequence(obj): if isSequence(obj):
first = obj[0] first = obj[0]
if isinstance(obj, metaarray.MetaArray): if (hasattr(obj, 'implements') and obj.implements('MetaArray')):
return 'MetaArray' return 'MetaArray'
elif isinstance(obj, np.ndarray): elif isinstance(obj, np.ndarray):
if obj.ndim == 1: if obj.ndim == 1:
@ -510,7 +511,7 @@ def dataType(obj):
def isSequence(obj): def isSequence(obj):
return isinstance(obj, list) or isinstance(obj, np.ndarray) or isinstance(obj, metaarray.MetaArray) return isinstance(obj, list) or isinstance(obj, np.ndarray) or (hasattr(obj, 'implements') and obj.implements('MetaArray'))