Skip to content

Commit

Permalink
replace addShape's linebgcolor argument with gapcolor
Browse files Browse the repository at this point in the history
  • Loading branch information
t20100 committed Dec 14, 2023
1 parent a17dd56 commit 6f2335c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/silx/gui/plot/PlotInteraction.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ def setSelectionArea(self, points, fill, color, name="", shape="polygon"):
shape=shape,
fill=fill,
color=color,
linebgcolor=color2,
gapcolor=color2,
linestyle="--",
overlay=True,
)
Expand Down
16 changes: 13 additions & 3 deletions src/silx/gui/plot/PlotWidget.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
from .. import qt
from ._utils.panzoom import ViewConstraints
from ...gui.plot._utils.dtime_ticklayout import timestamp
from ...utils.deprecation import deprecated_warning


"""
Expand Down Expand Up @@ -1643,7 +1644,8 @@ def addShape(
z=None,
linestyle="-",
linewidth=1.0,
linebgcolor=None,
linebgcolor="deprecated",
gapcolor=None,
):
"""Add an item (i.e. a shape) to the plot.
Expand Down Expand Up @@ -1680,7 +1682,7 @@ def addShape(
- ':' dotted line
:param float linewidth: Width of the line.
Only relevant for line markers where X or Y is None.
:param str linebgcolor: Background color of the line, e.g., 'blue', 'b',
:param str gapcolor: Gap color of the line, e.g., 'blue', 'b',
'#FF0000'. It is used to draw dotted line using a second color.
:returns: The shape item
"""
Expand All @@ -1705,7 +1707,15 @@ def addShape(
item.setPoints(numpy.array((xdata, ydata)).T)
item.setLineStyle(linestyle)
item.setLineWidth(linewidth)
item.setLineGapColor(linebgcolor)
if linebgcolor != "deprecated":
deprecated_warning(
type_="Argument",
name="linebgcolor",
replacement="gapcolor",
since_version="2.0.0",
)
gapcolor = linebgcolor if gapcolor is None else gapcolor
item.setLineGapColor(gapcolor)

self.addItem(item)

Expand Down

0 comments on commit 6f2335c

Please sign in to comment.