@@ -433,8 +433,6 @@ def make_region_callback(region_obj, channel_items, window_index=0):
433433 )
434434 self .flat_sweep_index_start = curve_array .start_index
435435 self .flat_sweep_index_end = curve_array .end_index
436- print ("here" )
437- print (self .params .alpha )
438436 color = utils .color_picker_qcolor (
439437 length = 1 ,
440438 index = 0 ,
@@ -548,9 +546,23 @@ def update_theme(self, theme: str, **kwargs) -> None:
548546 )
549547
550548 def sweep_highlight (
551- self , sweep_index : int | None = None , color = "red" , alpha = 0.4 , width = 2
549+ self , sweep_index : int | None = None , color = "red" , alpha = 1 , width = 2
552550 ) -> None :
553551 highlight_exists = False
552+ if self .params .alpha != 0.1 :
553+ for plot_item in self .win .items ():
554+ if isinstance (plot_item , pg .PlotItem ):
555+ item_list = plot_item .listDataItems ()
556+ for i , curve in enumerate (item_list ):
557+ if curve .opts ["pen" ].color ().alphaF () != 0.1 :
558+ curve .setPen (
559+ color = utils .color_picker_qcolor (
560+ length = len (item_list ),
561+ index = i ,
562+ alpha = 0.1 ,
563+ color = self .params .color ,
564+ )
565+ )
554566 for item in self .win .items ():
555567 if isinstance (item , pg .PlotItem ):
556568 item_list = item .items
@@ -580,6 +592,20 @@ def sweep_highlight(
580592 )
581593 if new_highlight is not None :
582594 item .addItem (new_highlight )
595+ highlight_exists = True
596+ if not highlight_exists :
597+ for plot_item in self .win .items ():
598+ if isinstance (plot_item , pg .PlotItem ):
599+ item_list = plot_item .listDataItems ()
600+ for i , curve in enumerate (item_list ):
601+ curve .setPen (
602+ color = utils .color_picker_qcolor (
603+ length = len (item_list ),
604+ index = i ,
605+ alpha = self .params .alpha ,
606+ color = self .params .color ,
607+ )
608+ )
583609
584610 def show (self ) -> None :
585611 """Show the plot window."""
0 commit comments