@@ -71,9 +71,11 @@ def __init__(self, **kwargs):
7171 self .bt_menu_label = self .buttons .bluetooth_menu_label
7272
7373 self .client = BluetoothClient (on_device_added = self .on_device_added )
74+ self .scan_label = Label (name = "bluetooth-scan-label" , markup = icons .radar )
7475 self .scan_button = Button (
7576 name = "bluetooth-scan" ,
76- label = "Scan" ,
77+ child = self .scan_label ,
78+ tooltip_text = "Scan for Bluetooth devices" ,
7779 on_clicked = lambda * _ : self .client .toggle_scan ()
7880 )
7981 self .back_button = Button (
@@ -85,7 +87,7 @@ def __init__(self, **kwargs):
8587 self .client .connect ("notify::enabled" , lambda * _ : self .status_label ())
8688 self .client .connect (
8789 "notify::scanning" ,
88- lambda * _ : self .scan_button . set_label ( "Stop" if self . client . scanning else "Scan" )
90+ lambda * _ : self .update_scan_label ( )
8991 )
9092
9193 self .paired_box = Box (spacing = 2 , orientation = "vertical" )
@@ -138,3 +140,13 @@ def on_device_added(self, client: BluetoothClient, address: str):
138140 if device .paired :
139141 return self .paired_box .add (slot )
140142 return self .available_box .add (slot )
143+
144+ def update_scan_label (self ):
145+ if self .client .scanning :
146+ self .scan_label .add_style_class ("scanning" )
147+ self .scan_button .add_style_class ("scanning" )
148+ self .scan_button .set_tooltip_text ("Stop scanning for Bluetooth devices" )
149+ else :
150+ self .scan_label .remove_style_class ("scanning" )
151+ self .scan_button .remove_style_class ("scanning" )
152+ self .scan_button .set_tooltip_text ("Scan for Bluetooth devices" )
0 commit comments