From dc59c79bd3ba15800ec48f0f99519f1792631f65 Mon Sep 17 00:00:00 2001 From: Daniel Pavel Date: Sun, 23 Jun 2013 18:35:23 +0200 Subject: [PATCH] properly handle tree re-selection when removing a receiver --- lib/solaar/ui/window.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/solaar/ui/window.py b/lib/solaar/ui/window.py index 72f917d5..1ac30118 100644 --- a/lib/solaar/ui/window.py +++ b/lib/solaar/ui/window.py @@ -356,7 +356,16 @@ def _find_selected_device_id(): def _device_selected(selection): model, item = selection.get_selected() device = model.get_value(item, _COLUMN.DEVICE) if item else None - _update_info_panel(device, full=True) + # if _log.isEnabledFor(_DEBUG): + # _log.debug("window tree selected device %s", device) + if device: + _update_info_panel(device, full=True) + else: + # When removing a receiver, one of its children may get automatically selected + # before the tree had time to remove them as well. + # Rather than chase around for another device to select, just clear the selection. + _tree.get_selection().unselect_all() + _update_info_panel(None, full=True) def _receiver_row(receiver_path, receiver=None):