Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Library Management

Notices

Reply
 
Thread Tools Search this Thread
Old 03-06-2023, 04:17 PM   #1
BetterRed
null operator (he/him)
BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.
 
Posts: 21,701
Karma: 29711016
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
BetterRed is offline   Reply With Quote
Old 03-06-2023, 05:07 PM   #2
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 12,410
Karma: 8012664
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by BetterRed View Post
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
Here is a python template that answers your question, at least for my tests. If you make a stored template with this code you can call it in a "normal" template like a function, as in 'has_opts = stored_template()'.
EDIT:
Code:
python:
def evaluate(book, context):
	ans = context.db.new_api.has_conversion_options((book.id,))
	return 'Yes' if ans else ''
EDIT: It returns "Yes" if the book has settings, '' otherwise.

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 05:12 PM. Reason: Made the function more "template like" by returning the empty string if False
chaley is offline   Reply With Quote
Advert
Old 03-07-2023, 05:27 AM   #3
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 12,410
Karma: 8012664
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.

Click image for larger version

Name:	Clipboard01.jpg
Views:	76
Size:	99.9 KB
ID:	200176

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 ''
chaley is offline   Reply With Quote
Old 03-07-2023, 03:51 PM   #4
BetterRed
null operator (he/him)
BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.
 
Posts: 21,701
Karma: 29711016
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
BetterRed is offline   Reply With Quote
Old 03-12-2023, 06:24 AM   #5
BetterRed
null operator (he/him)
BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.
 
Posts: 21,701
Karma: 29711016
Join Date: Mar 2012
Location: Sydney Australia
Device: none
Quote:
Originally Posted by BetterRed View Post
Thanks chaley - I'm lizard until the weekend, I'll probably go the custom template route.

BR
All good

BR
BetterRed is offline   Reply With Quote
Advert
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Request for opinion: a template while loop chaley Library Management 15 05-13-2022 11:34 AM
The footer template (cover generation settings) jmendes Related Tools 2 05-02-2021 08:40 AM
Request for comments: new template language operations chaley Library Management 3 02-27-2021 12:09 PM
Multiple conversion settings feature request Thasaidon Conversion 2 12-14-2011 04:02 PM
Request for Feedback on E-book Web Template andreasw Writers' Corner 5 05-14-2011 12:34 AM


All times are GMT -4. The time now is 06:11 PM.


MobileRead.com is a privately owned, operated and funded community.