View Single Post
Old 01-09-2023, 06:04 AM   #3
thiago.eec
Wizard
thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.
 
Posts: 1,217
Karma: 1419583
Join Date: Dec 2016
Location: Goiânia - Brazil
Device: iPad, Kindle Paperwhite, Kindle Oasis
Quote:
Originally Posted by kovidgoyal View Post
Easiest way is to store your actions in a dict in your plugin keyed by the unique name.
Hi, Kovid.

Thanks for the reply.
But how would I call them? I don't see anything callable.
Here is a real example:

Plugin name: Skoob Sync
Modules: main.py, ui.py.

In the ui.py, we have a lot of actions created. Like this:

Code:
# Add/remove books
        self.add_to_skoob = cm(self.m, _('&Add book'),
           image='add_to_skoob.png',
           tooltip=_('Add book to Skoob, on Reading shelf'),
           triggered=partial(self.tools.update_status, sync_option='add_to_skoob', shelf=None),
           unique_name='SkoobSync_Add')
        self.remove_from_skoob = cm(self.m, _('&Remove book'),
           image='remove_from_skoob.png',
           tooltip=_('Remove book from your shelves on Skoob'),
           triggered=partial(self.tools.update_status, sync_option='remove_from_skoob', shelf=None),
           unique_name='SkoobSync_Remove')
        self.m.addSeparator()
Their unique names are: 'SkoobSync_Add' and 'SkoobSync_Remove'.
Now, how would I call them from main.py?
thiago.eec is offline   Reply With Quote