Make signature of the setPen method consistent

This commit is contained in:
Mikhail Terekhov 2014-02-28 16:16:13 -05:00
parent 6255dca99c
commit 953b9e4129
6 changed files with 14 additions and 15 deletions

View File

@ -501,8 +501,8 @@ class NodeGraphicsItem(GraphicsObject):
bounds = self.boundingRect()
self.nameItem.setPos(bounds.width()/2. - self.nameItem.boundingRect().width()/2., 0)
def setPen(self, pen):
self.pen = pen
def setPen(self, *args, **kwargs):
self.pen = fn.mkPen(*args, **kwargs)
self.update()
def setBrush(self, brush):

View File

@ -271,16 +271,16 @@ class AxisItem(GraphicsWidget):
return fn.mkPen(getConfigOption('foreground'))
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.
if pen == None, the default will be used (see :func:`setConfigOption
<pyqtgraph.setConfigOption>`)
"""
self.picture = None
if pen is None:
if not (args or kwargs):
pen = getConfigOption('foreground')
self._pen = fn.mkPen(pen)
self._pen = fn.mkPen(*args, **kwargs)
self.labelStyle['color'] = '#' + fn.colorStr(self._pen.color())[:6]
self.setLabel()
self.update()

View File

@ -67,8 +67,8 @@ class GraphItem(GraphicsObject):
self.scatter.setData(**kwds)
self.informViewBoundsChanged()
def setPen(self, pen):
self.pen = pen
def setPen(self, *args, **kwargs):
self.pen = fn.mkPen(*args, **kwargs)
self.picture = None
def generatePicture(self):

View File

@ -73,10 +73,10 @@ class InfiniteLine(GraphicsObject):
self.maxRange = bounds
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
for :func:`mkPen <pyqtgraph.mkPen>`."""
self.pen = fn.mkPen(pen)
self.pen = fn.mkPen(*args, **kwargs)
self.currentPen = self.pen
self.update()

View File

@ -137,8 +137,8 @@ class ROI(GraphicsObject):
def parentBounds(self):
return self.mapToParent(self.boundingRect()).boundingRect()
def setPen(self, pen):
self.pen = fn.mkPen(pen)
def setPen(self, *args, **kwargs):
self.pen = fn.mkPen(*args, **kwargs)
self.currentPen = self.pen
self.update()

View File

@ -23,8 +23,8 @@ class PathButton(QtGui.QPushButton):
def setBrush(self, brush):
self.brush = fn.mkBrush(brush)
def setPen(self, pen):
self.pen = fn.mkPen(pen)
def setPen(self, *args, **kwargs):
self.pen = fn.mkPen(*args, **kwargs)
def setPath(self, path):
self.path = path
@ -46,6 +46,5 @@ class PathButton(QtGui.QPushButton):
p.setBrush(self.brush)
p.drawPath(self.path)
p.end()