Add/Remove to/from a UserCat and Column Icons

Bug #1675535 reported by Better Red on 2017-03-23
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Charles Haley

Bug Description

1. I use this template in a Column Icon on the Authors column.

       uc = user_categories();
       str_in_list(uc,',','Favorite Authors','golden_star.png','transparent_square.png')

2. I go into Manage User Categories and Add an Author to the Favorite Authors User Category.

3. The Author name now appears in the Favorite Authors UC list in the Tag Browser.

4. But the column icon is NOT updated, I have to edit a cell (any cell) to force the Book row to refresh.

5. Same with Remove from a UC, the tag browser is updated, but any associated icon persists. Again I have to edit a cell to force the book row to refresh to get rid of the icon.

Aside : this is the behaviour I was trying to understand when I lost sight of the Add and Replace Rule buttons in Look and Feel->Column Icons the other day on a $3.2K Dell XPS-15 with a 4K monitor :lol:

Changing the component for this bug.

 assignee cbhaley
 status triaged

Changed in calibre:
assignee: nobody → Charles Haley (cbhaley)
status: New → Triaged
Charles Haley (cbhaley) wrote :

This is a problem similar to the virtual libraries one you mentioned earlier where a "structural" change must be reflected in the book list even though no books have changed. The only way to do that is to force a full refresh of the book list whenever the user categories change. This could be slow, but that is probably OK because it doesn't happen that often and the user knows that they did something.

Fix pushed.

Changed in calibre:
status: Triaged → Fix Committed

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

 status fixreleased

Changed in calibre:
status: Fix Committed → Fix Released
Better Red (urbanetiger) wrote :

Thanks both

Apart from using a metadata edit function (dialogue box or F2) but not actually changing anything, is there any other way to force a refresh of an individual book line in the list. Something to use if a full refresh of the list is 'unbearably' slow, or perhaps if this change doesn't work if the UC is updated via the UC optional plugin. I appreciate the latter wouldn't be your problem.

IMO a 'refresh book line' keyboard shortcut would be adequate.

Better Red (urbanetiger) wrote :

Forget prior post

Refreshing a single book line is not enough, all books affected by the add/removal of a column to a user category will need to be refreshed.

But what if a user doesn't have anything in the book list (like an icon, colour, or a list of user categories) to indicate a book is 'in' a user category, will they suffer the performance hit when the book list is refreshed after they use Manage User Categories?

Maybe it would be better to have a 'refresh book **list**" tool. Users who have something in the book list relating to user categories can use it as and when they want. Users who don't, wouldn't suffer 'meaningless' performance penalties when they added/removed things to a user category. And it would also take the User Category optional plugin out of this 'equation'.

Kovid Goyal (kovid) wrote :

I'm ok with the performance hit on user category change -- it is important that the book list show correct information and it is only noticeable for very large libraries.

Charles Haley (cbhaley) wrote :

I agree with Kovid -- the library should show correct information. Moving the job to a user-choice function will not fix it because a) most users won't know it is there, b) they won't know that they need to use it, and c) will complain if they know a and b.

I admit that I haven't figured out how to make virtual_libraries() refresh when needed because of structural changes, but I am still thinking about it. This is a much harder problem than user categories because of the range of changes that can affect a list of VLs.

As for the plugin, I have never looked at that plugin and don't want to take ownership of it. I don't know what it does. Whether it does the refresh depends on whether it uses the supplied APIs. If it does then the refresh will happen. If it does not then a refresh depends on what it does to refresh the UC lists in the tag browser.

Better Red (urbanetiger) wrote :

FYI - Unfortunately this doesn't work if the User Category is updated via the User Category plugin. I had a gut feeling it wouldn't. Not your fault, as you know this isn't the only problem with this PI.

So after adding/removing something to/from a User Category via the plugin we'll continue using the false edit of a cell to get the icons updated. It's a small price to pay for the convenience of using the plugin (via the book list context menu) to add/remove values to User Categories.

Charles Haley (cbhaley) wrote :

You can refresh all the rows at once by running "Manage User Categories", making no changes, then pressing OK. If you assign a shortcut to "Alter Tag Browser" then you can get to manage user categories without using the mouse.

Better Red (urbanetiger) wrote :

It's not just the mouse, you end up in a dialogue box, and all that entails. The PI allows you to pre-configure its flyouts so you only see the options and columns you ordinarily use. So, press menu key and arrow buttons to do what you want, then F2 and Enter to refresh the list.

F2 then Enter not only refreshes the row you do it in, it refreshes all the rows you can see, at least. This was a bit of a surprise when I first did it, I expected it to just refresh the current row. So if you add the author of the book in row 123 to favourites with the PI, and the books in rows 120 and 126 are by the same author, then after pressing F2 and Enter in row 123 the favourites icon appears on all three books - which in my book is pretty cool :)

Such a shame Grant Drake is no longer around to iron out these wrinkles in his plugins.

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

Other bug subscribers