Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Plugins

Notices

Reply
 
Thread Tools Search this Thread
Old 09-25-2021, 11:40 AM   #721
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,197
Karma: 1995558
Join Date: Aug 2015
Device: Kindle
So the issue here is that if a VL that does not have a tab is applied (either through Virtual Library dropdown menu or View Manager menu), calibre will create a new tab for this VL, and in the process it re-orders the open tabs, and emit the event signal for each tab (I don't know how this happens, but I can see it by inserting debug statements).

The solution to this is to ignore all the emitted signals except the last one. This solution will have the side effect of a little lag before applying the corresponding view.

Last edited by capink; 09-28-2021 at 09:47 AM. Reason: Remove attached zip. new version available in the first post.
capink is offline   Reply With Quote
Old 09-25-2021, 01:18 PM   #722
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,014
Karma: 75555555
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
That fixed it. Thank you. The lag is s lot faster than waiting for it to cycle through all my views.

Last edited by ownedbycats; 09-25-2021 at 02:57 PM.
ownedbycats is online now   Reply With Quote
Advert
Old 09-25-2021, 02:56 PM   #723
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,014
Karma: 75555555
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
Just curious: Am I misremembering, or was there an option to make a chain invisible in the menu if the conditions aren't verified?

Also: For my "switch VL" chain, is it possible to set a condition to do an action (clear marked books) unless I'm switching to the Cleanup VL? There's view_manager_last_view but I think that's for the currently selected view.

Last edited by ownedbycats; 09-25-2021 at 03:03 PM.
ownedbycats is online now   Reply With Quote
Old 09-25-2021, 04:55 PM   #724
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,197
Karma: 1995558
Join Date: Aug 2015
Device: Kindle
Quote:
Originally Posted by ownedbycats View Post
Just curious: Am I misremembering, or was there an option to make a chain invisible in the menu if the conditions aren't verified?
The option is in the conditions dialog, and it greys out the menu entry without making it invisible.

Quote:
Originally Posted by ownedbycats View Post
Also: For my "switch VL" chain, is it possible to set a condition to do an action (clear marked books) unless I'm switching to the Cleanup VL? There's view_manager_last_view but I think that's for the currently selected view.
Action Chains events can pass arguments to their member chains. In case of the "VL Tab Changed" event it has only one argument, the vl tab name, which can be accessed and used in conditions:

Code:
program:
    vl = globals(_event_args)
Attached below is a chain, that if added to an event, will print the event arguments to the terminal (you can use it for debugging and exploration of event arguments)
Attached Files
File Type: zip print_event_data.zip (470 Bytes, 291 views)

Last edited by capink; 09-25-2021 at 06:14 PM.
capink is offline   Reply With Quote
Old 09-26-2021, 09:04 AM   #725
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,014
Karma: 75555555
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
Thanks. It worked. I also added a second condition so it didn't clear when switching away from Cleanup:

Code:
program:
    vl = globals(_event_args) != 'Cleanup' && view_manager_last_view() != 'Cleanup'
However, the last_view part isn't quite working. Any ideas?

EDIT: I think the && should be an or. Need to figure that out.

EDIT:

Code:
program:
    vl = globals(_event_args) != 'Cleanup' || view_manager_last_view() != 'Cleanup'
= 1
clears it for everything. I'm not sure what I did wrong.

Last edited by ownedbycats; 09-26-2021 at 09:22 AM.
ownedbycats is online now   Reply With Quote
Advert
Old 09-26-2021, 09:15 AM   #726
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,197
Karma: 1995558
Join Date: Aug 2015
Device: Kindle
You need to remove the assignment:

Code:
program:
    globals(_event_args) != 'Cleanup' && view_manager_last_view() != 'Cleanup'
If you want to keep the assignment for readability:

Code:
program:
    vl = globals(_event_args);
    vl != 'Cleanup' && view_manager_last_view() != 'Cleanup'

Last edited by capink; 09-26-2021 at 09:19 AM.
capink is offline   Reply With Quote
Old 09-26-2021, 09:25 AM   #727
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,014
Karma: 75555555
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
I think I figured out the issue. I don't actually have a view named Cleanup, since it's just whatever view I was using last. Would virtual_libraries() work, or is that for just books?

Last edited by ownedbycats; 09-26-2021 at 09:32 AM.
ownedbycats is online now   Reply With Quote
Old 09-26-2021, 10:42 AM   #728
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,449
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by ownedbycats View Post
I think I figured out the issue. I don't actually have a view named Cleanup, since it's just whatever view I was using last. Would virtual_libraries() work, or is that for just books?
The virtual_libraries() function returns a list of virtual libraries. It knows nothing about View Manager views.
chaley is offline   Reply With Quote
Old 09-27-2021, 10:35 AM   #729
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,014
Karma: 75555555
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
I'll take a look at the event chain later and see if there's something I can use. Is there a way to bring up the terminal when running outside debug?
ownedbycats is online now   Reply With Quote
Old 09-27-2021, 12:46 PM   #730
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,197
Karma: 1995558
Join Date: Aug 2015
Device: Kindle
Not that I know of.
capink is offline   Reply With Quote
Old 09-28-2021, 10:18 AM   #731
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,197
Karma: 1995558
Join Date: Aug 2015
Device: Kindle
Version 1.13.1
  • Fix: Vl Tab Changed Event: Signal vl_tab_changed is emitted multiple times when a new tab is added.

Version 1.13.2
  • Update: Vl Tab Changed Event: Add option to turn off event if vl tabs are hidden.
  • Update: Vl Tab Changed Event: Add additional event argument: last_vl.
  • Fix: Timer Event: Fix timer interval settings not read properly.

There is a modification to the event arguments of the "VL Tab Changed" event as it adds a second argument (previous_vl). You can access the event arguments as follows:

Code:
program:
    args = globals(_event_args);
    current_vl = list_item(args, 0, ',');
    previous_vl = list_item(args, 1, ',')
capink is offline   Reply With Quote
Old 09-28-2021, 04:16 PM   #732
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,014
Karma: 75555555
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
Is 'current' the one being switched to? Just checking.
ownedbycats is online now   Reply With Quote
Old 09-28-2021, 04:24 PM   #733
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,197
Karma: 1995558
Join Date: Aug 2015
Device: Kindle
Quote:
Originally Posted by ownedbycats View Post
Is 'current' the one being switched to? Just checking.
Yes it is.
capink is offline   Reply With Quote
Old 09-30-2021, 06:51 PM   #734
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,014
Karma: 75555555
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
Just curious:

Code:
program:
	marked = from_search('id', 'marked:true');
	count(marked, ',')
When putting it in Action Chain's condition dialog, I get a "5" for each selected book under template value, regardless of how many books are actually marked. As it works correctly when running the chain, where is it getting the 5 from?
Attached Thumbnails
Click image for larger version

Name:	2021-09-30 19_52_19-Evaluate Condition.png
Views:	375
Size:	29.8 KB
ID:	189456  
ownedbycats is online now   Reply With Quote
Old 09-30-2021, 07:03 PM   #735
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,197
Karma: 1995558
Join Date: Aug 2015
Device: Kindle
This is explained in the Formulas Action documentation, of which the function from_search() is part.

To summarize; from_search() pulls data from multiple books, so it can potentially take up several minutes depending on the size of library and nature of the query. While in template dialog, you cannot allow this to happen, because the template gets re-evaluated with every letter typed, so it can completely freeze the dialog.

As a solution to the above, when in template dialog, from_search() always returns a fixed list of five items (e.g. '1,2,3,4,5') no matter the query being given to it.

Edit: Even though it returns a fixed list, it still verifies the arguments (field_name and search_string), and will return an error if it finds a problem with either.

Edit2: The items of the list and the separator are changed based on the field_name.

Last edited by capink; 09-30-2021 at 07:42 PM.
capink is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[Editor Plugin] Editor Chains capink Plugins 106 06-17-2025 05:36 PM
Action Chains Resources capink Plugins 77 06-16-2025 12:45 PM
[GUI Plugin] Noosfere_util, a companion plugin to noosfere DB lrpirlet Plugins 2 08-18-2022 03:15 PM
[GUI Plugin] Save Virtual Libraries To Column (GUI) chaley Plugins 14 04-04-2021 05:25 AM


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


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