|
|
#1 |
|
null operator (he/him)
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 22,033
Karma: 30277294
Join Date: Mar 2012
Location: Sydney Australia
Device: none
|
Template Request: Has Conversion Settings
AFAIK there is no easy way to know if specific conversion settings have been applied to a book. The Conversion dialogue has a Restore Defaults button, but it's enabled irrespective of whether book specific conversion settings actually exist.
So I'm requesting a template function similar to has_cover that can be used to define a virtual column, set a column colour/icon etc. BR |
|
|
|
|
|
#2 | |
|
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,525
Karma: 8065948
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
EDIT: Code:
python: def evaluate(book, context): ans = context.db.new_api.has_conversion_options((book.id,)) return 'Yes' if ans else '' The underlying function has a parameter for the format that as far as I can tell isn't used. Last edited by chaley; 03-06-2023 at 06:12 PM. Reason: Made the function more "template like" by returning the empty string if False |
|
|
|
|
| Advert | |
|
|
|
|
#3 |
|
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,525
Karma: 8065948
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
If you prefer a custom template function instead of a stored template, this does the job. Use Preferences / Template functions / the Template Functions tab.
The function code: Code:
def evaluate(self, formatter, kwargs, mi, locals,): from calibre.gui2.ui import get_gui db = get_gui().library_view.model().db ans = db.new_api.has_conversion_options((mi.id,)) return 'Yes' if ans else '' |
|
|
|
|
|
#4 |
|
null operator (he/him)
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 22,033
Karma: 30277294
Join Date: Mar 2012
Location: Sydney Australia
Device: none
|
Thanks chaley - I'm lizard until the weekend, I'll probably go the custom template route.
BR |
|
|
|
|
|
#5 |
|
null operator (he/him)
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 22,033
Karma: 30277294
Join Date: Mar 2012
Location: Sydney Australia
Device: none
|
|
|
|
|
| Advert | |
|
|
![]() |
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Request for opinion: a template while loop | chaley | Library Management | 15 | 05-13-2022 12:34 PM |
| The footer template (cover generation settings) | jmendes | Related Tools | 2 | 05-02-2021 09:40 AM |
| Request for comments: new template language operations | chaley | Library Management | 3 | 02-27-2021 01:09 PM |
| Multiple conversion settings feature request | Thasaidon | Conversion | 2 | 12-14-2011 05:02 PM |
| Request for Feedback on E-book Web Template | andreasw | Writers' Corner | 5 | 05-14-2011 01:34 AM |