Nano re-pairing is not possible and add a Quit Solaar button to also close tray icon
Created by: KenH2000
The following code added to window.py will correct the issues
- If you only want to make a quick change to a device and not use the tray icon, you have to close the window, and then also close tray icon to exit the program. A simple fix, is to add a 'Quit Solaar' button to the window.py source. Edit ~/.local/lib/python3.6/site-packages/solaar/ui/window.py, after line 312 add:
#existing code...
bottom_buttons_box.add(about_button)
#new code...
close_button = _new_button(_("Quit") + ' ' + NAME, icon_size=_SMALL_BUTTON_ICON_SIZE, clicked=_justclose)
bottom_buttons_box.add(close_button)
and add the function (also in window.py), which will close both the window and tray icon:
#new code...
def _justclose(self):
import sys
sys.exit()
Optional: if you want space between the About and Quit buttons, edit line 310 to add spacing:
#existing code(comment out)...
#bottom_buttons_box = Gtk.ButtonBox(Gtk.Orientation.HORIZONTAL)
#new code to add button spacing...
bottom_buttons_box = Gtk.ButtonBox(Gtk.Orientation.HORIZONTAL,spacing=6)
- If you pair a Nano device to another receiver, you can not re-pair it back to the original Nano receiver because the 'Pair new device' button is disabled, and cannot be re-enabled by unpairing the original device (unpairing always fails on Nano device). To resolve this issue, force the button visible if the receiver name detected is a 'Nano' device. Edit the window.py source, and edit the function, def _update_receiver_panel(...), after line 598 add the following:
#existing code...
may_pair &= len(paired_devices) < receiver.max_devices
#new code...
if "Nano" in receiver.name:
may_pair=True
#existing code....
buttons._pair.set_sensitive(may_pair)
buttons._pair.set_visible(True)