|
|
#1 | |
|
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,525
Karma: 8065948
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Custom tooltips in the book list view
One can use templates to define "custom tooltips" for columns in the book list. The tooltip can contain whatever you want as long as it can be generated by a template. Tooltips interpret HTML so you can construct complex displays. One test I did was to include in the tooltip the note for the value where the note contained a picture.
If you change the tooltip for "title" then the changed tooltip is used in the cover grid as well. To define a column tooltip, right-click on the column header and choose "(Define|Edit) column tooltip ...". It is also available as a calibre action, which means it is in the All Actions menu, can be given a shortcut, and can be added to context menus, favorites, action chains, etc. You can include the text that would have been used for the tooltip. See the help text when you first create a column tooltip template: Quote:
Last edited by chaley; 09-27-2025 at 05:50 AM. |
|
|
|
|
|
|
#2 |
|
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,525
Karma: 8065948
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
This feature has a small bug in calibre 8.10.0 where the first time one defines a custom tooltip for a column, calibre must be restarted to "see" it. Subsequence edits of the tooltip for that column don't require the restart. The fix is in calibre 8.11.
Here is a basic example of using a custom tooltip: presenting a list of genres in a more readable fashion. The standard tooltip looks like this. There are multiple genres per line with some of them broken across lines. If I use this template to generate the tooltip Code:
program: res = 'Genres:'; vals = list_sort($#genre, 0, ','); for t in vals: res = res & '<br>' & t rof; res And yes, the genres don't make a lot of sense.
Last edited by chaley; 09-27-2025 at 05:51 AM. |
|
|
|
|
|
#3 |
|
want to learn what I want
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,686
Karma: 7908443
Join Date: Sep 2020
Device: none
|
I did a quick test with the Title column tooltip, in cover grid view.
It worked great with my Count Pages column {#pp} (default is #pages), thanks! |
|
|
|
|
|
#4 |
|
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,525
Karma: 8065948
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
@Comfy.n: glad it works for you.
Another example: change the Series tooltip to show the number of books in the library with that series. Result: Template: Code:
program:
if $series then
series_count = book_count('series:"""=' & $series & '"""', 0);
return $series & ', book ' & $series_index & ' of ' & series_count
fi;
return 'This book is not in a series'
|
|
|
|
|
|
#5 |
|
Guru
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 924
Karma: 810834
Join Date: Sep 2017
Location: Buenos Aires, Argentina
Device: moon+ reader, kindle paperwhite
|
very good idea!!
|
|
|
|
|
|
#6 |
|
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,294
Karma: 1436993
Join Date: Dec 2016
Location: Goiânia - Brazil
Device: iPad, Kindle Paperwhite, Kindle Oasis
|
Cool! Now I can add other collaborators to my authors column.
|
|
|
|
|
|
#7 |
|
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,294
Karma: 1436993
Join Date: Dec 2016
Location: Goiânia - Brazil
Device: iPad, Kindle Paperwhite, Kindle Oasis
|
Hi @chaley
Just noticed something weird with the HTML parser. I added the translator info to the authors' tooltip using this template: Code:
program: if $#translator then tooltip = 'Autor: ' & $authors & '<br/>' & 'Tradutor: ' & $#translator else tooltip = 'Autor: ' & $authors fi; tooltip Here it is without the <br/>: Now, with the <br/>: Last edited by thiago.eec; 09-08-2025 at 08:22 AM. |
|
|
|
|
|
#8 | |
|
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,525
Karma: 8065948
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
|
|
|
|
|
|
|
#9 | |
|
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,294
Karma: 1436993
Join Date: Dec 2016
Location: Goiânia - Brazil
Device: iPad, Kindle Paperwhite, Kindle Oasis
|
Quote:
P.S: I did this using Python Mode. I could not find a way to interpret the authors field as list in the regular Template Mode. What am I missing? |
|
|
|
|
|
|
#10 | |
|
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,525
Karma: 8065948
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
Code:
program: res = 'Authors:'; for aut in "authors": res = res & '<br>' & aut rof; res Code:
program: res = 'Authors:'; for aut in $authors separator '&': res = res & '<br>' & aut rof; res |
|
|
|
|
|
|
#11 | |
|
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,294
Karma: 1436993
Join Date: Dec 2016
Location: Goiânia - Brazil
Device: iPad, Kindle Paperwhite, Kindle Oasis
|
Quote:
Code:
for aut in $authors: Thanks for your help! |
|
|
|
|
|
|
#12 |
|
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,525
Karma: 8065948
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Two changes:
Last edited by chaley; 09-09-2025 at 06:45 AM. Reason: Typo |
|
|
|
|
|
#13 |
|
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,525
Karma: 8065948
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Example: tooltip showing the note associated with a publisher
This template generates a tooltip showing the note for the publisher, if any. It also shows the count of books by that publisher and a link to search for the publisher in the current library.
Note: Links can be clicked only in the "dialog" version of the tooltip. If you want to be able to click links then I recommend you give that dialog a shortcut in Preferences / Shortcuts / Column tooltips / Show item tooltip in a dialog. You can also add "Column tooltips" to the tool bar, menu bar, or context menu. The template: Code:
program:
if ! $publisher then
# Nothing to do here
return 'No publisher'
fi;
# Generate the HTML for the tooltip. First, the name of the publisher.
tt = f_string("<div>Publisher: {$publisher}");
# Generate the search string used to get the publisher count and to do the search
search_for = f_string('publisher:"""={$publisher}"""');
# Add the publisher count to the HTML
tt = f_string("{tt}<br>Count of books published by {$publisher}: {book_count(search_for, 0)}");
# Add the calibre search link to the HTML
tt = f_string('{tt}<br><a href="calibre://search/_?eq={to_hex(search_for)}">' &
'Show books in this calibre library published by {$publisher}</a>');
# Add the note if it exists to the HTML
n = get_note("publisher", $publisher, "");
if n then
tt = f_string('{tt}<p><div>{n}</div></p>')
fi;
# Add the closing </div>
tt = f_string('{tt}</div>');
# Return the generated HTML
tt
Last edited by chaley; 09-26-2025 at 05:55 AM. Reason: Was released in calibre 6.11 |
|
|
|
![]() |
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Book List View on front page | Amalthia | PocketBook | 5 | 01-01-2024 04:37 AM |
| tooltips in the list of books | Fynjisx | Library Management | 1 | 11-23-2022 05:56 AM |
| Delete Dates from Book List View | Rellwood | Calibre | 6 | 04-01-2022 03:19 PM |
| Calibreserver issue using Book list mode/Custom list | fritskop | Server | 2 | 06-16-2020 02:20 PM |
| View list of custom column settings? | BookJunkieLI | Calibre | 8 | 07-25-2014 10:36 AM |