11-20-2020, 01:01 PM | #1 |
Wizard
Posts: 1,134
Karma: 1954142
Join Date: Aug 2015
Device: Kindle
|
[GUI Plugin] Action Chains
Using this plugin you can define action chains that can be run from menu entries or an assigned keyboard shortcut. A chain can contain one or more action(s) that are run sequentially.
Available Actions: The plugin defines some builtin actions you can use, it also provides a module editor where you can write your own actions using python.
Limitations:
How to use the plugin: To make a new chain follow these steps:
Suggested Use Cases: Here are some tips to help get you started:
Note on the Selection Modifier Action:
Note on Module Editor:
Conditional execution for chains and actions (branching):
Action chains template functions:
Scopes:
Event Manager
Action chains API
Custom actions and events:
Misc tips:
Misc links
Editor Chains:
Credits:
Installation Notes:
Special Notes:
Paypal Donations: Version History: Spoiler:
Last edited by capink; 07-01-2024 at 11:37 PM. Reason: Version 1.20.7 |
11-20-2020, 04:18 PM | #2 |
Wizard
Posts: 1,134
Karma: 1954142
Join Date: Aug 2015
Device: Kindle
|
reserved post.
Last edited by capink; 08-01-2023 at 04:15 PM. |
Advert | |
|
11-20-2020, 10:39 PM | #3 |
Custom User Title
Posts: 9,338
Karma: 63297233
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
This sounds almost like an exact solution to my post here. Definitely giving it a try.
Early feedback: One small feature that seems to be missing is the ability to add a descriptor/label to actions. Works pretty well otherwise though. I'm experimenting with the selection modifier so I don't have separate actions for AO3 and FFNet fics. Also, I found it's helpful to add a Calibre Action to toggle mark on all the books before starting a chain, and then at the very end setting a search to marked:true. A small suggestion: It might be a good idea to have a custom action to prompt for confirmation for more...destructive action chains, and pressing "no" would halt the entire thing. I guess this could be made with a module though I'm not sure how. Last edited by ownedbycats; 11-21-2020 at 01:46 AM. |
11-21-2020, 07:52 AM | #4 | |||
Wizard
Posts: 1,134
Karma: 1954142
Join Date: Aug 2015
Device: Kindle
|
Quote:
I am thinking about rewriting it as a table to add identifiers and make changing order easier. Quote:
Quote:
Code:
from PyQt5.Qt import QWidget, QVBoxLayout, QGroupBox, QTextEdit from calibre.gui2 import question_dialog from calibre_plugins.action_chains.actions.base import ChainAction class ConfirmConfigWidget(QWidget): def __init__(self, plugin_action): QWidget.__init__(self) self._init_controls() def _init_controls(self): l = QVBoxLayout() self.setLayout(l) gb = QGroupBox('Confirm message') gb_l = QVBoxLayout() gb.setLayout(gb_l) self.tb = QTextEdit() self.tb.insertPlainText('Are you sure you want to proceed?') gb_l.addWidget(self.tb) l.addWidget(gb) def load_settings(self, settings): if settings: self.tb.setText(settings['message']) def save_settings(self): settings = {} settings['message'] = self.tb.toPlainText() return settings class ConfirmAction(ChainAction): name = 'Confirm' def config_widget(self): return ConfirmConfigWidget def run(self, gui, settings, chain): message = settings.get('message', 'Are you sure you want to proceed?') if not question_dialog(gui, _('Are you sure?'), message, show_copy_button=False): raise chain.UserInterrupt Last edited by capink; 03-23-2021 at 01:27 PM. Reason: typos |
|||
11-21-2020, 02:41 PM | #5 |
Custom User Title
Posts: 9,338
Karma: 63297233
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
Here's a small glitch I found:
Single Field Edit > Predefined Value > Today on a timestamp column seems to have trouble with timezones. I'm -4:00 GMT, and running an action at 3:30 pm produces a timestamp of 7:30 pm. Not sure what would happen if I ran it when the timezones are on different dates. EDIT: Actually, it seems to produce timestamps of the time that the action was created....not the time it was run. Odd. Last edited by ownedbycats; 11-21-2020 at 02:51 PM. |
Advert | |
|
11-21-2020, 03:09 PM | #6 | |
Wizard
Posts: 1,134
Karma: 1954142
Join Date: Aug 2015
Device: Kindle
|
Quote:
Edit: You will have to remove the action and add it again. Last edited by capink; 11-21-2020 at 03:32 PM. Reason: attached version moved to first post |
|
11-21-2020, 03:18 PM | #7 |
Custom User Title
Posts: 9,338
Karma: 63297233
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
Trying to run/edit an existing action changing a datetime column failed with an error, but creating a new one worked with the proper timestamp. Here's the error in case you need it anyways:
Code:
calibre, version 5.5.0 ERROR: Unhandled exception: <b>TypeError</b>:cannot unpack non-iterable datetime.datetime object calibre 5.5 [64bit] embedded-python: True is64bit: True Windows-10-10.0.19041 Windows ('64bit', 'WindowsPE') ('Windows', '10', '10.0.19041') Python 3.8.5 Windows: ('10', '10.0.19041', '', 'Multiprocessor Free') Interface language: None Successfully initialized third party plugins: Action Chains (0, 1, 0) && Barnes & Noble (1, 2, 16) && Calibre Power Search Plugin (1, 7, 0) && CalibreSpy (1, 0, 83) && Comments Cleaner (1, 3, 0) && Count Pages (1, 11, 0) && Drop Search Results (1, 0, 10) && Embed Comic Metadata (1, 5, 2) && EpubCheck (0, 2, 3) && EpubMerge (2, 11, 0) && Extract ISBN (1, 5, 0) && FanFicFare (3, 25, 8) && Fantastic Fiction (1, 4, 0) && Favourites Menu (1, 0, 5) && Find Duplicates (1, 8, 3) && Generate Cover (2, 0, 0) && GetFileName (0, 1, 1) && Goodreads (1, 5, 1) && Import List (1, 5, 1) && Job Spy (1, 0, 188) && Kindle hi-res covers (0, 5, 0) && Kobo Books (1, 8, 0) && Kobo Utilities (2, 11, 8) && KoboTouchExtended (3, 4, 1) && Library Codes (1, 0, 47) && Manage Series (1, 2, 11) && Modify ePub (1, 6, 1) && MultiColumnSearch (1, 0, 85) && Open With (1, 5, 13) && Quality Check (1, 10, 1) && Reading List (1, 7, 1) && Save To Format (0, 0, 6) && SmartEject (2, 3, 0) && Sum Column (0, 3, 1) && View Manager (1, 6, 0) Traceback (most recent call last): File "calibre_plugins.action_chains.action", line 209, in run_chain File "calibre_plugins.action_chains.chain_tools", line 96, in run_loop File "calibre_plugins.action_chains.chain_tools", line 79, in run_loop File "calibre_plugins.action_chains.actions.single_field", line 378, in run File "calibre_plugins.action_chains.dialogs.single_field_widgets", line 1009, in setter TypeError: cannot unpack non-iterable datetime.datetime object |
11-21-2020, 03:26 PM | #8 | |
Wizard
Posts: 1,134
Karma: 1954142
Join Date: Aug 2015
Device: Kindle
|
Quote:
Edit: I updated the first post to include the fixed version. Please note that any single field action with date columns will have to be removed and re-added again. Last edited by capink; 11-21-2020 at 03:29 PM. |
|
11-21-2020, 03:30 PM | #9 |
Custom User Title
Posts: 9,338
Karma: 63297233
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
Thankfully I only have the one. "Mark as Read" sets #read to yes, #percentread to 100, #lastread to the current time, and pops up a rating dialog.
|
11-22-2020, 05:17 AM | #10 | |
Interested in the matter
Posts: 421
Karma: 426094
Join Date: Dec 2011
Location: Spain, south coast
Device: Pocketbook InkPad 3
|
I've tried it with a fairly long searchs and replaces chain, and it works like a charm (ugh! what a break).
Quote:
Congratulations! and thank you very much for this magnificent work. |
|
11-22-2020, 08:25 AM | #11 | |
Wizard
Posts: 1,134
Karma: 1954142
Join Date: Aug 2015
Device: Kindle
|
Quote:
I will see about this. The current view has the advantage of integrating better with error messages. I am still trying to figure the best way to do this. Another thing I am not sure about, is whether it makes sense to make the chains library specific, or keep them as they are now. If people have any input about this, I would be interested in hearing it. It might break existing settings though. |
|
11-22-2020, 08:32 AM | #12 | |
Wizard
Posts: 1,134
Karma: 1954142
Join Date: Aug 2015
Device: Kindle
|
Quote:
One suggestion though, put the rating dialog action first and put a selection modifier with the option "select books modified by last action" right below it, and after that put all the other actions. This way if you press the cancel button on the rating dialog for whatever reason, the rest of actions are not carried out since there are no selection. |
|
11-22-2020, 10:29 AM | #13 |
Guru
Posts: 939
Karma: 418804
Join Date: Jun 2015
Device: Rocketbook, kobo aura h2o, kobo forma, kobo libra color
|
Haven't tried this plugin yet, but it looks really useful!
How about in addition to select books, you mark books with tag and take a user supplied tag. This would let you search for marked:usertag after the chain ran to select subsets from different actions within the chain or maybe even reuse previous results within the chain. |
11-22-2020, 11:14 AM | #14 | |
Wizard
Posts: 1,134
Karma: 1954142
Join Date: Aug 2015
Device: Kindle
|
Quote:
|
|
11-22-2020, 11:50 AM | #15 | |
Guru
Posts: 939
Karma: 418804
Join Date: Jun 2015
Device: Rocketbook, kobo aura h2o, kobo forma, kobo libra color
|
Quote:
I've thought about writing a plugin to do that, but haven't gotten around to it. |
|
Thread Tools | Search this Thread |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[Editor Plugin] Editor Chains | capink | Plugins | 94 | 07-03-2024 07:26 PM |
Action Chains Resources | capink | Plugins | 65 | 07-01-2024 03:12 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 |