![]() |
#721 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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. |
![]() |
![]() |
![]() |
#722 |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 11,014
Karma: 75555555
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
That fixed it. Thank you.
![]() Last edited by ownedbycats; 09-25-2021 at 02:57 PM. |
![]() |
![]() |
Advert | |
|
![]() |
#723 |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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. |
![]() |
![]() |
![]() |
#724 | ||
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,197
Karma: 1995558
Join Date: Aug 2015
Device: Kindle
|
Quote:
Quote:
Code:
program: vl = globals(_event_args) Last edited by capink; 09-25-2021 at 06:14 PM. |
||
![]() |
![]() |
![]() |
#725 |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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' 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' clears it for everything. I'm not sure what I did wrong. Last edited by ownedbycats; 09-26-2021 at 09:22 AM. |
![]() |
![]() |
Advert | |
|
![]() |
#726 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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' Code:
program: vl = globals(_event_args); vl != 'Cleanup' && view_manager_last_view() != 'Cleanup' Last edited by capink; 09-26-2021 at 09:19 AM. |
![]() |
![]() |
![]() |
#727 |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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.
![]() Last edited by ownedbycats; 09-26-2021 at 09:32 AM. |
![]() |
![]() |
![]() |
#728 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,449
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
The virtual_libraries() function returns a list of virtual libraries. It knows nothing about View Manager views.
|
![]() |
![]() |
![]() |
#729 |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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?
|
![]() |
![]() |
![]() |
#730 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,197
Karma: 1995558
Join Date: Aug 2015
Device: Kindle
|
Not that I know of.
|
![]() |
![]() |
![]() |
#731 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,197
Karma: 1995558
Join Date: Aug 2015
Device: Kindle
|
Version 1.13.1
Version 1.13.2
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, ',') |
![]() |
![]() |
![]() |
#732 |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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.
|
![]() |
![]() |
![]() |
#733 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,197
Karma: 1995558
Join Date: Aug 2015
Device: Kindle
|
|
![]() |
![]() |
![]() |
#734 |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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, ',') |
![]() |
![]() |
![]() |
#735 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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. |
![]() |
![]() |
![]() |
|
![]() |
||||
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 |