View Single Post
Old 10-22-2022, 06:27 PM   #16
ownedbycats
Custom User Title
ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.
 
ownedbycats's Avatar
 
Posts: 11,170
Karma: 77304081
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
Quote:
Originally Posted by chaley View Post
Assuming you use a composite column (column built from other columns) that behaves like tags, they are clickable without using the PI. Are you seeing something different?

And just for fun I made a composite column that lets you switch VLs by clicking the links in book details. The GPM template is:
Code:
program:
	res = '';
	for vl in virtual_libraries():
		if res then res = res & '<br>' fi;
		res = res & '<a href="calibre://search/_?encoded_virtual_library=' & to_hex(vl) & '">' & vl & '</a>'
	rof;
	res
The column definition is:
Attachment 197304

What you see is:
Attachment 197303

And for more fun, here is the template using python template mode (PTM), which will be much faster than the GPM template above:
Code:
python:
def evaluate(book, ctx):
	db = ctx.db.new_api
	return ('<br>'.join(
		[f'<a href="calibre://search/_?encoded_virtual_library={vl.encode().hex()}">{vl}</a>' 
		 for vl in db.virtual_libraries_for_books((book.id,))[book.id]
		]))
EDIT: corrections to the column setup and the python template
I don't know what I was expecting to happen when I left the 'show in tag browser' option enabled, lol.
Attached Thumbnails
Click image for larger version

Name:	2022-10-22 19_26_24-Window.png
Views:	45
Size:	1.9 KB
ID:	197316  
ownedbycats is offline   Reply With Quote