@@ -11,23 +11,23 @@ class InteractiveInfiniteLine(InfiniteLine):
1111"""
1212 A subclass of InfiniteLine that provides custom hover behavior.
1313 """
14-
15- def __init__ (self ,angle = 90 ,pos = None ,movable = False ,bounds = None ,** kwargs ):
14+
15+ def __init__ (self ,angle = 90 ,pos = None ,movable = False ,bounds = None ,
16+ normal_pen = None ,highlight_pen = None ,** kwargs ):
1617super ().__init__ (angle = angle ,pos = pos ,movable = movable ,bounds = bounds ,** kwargs )
17- self ._normal_pen = None
18- self ._highlight_pen = None
19-
18+ self ._normal_pen = normal_pen
19+ self ._highlight_pen = highlight_pen
20+ self .setPen (normal_pen )
21+
2022def hoverEvent (self ,ev ):
2123"""
2224 Override hoverEvent to provide custom hover behavior.
23-
25+
2426 Parameters
2527 ----------
2628 ev : HoverEvent
2729 The hover event from pyqtgraph
2830 """
29- if not hasattr (ev ,'isEnter' ):
30- return
3131
3232if ev .isEnter ()and self ._highlight_pen is not None :
3333self .setPen (self ._highlight_pen )
@@ -164,37 +164,30 @@ def _plot_cutpoint(self, x):
164164self ._line = None
165165return
166166if self ._line is None :
167- # plot interactive vertical line
167+ normal_pen = mkPen (
168+ self .palette ().text ().color (),width = 4 ,
169+ style = Qt .SolidLine ,capStyle = Qt .RoundCap
170+ )
171+ highlight_pen = mkPen (
172+ self .palette ().link ().color (),width = 4 ,
173+ style = Qt .SolidLine ,capStyle = Qt .RoundCap
174+ )
175+
168176self ._line = InteractiveInfiniteLine (
169177angle = 90 ,pos = x ,movable = True ,
170178bounds = self .selection_limit if self .selection_limit is not None
171- else (self .x .min (),self .x .max ())
179+ else (self .x .min (),self .x .max ()),
180+ normal_pen = normal_pen ,
181+ highlight_pen = highlight_pen
172182 )
173183self ._line .setCursor (Qt .SizeHorCursor )
174-
175- # Create normal and highlight pens
176- normal_pen = mkPen (self .palette ().text ().color (),width = 4 ,style = Qt .SolidLine ,capStyle = Qt .RoundCap )
177- highlight_color = self .palette ().highlight ().color ()
178- highlight_color .setHsv (
179- highlight_color .hue (),
180- min (highlight_color .saturation ()+ 30 ,255 ),
181- max (highlight_color .value ()- 20 ,0 )
182- )
183- highlight_pen = mkPen (highlight_color ,width = 10 ,style = Qt .SolidLine ,capStyle = Qt .RoundCap )
184-
185- # Set pens directly
186- self ._line ._normal_pen = normal_pen
187- self ._line ._highlight_pen = highlight_pen
188- self ._line .setPen (normal_pen )
189184self ._line .sigPositionChanged .connect (self ._on_cut_changed )
190185self .addItem (self ._line )
191186else :
192187self ._line .setValue (x )
193188
194189self ._update_horizontal_lines ()
195190
196-
197-
198191def _plot_horizontal_lines (self ):
199192"""
200193 Function plots the vertical dashed lines that points to the selected