View Single Post
Old 09-20-2020, 05:36 PM   #18
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,488
Karma: 8065348
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by JimmXinu View Post
Can I have a hint on how I'd get device manager/info in a custom template function? The only way I know now is self.gui.device_manager in a plugin.
You can do the same thing in a custom template function. Example:
Code:
def evaluate(self, formatter, kwargs, mi, locals):
	from calibre.gui2.ui import get_gui
	info = get_gui().device_manager.get_current_device_information()
	v = ''
	if info is not None:
		print(info)
		v = "yes"
	return v
Does this answer your question?
chaley is offline   Reply With Quote