41
41
42
42
from silx .gui .plot .tools .roi import RegionOfInterestManager
43
43
from silx .gui .plot .items .roi import LineROI
44
+ from silx .gui .plot import items
44
45
45
46
46
47
_logger = logging .getLogger (__name__ )
@@ -54,6 +55,7 @@ def __init__(self, parent=None):
54
55
[numpy .ndarray , numpy .ndarray ], str
55
56
]
56
57
] = None
58
+ self .setColor ("#001122" ) # Only there to trig updateStyle
57
59
58
60
def registerFormatFunction (
59
61
self ,
@@ -64,6 +66,17 @@ def registerFormatFunction(
64
66
"""Register a function for the formatting of the label"""
65
67
self ._formatFunction = fct
66
68
69
+ def _updatedStyle (self , event , style : items .CurveStyle ):
70
+ style = items .CurveStyle (
71
+ color = "red" ,
72
+ gapcolor = "white" ,
73
+ linestyle = (0 , (5 , 5 )),
74
+ linewidth = style .getLineWidth ())
75
+ LineROI ._updatedStyle (self , event , style )
76
+ self ._handleLabel .setColor ("black" )
77
+ self ._handleLabel .setBackgroundColor ("#FFFFFF60" )
78
+ self ._handleLabel .setZValue (1000 )
79
+
67
80
def setEndPoints (self , startPoint : numpy .ndarray , endPoint : numpy .ndarray ):
68
81
super ().setEndPoints (startPoint = startPoint , endPoint = endPoint )
69
82
if self ._formatFunction is not None :
@@ -90,9 +103,7 @@ def __init__(
90
103
self ,
91
104
parent = None ,
92
105
plot = None ,
93
- color : str = "yellow" ,
94
106
):
95
- self .__color = color
96
107
super ().__init__ (parent = parent , plot = plot )
97
108
self .setCheckable (True )
98
109
self ._roiManager = None
@@ -143,7 +154,6 @@ def _connectPlot(self, plot):
143
154
if plot is None :
144
155
return
145
156
self ._roiManager = RegionOfInterestManager (plot )
146
- self ._roiManager .setColor (self .__color ) # Set the color of ROI
147
157
self ._roiManager .sigRoiAdded .connect (self ._registerCurrentROI )
148
158
149
159
def _disconnectPlot (self , plot ):
0 commit comments