View Single Post
Old 08-10-2011, 03:52 PM   #2
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 45,376
Karma: 27230406
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
I suggest removing the persistence of shortcuts from your plugins, use calibre's global functionality for that. Depending on exactly how you implement shortcuts in your plugins, the shortcut persistence in the plugin may lose or it may win.

General background on this change:

1) Any shortcut defined via the action_spec field in your plugin class is automatically managed by calibre. Do not persist these manually.

2) If you want to define shortcuts for more actions (for example for actions in the menu of the main action, use the convenience methods

create_action or create_menu_action

to register these with calibre automatically. All the builtin plugins have been migrated to use create_menu_action, so it should be easy to see how they are used.

3) If for any reason you dont want to use create_menu_action, use gui.keyboard.register_shortcut instead. See the register_shortcut method in gui2/keyboard.py
kovidgoyal is offline   Reply With Quote