Tab between book list cells is broken

Bug #2092643 reported by Better Red
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
calibre
Fix Released
Undecided
Unassigned
Revision history for this message
Kovid Goyal (kovid) wrote :

Does not reproduce for me, steps I tried on my Windows machine:

1) Click on book #8 inthe book list
2) Press F2 to edit the title field
3) Press Tab repeatedly
4) The field being edited changes as expected to authors,date,rating,etc.

Is there is a specific field which is causing the issue?

Changed in calibre:
status: New → Incomplete
Revision history for this message
Better Red (urbanetiger) wrote :

No, when I tabbed out of the Title cell into the Author cell for the Line 11 book, the Book details panel for the Line 1 book was displayed… but the Author cell for the Line 11 book was the active cell.

I'm wondering if the View Manager plugin is at play here… I'll eliminate it and get back to you.

Revision history for this message
Better Red (urbanetiger) wrote (last edit ):

Nope not a plugin issue.

I created a fresh Portable V7.23 install, and Added 10 Empty Books. The problem occurs when changing a second (third, fourth etc) book via Book list cell edit.

In the screen shot you can see I changed Line 3 Title and Author - that went okay. I then F2'd on line 4 Title, changed it and Tabbed into the Authors cell - that's when the line 1 book details was displayed even though the cell under edit is line 4 Author.

It's weird if I press Enter after editing the line 4 Author the Line 4 book details is shown. But it's definitely a second go around issue. Hopefully I've given you enough info to reproduce. Let me know if not.

Revision history for this message
cmfy (cmfy) wrote :

I can reproduce, (line 1 book is displayed in Book Details panel when tabbing on line 13).
It seems related to the type of column being tabbed to. One of them is comma separated text; other is a composite using {author_sort}

Kovid Goyal (kovid)
Changed in calibre:
status: Incomplete → New
Revision history for this message
Charles Haley (cbhaley-deactivatedaccount) wrote (last edit ):

I can reproduce this consistently on Windows 11 with current source.

Steps:
1) Open calibre. The first row is selected. First col: title. Second col: authors.
2) Press down-arrow twice to select the third row.
3) Press F2. The title editor is opened.
4) Press right arrow to remove the selection. This signals a change so model.set_data() is called
5) Press Tab. Title is closed, authors is edited.
6) Press ESC to close the editor

At this point everything is still OK. The correct book is displayed in book details.

7) Press left arrow to go to the title, still on line 3.
8) Press F2 to edit the title.
9) Press right arrow to remove the selection.
10) Press Tab to move the editor to authors.

At this point book details shows the first row book, but authors on the third book is being edited.

Tracing it, it seems that the "extra" editor being opened (see views.closeEditor()) is changing the current index to the first row. When the correct editor is later opened, new_bookdisplay_data isn't emitted, perhaps because something doesn't realize the current row was previously changed. The signal chain is long and complicated.

The following change to edit() at line 1657 in views.py fixes it by telling book details to show the "real" current book. Unfortunately I don't know what side effects it might have. I haven't seen any.

                def edit():
                    self.setCurrentIndex(index)
                    self.edit(index)
                    self._model.current_changed(index, None) # added

@kovid, let me know if I can run tests for you.

Revision history for this message
Kovid Goyal (kovid) wrote :

Fixed in branch master. The fix will be in the next release. calibre is usually released every alternate Friday.

Changed in calibre:
status: New → Fix Released
Revision history for this message
Kovid Goyal (kovid) wrote :

@charles: I dont see too much of an issue with forcing the signal to be
emitted again after the event loop tick. The worst that can happen is
book details data is loaded twice, which is not too bad.

Revision history for this message
Charles Haley (cbhaley-deactivatedaccount) wrote :

I submitted a PR with a better fix.

The fix in #5 can fail if the tab key is pressed rapidly more than once, possibly leading to opening some random editor such as comments or composites.

Revision history for this message
Better Red (urbanetiger) wrote :

_"…possibly leading to opening some random editor such as comments…"_

Good to know I probably didn't imagine it :)

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.