View Single Post
Old 08-29-2011, 02:27 PM   #21
kiwidude
Calibre Plugins Developer
kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.
 
Posts: 4,731
Karma: 2197770
Join Date: Oct 2010
Location: Australia
Device: Kindle Oasis
Still thinking about (3). This is going to be a bit of a problem I think, as it brings back into play the reason why I did rebuilding menus in the first place. Take a plugin like Reading List, which has actions on submenus to add and remove from a specific list, which can have shortcuts associated. What happens when the user deletes that list? In my "current" approach, calling self.menu.clear() when the user clicks ok in the config dialog, all the old menus are destroyed and I rebuild everything to reflect the current set of menus. Trying to keep track of the actions registered for each menu, manually removing/adding to those lists is complex enough, but then doing some sort of unregister for deleted menus as well?

I was wondering if there could be a function which given a QMenu iterates through it and "unregisters" where appropriate any shortcuts? So then I could still Clear() and rebuild.

However I realise even that would not be enough because when I rebuild my menus will be registering shortcuts as per what the plugin code thinks they are. The "overriding" which presumably takes place at Calibre startup etc would not be being invoked, so for some of those actions the shortcut will be wrong.

Hmmm.
kiwidude is offline   Reply With Quote