View Single Post
Old Yesterday, 02:57 AM   #1540
capink
Wizard
capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.
 
Posts: 1,207
Karma: 1995558
Join Date: Aug 2015
Device: Kindle
Quote:
Originally Posted by chaley View Post
FWIW: I'm currently implementing these changes to the base formatter.

Thanks chaley, this is going to make it easier and more elegant, and will render some of the functions I've made like selection_count() and from_selection('id') unnecessary, but I will keep them for backward compatibility.

For those interested, once chaley submits his changes, selection_count() can be replaced by a native calibre function as follows:

Code:
list_count(selected_books(), ',')
And instead of using from_selection('id') you can use selected_books(). from_selection() can be still used with other columns and can be useful in formulas action.


Quote:
Originally Posted by un_pogaz View Post
self.chain_selected_ids = self.gui.current_view().get_selected_ids()
This call can be very expensive if the user have a lot of books selected. I already had a similar call in earlier iterations of the plugin (to provide the selection_count as a variable) and had to scrap it because it can slow down chains that does not benefit from it. So this is a non starter for me. I've already tried that path and came out with the conclusion that the call has to be made explicitly by the user only in the chains the might need it, like the solution I linked to in an earlier post. That is also I why I wrote the on-demand selection_count() function instead of providing a chain variable that might not be needed in most of the chains.

As for the rest of the implementation, it can be done in a custom action to avoid cluttering the interface of the plugin with another column. I don't think it provides a better solution to what we already can do in the "Search Using Templates" action, especially with the changes chaley made.

Last edited by capink; Yesterday at 03:11 AM.
capink is offline   Reply With Quote