From 953b9e412915ee7096b94f46d6ff2a3410f02265 Mon Sep 17 00:00:00 2001 From: Mikhail Terekhov Date: Fri, 28 Feb 2014 16:16:13 -0500 Subject: [PATCH] Make signature of the setPen method consistent --- pyqtgraph/flowchart/Node.py | 4 ++-- pyqtgraph/graphicsItems/AxisItem.py | 6 +++--- pyqtgraph/graphicsItems/GraphItem.py | 4 ++-- pyqtgraph/graphicsItems/InfiniteLine.py | 4 ++-- pyqtgraph/graphicsItems/ROI.py | 4 ++-- pyqtgraph/widgets/PathButton.py | 7 +++---- 6 files changed, 14 insertions(+), 15 deletions(-) diff --git a/pyqtgraph/flowchart/Node.py b/pyqtgraph/flowchart/Node.py index b6ed1e0f..da130c8c 100644 --- a/pyqtgraph/flowchart/Node.py +++ b/pyqtgraph/flowchart/Node.py @@ -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): diff --git a/pyqtgraph/graphicsItems/AxisItem.py b/pyqtgraph/graphicsItems/AxisItem.py index 66efeda5..a2176f8b 100644 --- a/pyqtgraph/graphicsItems/AxisItem.py +++ b/pyqtgraph/graphicsItems/AxisItem.py @@ -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 `) """ 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() diff --git a/pyqtgraph/graphicsItems/GraphItem.py b/pyqtgraph/graphicsItems/GraphItem.py index 97759522..1e64fd52 100644 --- a/pyqtgraph/graphicsItems/GraphItem.py +++ b/pyqtgraph/graphicsItems/GraphItem.py @@ -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): diff --git a/pyqtgraph/graphicsItems/InfiniteLine.py b/pyqtgraph/graphicsItems/InfiniteLine.py index edf6b19e..d86883b0 100644 --- a/pyqtgraph/graphicsItems/InfiniteLine.py +++ b/pyqtgraph/graphicsItems/InfiniteLine.py @@ -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 `.""" - self.pen = fn.mkPen(pen) + self.pen = fn.mkPen(*args, **kwargs) self.currentPen = self.pen self.update() diff --git a/pyqtgraph/graphicsItems/ROI.py b/pyqtgraph/graphicsItems/ROI.py index b99465b5..27fb7110 100644 --- a/pyqtgraph/graphicsItems/ROI.py +++ b/pyqtgraph/graphicsItems/ROI.py @@ -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() diff --git a/pyqtgraph/widgets/PathButton.py b/pyqtgraph/widgets/PathButton.py index 0c62bb1b..52c60e20 100644 --- a/pyqtgraph/widgets/PathButton.py +++ b/pyqtgraph/widgets/PathButton.py @@ -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() - + - \ No newline at end of file