-
Notifications
You must be signed in to change notification settings - Fork 29
Favourites Menu
This plugin allows you to build a customizable toolbar menu containing shortcuts to your other plugins or calibre features.
The primary use case it to prevent filling your main toolbar with too many buttons for those other features, while still making them easily accessible with a single click.
- Create a customisable menu button with your favourite menu options
- You can add specific menu actions, submenus or entire plugins to your own menu.
- Add, remove, reorder and rename the menus with separators
- Where appropriate menu items are disabled if they are not relevant to the current context - e.g. device not plugged in.
Access the configuration dialog via either of:
- Preferences -> Plugins -> User interface action -> Favourites Menu -> Customize plugin
- Favourites Menu -> Customize plugin...
From this dialog you can:
- Check or uncheck menu items in the left pane to add/remove them to your menu
- Use the up/down arrow buttons to change order
- Rename menu items to differ from their calibre defaults (e.g. for translations)
- Add separator items to visually appear between menu items.
Favourites Menu supports a plugin with its menus being rebuilt every time it is displayed (such as to enable/disable items based on the current state of calibre).
The pattern for this is that your InterfaceAction
class should have a .menu
property representing the QMenu
, and you will ordinarily have code hooked to the aboutToShow signal.
When the Favourites Menu plugin is asked to dropdown will iterate through all of the child plugins it is being asked to display items for and (once per plugin) emit the iaction.menu.aboutToShow
signal for any plugins that have such a .menu
property.
If your plugin changes the name of a child item dynamically this can cause a problem for the Favourites Menu plugin (as it uses the text name displayed by a plugin as part of the "key" identifying a menu item).
For instance the Reading List plugin includes a count of the items in a child list for some of its actions. To ensure such menu items can be supported by the Reading List plugin, you should simply assign a constant identifying name for the menu item to a .favourites_menu_unique_name
property on your qaction at the time you create it. The Favourites Menu plugin will look for such a property being present and use that in preference to the current text name if it is present.
If you enjoy my calibre plugins or extensions, please feel free to show your appreciation!