Make setPen() methods more consistent throughout the package.
Merge remote-tracking branch 'termim/develop' into develop Conflicts: pyqtgraph/graphicsItems/ROI.py
This commit is contained in:
commit
2e3cfcbd6d
@ -17,6 +17,7 @@ pyqtgraph-0.9.9 [unreleased]
|
|||||||
sigTransformChanged => sigDeviceTransformChanged.
|
sigTransformChanged => sigDeviceTransformChanged.
|
||||||
- GLViewWidget.itemsAt() now measures y from top of widget to match mouse
|
- GLViewWidget.itemsAt() now measures y from top of widget to match mouse
|
||||||
event position.
|
event position.
|
||||||
|
- Made setPen() methods consistent throughout the package
|
||||||
|
|
||||||
New Features:
|
New Features:
|
||||||
- Added ViewBox.setLimits() method
|
- Added ViewBox.setLimits() method
|
||||||
|
@ -10,7 +10,7 @@ Copyright 2012 Luke Campagnola, University of North Carolina at Chapel Hill
|
|||||||
Maintainer
|
Maintainer
|
||||||
----------
|
----------
|
||||||
|
|
||||||
* Luke Campagnola ('luke.campagnola@%s.com' % 'gmail')
|
* Luke Campagnola <luke.campagnola@gmail.com>
|
||||||
|
|
||||||
Contributors
|
Contributors
|
||||||
------------
|
------------
|
||||||
@ -26,6 +26,7 @@ Contributors
|
|||||||
* Antony Lee
|
* Antony Lee
|
||||||
* Mattias Põldaru
|
* Mattias Põldaru
|
||||||
* Thomas S.
|
* Thomas S.
|
||||||
|
* Mikhail Terekhov
|
||||||
|
|
||||||
Requirements
|
Requirements
|
||||||
------------
|
------------
|
||||||
|
@ -221,9 +221,12 @@ class MouseClickEvent(object):
|
|||||||
return self._modifiers
|
return self._modifiers
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
p = self.pos()
|
try:
|
||||||
return "<MouseClickEvent (%g,%g) button=%d>" % (p.x(), p.y(), int(self.button()))
|
p = self.pos()
|
||||||
|
return "<MouseClickEvent (%g,%g) button=%d>" % (p.x(), p.y(), int(self.button()))
|
||||||
|
except:
|
||||||
|
return "<MouseClickEvent button=%d>" % (int(self.button()))
|
||||||
|
|
||||||
def time(self):
|
def time(self):
|
||||||
return self._time
|
return self._time
|
||||||
|
|
||||||
|
@ -501,8 +501,8 @@ class NodeGraphicsItem(GraphicsObject):
|
|||||||
bounds = self.boundingRect()
|
bounds = self.boundingRect()
|
||||||
self.nameItem.setPos(bounds.width()/2. - self.nameItem.boundingRect().width()/2., 0)
|
self.nameItem.setPos(bounds.width()/2. - self.nameItem.boundingRect().width()/2., 0)
|
||||||
|
|
||||||
def setPen(self, pen):
|
def setPen(self, *args, **kwargs):
|
||||||
self.pen = pen
|
self.pen = fn.mkPen(*args, **kwargs)
|
||||||
self.update()
|
self.update()
|
||||||
|
|
||||||
def setBrush(self, brush):
|
def setBrush(self, brush):
|
||||||
|
@ -74,7 +74,10 @@ class AxisItem(GraphicsWidget):
|
|||||||
|
|
||||||
self.setRange(0, 1)
|
self.setRange(0, 1)
|
||||||
|
|
||||||
self.setPen(pen)
|
if pen is None:
|
||||||
|
self.setPen()
|
||||||
|
else:
|
||||||
|
self.setPen(pen)
|
||||||
|
|
||||||
self._linkedView = None
|
self._linkedView = None
|
||||||
if linkView is not None:
|
if linkView is not None:
|
||||||
@ -271,16 +274,17 @@ class AxisItem(GraphicsWidget):
|
|||||||
return fn.mkPen(getConfigOption('foreground'))
|
return fn.mkPen(getConfigOption('foreground'))
|
||||||
return fn.mkPen(self._pen)
|
return fn.mkPen(self._pen)
|
||||||
|
|
||||||
def setPen(self, pen):
|
def setPen(self, *args, **kwargs):
|
||||||
"""
|
"""
|
||||||
Set the pen used for drawing text, axes, ticks, and grid lines.
|
Set the pen used for drawing text, axes, ticks, and grid lines.
|
||||||
if pen == None, the default will be used (see :func:`setConfigOption
|
If no arguments are given, the default foreground color will be used
|
||||||
<pyqtgraph.setConfigOption>`)
|
(see :func:`setConfigOption <pyqtgraph.setConfigOption>`).
|
||||||
"""
|
"""
|
||||||
self.picture = None
|
self.picture = None
|
||||||
if pen is None:
|
if args or kwargs:
|
||||||
pen = getConfigOption('foreground')
|
self._pen = fn.mkPen(*args, **kwargs)
|
||||||
self._pen = fn.mkPen(pen)
|
else:
|
||||||
|
self._pen = fn.mkPen(getConfigOption('foreground'))
|
||||||
self.labelStyle['color'] = '#' + fn.colorStr(self._pen.color())[:6]
|
self.labelStyle['color'] = '#' + fn.colorStr(self._pen.color())[:6]
|
||||||
self.setLabel()
|
self.setLabel()
|
||||||
self.update()
|
self.update()
|
||||||
|
@ -28,7 +28,7 @@ class GraphItem(GraphicsObject):
|
|||||||
"""
|
"""
|
||||||
Change the data displayed by the graph.
|
Change the data displayed by the graph.
|
||||||
|
|
||||||
============== =========================================================
|
============== =======================================================================
|
||||||
**Arguments:**
|
**Arguments:**
|
||||||
pos (N,2) array of the positions of each node in the graph.
|
pos (N,2) array of the positions of each node in the graph.
|
||||||
adj (M,2) array of connection data. Each row contains indexes
|
adj (M,2) array of connection data. Each row contains indexes
|
||||||
@ -50,7 +50,7 @@ class GraphItem(GraphicsObject):
|
|||||||
:func:`ScatterPlotItem.setData() <pyqtgraph.ScatterPlotItem.setData>`
|
:func:`ScatterPlotItem.setData() <pyqtgraph.ScatterPlotItem.setData>`
|
||||||
to affect the appearance of nodes (symbol, size, brush,
|
to affect the appearance of nodes (symbol, size, brush,
|
||||||
etc.)
|
etc.)
|
||||||
============== =========================================================
|
============== =======================================================================
|
||||||
"""
|
"""
|
||||||
if 'adj' in kwds:
|
if 'adj' in kwds:
|
||||||
self.adjacency = kwds.pop('adj')
|
self.adjacency = kwds.pop('adj')
|
||||||
@ -67,8 +67,21 @@ class GraphItem(GraphicsObject):
|
|||||||
self.scatter.setData(**kwds)
|
self.scatter.setData(**kwds)
|
||||||
self.informViewBoundsChanged()
|
self.informViewBoundsChanged()
|
||||||
|
|
||||||
def setPen(self, pen):
|
def setPen(self, *args, **kwargs):
|
||||||
self.pen = pen
|
"""
|
||||||
|
Set the pen used to draw graph lines.
|
||||||
|
May be:
|
||||||
|
|
||||||
|
* None to disable line drawing
|
||||||
|
* Record array with fields (red, green, blue, alpha, width)
|
||||||
|
* Any set of arguments and keyword arguments accepted by
|
||||||
|
:func:`mkPen <pyqtgraph.mkPen>`.
|
||||||
|
* 'default' to use the default foreground color.
|
||||||
|
"""
|
||||||
|
if len(args) == 1 and len(kwargs) == 0:
|
||||||
|
self.pen = args[0]
|
||||||
|
else:
|
||||||
|
self.pen = fn.mkPen(*args, **kwargs)
|
||||||
self.picture = None
|
self.picture = None
|
||||||
|
|
||||||
def generatePicture(self):
|
def generatePicture(self):
|
||||||
|
@ -73,10 +73,10 @@ class InfiniteLine(GraphicsObject):
|
|||||||
self.maxRange = bounds
|
self.maxRange = bounds
|
||||||
self.setValue(self.value())
|
self.setValue(self.value())
|
||||||
|
|
||||||
def setPen(self, pen):
|
def setPen(self, *args, **kwargs):
|
||||||
"""Set the pen for drawing the line. Allowable arguments are any that are valid
|
"""Set the pen for drawing the line. Allowable arguments are any that are valid
|
||||||
for :func:`mkPen <pyqtgraph.mkPen>`."""
|
for :func:`mkPen <pyqtgraph.mkPen>`."""
|
||||||
self.pen = fn.mkPen(pen)
|
self.pen = fn.mkPen(*args, **kwargs)
|
||||||
self.currentPen = self.pen
|
self.currentPen = self.pen
|
||||||
self.update()
|
self.update()
|
||||||
|
|
||||||
|
@ -194,11 +194,12 @@ class ROI(GraphicsObject):
|
|||||||
"""
|
"""
|
||||||
return self.mapToParent(self.boundingRect()).boundingRect()
|
return self.mapToParent(self.boundingRect()).boundingRect()
|
||||||
|
|
||||||
def setPen(self, pen):
|
def setPen(self, *args, **kwargs):
|
||||||
"""
|
"""
|
||||||
Set the pen to use when drawing the ROI shape.
|
Set the pen to use when drawing the ROI shape.
|
||||||
|
For arguments, see :func:`mkPen <pyqtgraph.mkPen>`.
|
||||||
"""
|
"""
|
||||||
self.pen = fn.mkPen(pen)
|
self.pen = fn.mkPen(*args, **kwargs)
|
||||||
self.currentPen = self.pen
|
self.currentPen = self.pen
|
||||||
self.update()
|
self.update()
|
||||||
|
|
||||||
|
@ -23,8 +23,8 @@ class PathButton(QtGui.QPushButton):
|
|||||||
def setBrush(self, brush):
|
def setBrush(self, brush):
|
||||||
self.brush = fn.mkBrush(brush)
|
self.brush = fn.mkBrush(brush)
|
||||||
|
|
||||||
def setPen(self, pen):
|
def setPen(self, *args, **kwargs):
|
||||||
self.pen = fn.mkPen(pen)
|
self.pen = fn.mkPen(*args, **kwargs)
|
||||||
|
|
||||||
def setPath(self, path):
|
def setPath(self, path):
|
||||||
self.path = path
|
self.path = path
|
||||||
@ -46,6 +46,5 @@ class PathButton(QtGui.QPushButton):
|
|||||||
p.setBrush(self.brush)
|
p.setBrush(self.brush)
|
||||||
p.drawPath(self.path)
|
p.drawPath(self.path)
|
||||||
p.end()
|
p.end()
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user