![]() |
#631 |
null operator (he/him)
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 21,746
Karma: 30237526
Join Date: Mar 2012
Location: Sydney Australia
Device: none
|
![]()
@capink - Any thoughts as to feasibility?
Apologies if it already exists ![]() BR Last edited by BetterRed; 08-06-2021 at 06:27 PM. |
![]() |
![]() |
![]() |
#632 |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 11,012
Karma: 75555555
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
Only on the "add books" action, or also autoadd from a folder?
|
![]() |
![]() |
Advert | |
|
![]() |
#633 | |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,196
Karma: 1995558
Join Date: Aug 2015
Device: Kindle
|
Quote:
On the other hand, if you want this when adding books manually, you can have a chain where the add action (through Calibre Actions) is at the top followed by any other actions you want after it. if you choose to go down this route, not the following:
Now whenever you want to add books, you click on this chain and it will open Add Books file dialog where you select the books you want as usual. After all books are added, all other actions in the chain will run. |
|
![]() |
![]() |
![]() |
#634 |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 11,012
Karma: 75555555
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
For future reference, is there a less tedious way to change multiple submenu entries? Selecting multiple chains and using F2 just modified the last one selected.
|
![]() |
![]() |
![]() |
#635 | |
null operator (he/him)
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 21,746
Karma: 30237526
Join Date: Mar 2012
Location: Sydney Australia
Device: none
|
Quote:
I avoid dialogue boxes almost as much as I avoid the mouse - maybe even more. One of the first things I did when I started with calibre was to find ways of dodging some of its dialogue boxes - such as Add books and Metadata edit. So, what I had in mind was a variant of Action Chains (or a wrapper) that ran as File Type plugin - a'la the GetFileName and deDRM plugins. Don't treat this as a request - it was just an early morning idea that popped into my head and jumped onto the keyboard. But on another tangent - is what you wrote in November still true ==>> 20. i.e. Conversions can't be initiated from an Action Chain. BR |
|
![]() |
![]() |
Advert | |
|
![]() |
#636 | ||
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,196
Karma: 1995558
Join Date: Aug 2015
Device: Kindle
|
Quote:
Quote:
|
||
![]() |
![]() |
![]() |
#637 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,196
Karma: 1995558
Join Date: Aug 2015
Device: Kindle
|
|
![]() |
![]() |
![]() |
#638 |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 11,012
Karma: 75555555
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
Thanks. One way I can see is when changing a submenu entry, check for other ones and then offer to change them. I suspect this might get annoying if you're just moving some to a different submenu though.
|
![]() |
![]() |
![]() |
#639 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,196
Karma: 1995558
Join Date: Aug 2015
Device: Kindle
|
Pressing F2 with multiple selections and active cell is submenu > pop up an input dialog.
|
![]() |
![]() |
![]() |
#640 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,196
Karma: 1995558
Join Date: Aug 2015
Device: Kindle
|
@BetterRed
Here is another method of achieving what you want, you need to add the following custom event (Manage modules > add module > copy paste the code below): Code:
from functools import partial # python 3 compatibility from six import text_type as unicode from PyQt5.Qt import (QApplication, Qt, QTimer, QWidget, QVBoxLayout, QCheckBox, pyqtSignal) from calibre import prints from calibre.constants import DEBUG from calibre.db.listeners import EventType from calibre.utils.date import now from calibre_plugins.action_chains.events.base import ChainEvent import calibre_plugins.action_chains.config as cfg class ConfigWidget(QWidget): def __init__(self, plugin_action): QWidget.__init__(self) self.plugin_action = plugin_action self.gui = plugin_action.gui self.db = self.gui.current_db self._init_controls() def _init_controls(self): l = self.l = QVBoxLayout() self.setLayout(l) self.select_chk = QCheckBox(_('Select newly added books')) self.select_chk.setChecked(True) l.addWidget(self.select_chk) l.addStretch(1) self.setMinimumSize(300,300) def load_settings(self, settings): if settings: self.select_chk.setChecked(settings['select_books']) def save_settings(self): settings = {} settings['select_books'] = self.select_chk.isChecked() return settings class BooksAddedEvent(ChainEvent): name = 'Books Added' books_added = pyqtSignal(object) timer_interval = 30 def __init__(self, plugin_action): ChainEvent.__init__(self, plugin_action) self.db = plugin_action.gui.current_db self.gui.add_db_listener(self.process_event_in_db) self.book_created_cache = set() self.book_created_cache_last_updated = None QTimer.singleShot(self.timer_interval * 1000, self._on_timeout) def process_event_in_db(self, db, event_type, event_data): if not db.library_id == self.gui.current_db.library_id: return if event_type == EventType.book_created: book_id = event_data[0] self.add_to_book_created_cache(book_id, now()) elif event_type == EventType.books_removed: removed_book_ids = event_data[0] self.book_created_cache = self.book_created_cache.difference(set(removed_book_ids)) def _on_timeout(self): # Make sure no modal widget dialog is present (e.g. add books duplicate dialog). Otherwise, postpone if QApplication.instance().activeModalWidget(): pass # postpone event if another action chains is running elif self.plugin_action.chainStack: pass else: utime = self.book_created_cache_last_updated if utime: elapsed = now() - utime if elapsed.seconds > 20: QTimer.singleShot(0, partial(self.books_added.emit, self.book_created_cache)) QTimer.singleShot(0, self.clean_book_created_cache) # keep the timer runnig QTimer.singleShot(self.timer_interval * 1000, self._on_timeout) def add_to_book_created_cache(self, book_id, timestamp): self.book_created_cache.add(book_id) self.book_created_cache_last_updated = timestamp def clean_book_created_cache(self): self.book_created_cache = set() self.book_created_cache_last_updated = None def get_event_signal(self): return self.books_added def config_widget(self): return ConfigWidget def pre_chains_event_actions(self, event_args, event_opts): if event_opts.get('select_books', False): book_ids = event_args[0] self.gui.library_view.select_rows(book_ids) if DEBUG: prints('Action Chains: Books Added Event: Selecting newly added book_ids: {}') Notes:
Edit: The solution above is updated to work with auto-add. The File Type plugin solution could work, but it will need a separate plugin, also it will invoke the chain once after each book is added instead of waiting for all books before running the chain. Edit2: The solution above is updated to be more cleaner:
Last edited by capink; 08-17-2021 at 03:39 PM. |
![]() |
![]() |
![]() |
#641 |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 11,012
Karma: 75555555
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
Is there a way to account for Power Search's dialog in an action chain?
I wanted to see if I could make a chain to search a term and then pass on the marked books to Agent Ransack. Unfortunately even with the two "wait" options selected, it immediately tries to execute the other actions after opening the dialog and fails because there aren't any marked books yet. |
![]() |
![]() |
![]() |
#642 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,196
Karma: 1995558
Join Date: Aug 2015
Device: Kindle
|
I don't use the plugin so I don't know what is happening there. The wait option is intended for actions that launch progress bars.
Last edited by capink; 08-11-2021 at 04:43 AM. |
![]() |
![]() |
![]() |
#643 | |
null operator (he/him)
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 21,746
Karma: 30237526
Join Date: Mar 2012
Location: Sydney Australia
Device: none
|
Quote:
BR |
|
![]() |
![]() |
![]() |
#644 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,196
Karma: 1995558
Join Date: Aug 2015
Device: Kindle
|
Version 1.10.0
Last edited by capink; 08-13-2021 at 08:44 AM. |
![]() |
![]() |
![]() |
#645 |
Connoisseur
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 78
Karma: 99068
Join Date: Nov 2017
Device: N/A
|
1.11 prevents my Calibre 5.25 from starting.
|
![]() |
![]() |
![]() |
|
![]() |
||||
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 |