ch-sa/labelCloud

Can't edit with shortcuts after selection change

Divelix opened this issue · 5 comments

Describe the bug
I found out that if you change selection, shortcuts stop working (they work only for latest created bbox).

To Reproduce
Steps to reproduce the behavior (one cloud):

  1. Click "Pick Pounding Box" and place first bbox somewhere
  2. Edit it anyhow (shortcuts work fine)
  3. Click "Pick Pounding Box" and place second bbox somewhere
  4. Edit it anyhow (shortcuts work fine)
  5. In right side menu select first bbox
  6. Try to edit with shortcuts (shortcuts are broken now)

OR (multiple clouds):

  1. Click "Pick Pounding Box" and place first bbox somewhere
  2. Edit it anyhow (shortcuts work fine)
  3. Click "Next" and repeat 1, 2 for bbox on second cloud
  4. Click "Previous"
  5. Click on your bbox in right pane
  6. Try to edit with shortcuts (shortcuts are broken)

Expected behavior
I want to be able to edit my old bboxes with shortcuts (not just last one).

Desktop (please complete the following information):

  • OS: Ubuntu 20.04.5 LTS
  • Python Version: 3.8.10
  • Installation: pip
ch-sa commented

Hi @Divelix,

thanks for reporting.

Is it really for all shortcuts or specific one?

I am not in reach of my dev machine this week, so can debug earliest next week.

@chingyulin Do you have to time for a quick look/ debug?

W, A, S, D, X, Y, Q, E, C, V, B, N don't work for sure.

Hi @Divelix,

I was able to reproduce the problem. It seems the event object is on label_list by default. The fix seems to be more involved due to the way we handle key press events. For now, a quick workaround is to press Tab to shift the focus when the shortcut is not working. Could you check if this workaround works for you?

Hi, @chingyulin,

Your workaround with Tab works fine for me, thank you!

ch-sa commented

Hi @Divelix,

the event filter that handles the keyboard shortcuts is currently still a bit hacky.

This is why a focus of the label list has the effect that keyboard events are not considered by the event filter as they have the wrong "origin".

I added the label list to the origins that should be considered and it should work now with branch: ch-sa/fix-event-focus.

@chingyulin thanks for the temporary solution, I added the PR for you to review.