View Single Post
Old 03-25-2021, 01:28 PM   #430
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,130
Karma: 1954142
Join Date: Aug 2015
Device: Kindle
Event: Book List Double Clicked

The plugin offers a builtin event called "Book List Double Clicked". Using this event, you can either replace calibre default action when double clicking on books with your own chain(s), or you can use your chain(s) to supplement calibre default action. If you want to completely replace calibre's default action with your chain(s), you have to edit the following tweak first to disable the default calibre action when double clicking (calibre preferences > tweaks):

Code:
doubleclick_on_library_view = 'do_nothing'
However, editing the above tweak has the side effect of disabling editing a field using a single click. If you want to keep the ability to edit a field using single click after adding the above tweak, actions chains gives you this option, by adding another tweak (calibre preferences > tweaks > plugin tweaks):

Code:
action_chains_single_click_edit = True
Quote:
Note: Book List Double Clicked event passes a couple of arguments that are stored as a chain variable called _event_args. The two arguments passed are the book_id, and column name.

Note: If the book is double clicked in the Cover Grid, the value for column_name will be an empty string.

You can use this to make a chain that take different courses depending the cell you double clicked. For example; open the book in the viewer when the user clicks on the title, and open the tag editor using this custom action if the user clicks a tag like cell.

For the above to work, you have to set conditions on the actions in the chain, so that each action is only run when the appropriate cell is clicked. Here is an example of a condition that will make the action run only if the a tag like cell is clicked:


Template:

Code:
program:
	clicked_column = list_item(globals(_event_args), 1, ',');
	tag_like = field_names('is_multiple:true,is_names:false');
	str_in_list(tag_like, ',', clicked_column, 'true', '')
Datatype: text
Comparison: =
Condition Value: true

Last edited by capink; 08-12-2021 at 04:30 AM.
capink is offline   Reply With Quote