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