![]() |
#481 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,447
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
@capink: how can I get the list of book ids in the current scope in a ChainVariables action?
|
![]() |
![]() |
![]() |
#482 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,196
Karma: 1995558
Join Date: Aug 2015
Device: Kindle
|
I got it. Will fix by initializing an empty dictionary at startup.
|
![]() |
![]() |
Advert | |
|
![]() |
#483 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,196
Karma: 1995558
Join Date: Aug 2015
Device: Kindle
|
I can add a template function to do that, but it will only be available when the chain is running. At configure time it will no be available (will return empty list) because it might not be possible to calculate it then (in case of template based scopes that might depend on variables set on runtime). Will call it scope_ids().
Last edited by capink; 04-01-2021 at 02:12 PM. |
![]() |
![]() |
![]() |
#484 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,196
Karma: 1995558
Join Date: Aug 2015
Device: Kindle
|
Scopes
What is Scopes?
How to use scopes?
Builtin actions that support scopes are:
Note for developers If you a writing and action and want it to support scopes you have to do two things:
Last edited by capink; 04-06-2021 at 03:01 PM. |
![]() |
![]() |
![]() |
#485 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,447
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
I just spent some time to try to test book var scopes. I finally got there. It works very well.
First, I was confused about when Chain Variables actions ran. I forgot about the meaning of the "iterate" box. This is why I asked about getting the ids of the scope. With "iterate" I don't need that, and in any event I could get the list using a from_selection('id'). As far as I am concerned you can forget about that "request". Once I checked 'Iterate' things fell together. The following chain searches all books for "important titles" that contain the word 'all' and updates some metadata. The first action uses an "all books" scope. All the books with "important" titles have a book var set. This action is followed by two single field edit actions with book_var scope that update metadata in the "important" books, specifically storing an altered title and the strlen of the original title. I tried setting the scope of the second metadata action to "books changed". It worked, but I struggled with the results until I remembered that a book doesn't "change" if the metadata stored an action is the same as already there. The attached zip contains the chain, in case you are interested. Last edited by chaley; 04-01-2021 at 03:21 PM. |
![]() |
![]() |
Advert | |
|
![]() |
#486 |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 10,982
Karma: 75337983
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
Question: I made a View action (I previously used the last-viewed column option of Job Spy, but some of its behavior frustrated me):
Code:
{ "ActionsChainMenus": { "Menus": [ { "active": true, "chain_settings": { "chain_links": [ { "action_name": "Calibre Actions", "action_settings": { "disable_busy_cursor": false, "selection": [ { "display": "View", "path": [ "View", "View" ], "paths_text": "View" } ], "wait_jobs": false, "wait_progress": false }, "comment": "Open book" }, { "action_name": "Single Field Edit", "action_settings": { "col_name": "#read", "template": "program:\n\n\tif and(check_yes_no('#read', '', '', 1),) then \t'No'\n\telse $#read\n\tfi", "value_type": "template" }, "comment": "Set #read column (TEMPLATE)" }, { "action_name": "Single Field Edit", "action_settings": { "col_name": "#percentread", "template": "program:\n\tif raw_field('#percentread', '1') ==# '0' then '1'\n\telse raw_field('#percentread')\n\tfi", "value_type": "template" }, "comment": "Set #percentread to 1 (TEMPLATE)" }, { "action_name": "Single Field Edit", "action_settings": { "col_name": "#lastread", "value": [ { "__class__": "datetime.datetime", "__value__": "2021-03-30T00:13:43.637933+00:00" }, true ], "value_type": "predefined" }, "comment": "Set #lastread to current time" }, { "action_name": "Refresh View", "action_settings": {}, "comment": "Refresh view" } ], "refresh_gui": true }, "condition_settings": { "affect_menu": false, "cmp_type": "=", "datatype": "number", "icon": "", "template": "program: selection_count()", "tooltip": "", "value": 1.0 }, "image": "", "menuText": "View", "subMenu": "Invisible" } ] }, "schemaVersion": 1.3 } Last edited by ownedbycats; 04-03-2021 at 04:35 AM. |
![]() |
![]() |
![]() |
#487 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,196
Karma: 1995558
Join Date: Aug 2015
Device: Kindle
|
The plugin waits for every action to complete (return control of the main thread) before it proceeds to the next action. So this depends on what calibre viewer is doing.
However, I tested your chain and this behavior does not happen for me. But maybe we have different (viewer) settings that might affect this. Edit: If you have other reader apps installed on your system, try temporarily making them the default reader (preferences > behavior > un-check use internal view for + make the other reader the default on your system), and see whether this makes a difference. Last edited by capink; 04-03-2021 at 05:53 AM. |
![]() |
![]() |
![]() |
#488 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,196
Karma: 1995558
Join Date: Aug 2015
Device: Kindle
|
Version 1.5.2
Version 1.6.0
@chaley: I've implemented most of your suggestions on the UI (except right click which always opens a context menu). After thinking about them they made more sense than what I was trying to do. Also template scopes is now builtin. |
![]() |
![]() |
![]() |
#489 |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 10,982
Karma: 75337983
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
It happens for other viewers too - I have .paperbooks set to open with Notepad2 and it still stalls.
|
![]() |
![]() |
![]() |
#490 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,196
Karma: 1995558
Join Date: Aug 2015
Device: Kindle
|
It is not happening for with any viewer.
![]() |
![]() |
![]() |
![]() |
#491 |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 10,982
Karma: 75337983
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
I wonder if it might be some sort of OS-specific thing with the window focus. I think you're on Linux.
|
![]() |
![]() |
![]() |
#492 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,196
Karma: 1995558
Join Date: Aug 2015
Device: Kindle
|
I don't think it is OS specific. If this is, most probably there is nothing I can do about it. Will test later with Windows and see if it makes any difference.
|
![]() |
![]() |
![]() |
#493 |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 10,982
Karma: 75337983
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
How exactly does this new Scopes feature work? I saw some of the discussion on it and it looks like some sort of replacement for selection modifiers?
Also, how do I get rid of the horizontal scroll bar? Minor UI suggestion: Perhaps the unlocked conditional icon could be a slightly different colour; something like light skyblue3 or azure3 might work. Last edited by ownedbycats; 04-03-2021 at 09:39 PM. |
![]() |
![]() |
![]() |
#494 | ||
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,196
Karma: 1995558
Join Date: Aug 2015
Device: Kindle
|
Quote:
Note, however, that scopes should be configured per action. Also some actions, most notably Calibre Actions, do not support scopes. Actions that don't support scopes will not have any icons in the scope column, and add/modify scope menu entry will be greyed out for them. The only way to do this would be by making the dialog wide enough for it to disappear. Nothing has changed regarding this. It has been this way from the start. Quote:
Last edited by capink; 04-04-2021 at 04:14 AM. |
||
![]() |
![]() |
![]() |
#495 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,447
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
|
![]() |
![]() |
![]() |
|
![]() |
||||
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 |