It looks like you're new here. If you want to get involved, click one of these buttons!
It looks like LayoutView.on_selection_changed
callback is not called when selection changed from some objects to none of them. I'd like to perform some action (like window hiding) is such scenario.
Comments
Hi Eugene,
thanks for reporting this. I'll verify that and create a ticket if necessary. I recall I have seen this issue myself, but I'm not sure. Maybe it's already fixed in master.
Matthias
Hi, Matthias!
I tried 0.26.9 and I was not correct in original problem description.
LayoutView.on_selection_changed
is called when object(s) is/are unselected, butLayoutView.has_object_selection
is stillTrue
Test code:
@EugeneZelenko thanks a lot for the code!
The problem still persists on master. As a workaround I'd suggest to check for "view.each_object_selected().size == 0". But of course "has_object_selection" should work.
I have created a ticket for this: https://github.com/KLayout/klayout/issues/703
I hope it's easy to fix.
Thanks,
Matthias
Hi, Matthias!
Thank you for help!
As workaround I use early return from
current_view.each_object_selected()
loop inon_selection_changed
handler when object is selected, and code handling no objects selected situation is located after loop.Eugene.