View Single Post
Old 12-03-2016, 04:47 PM   #1
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
Posts: 27,552
Karma: 193191846
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
Stumped by a UI plugin malfunction

Got a plugin that stopped working the way I expect it to on Arch Linux with calibre 2.73. I'm not exactly sure at what version of calibre things might have gone south (and it's frankly driving me a bit nuts), so I'll just get right to the nitty gritty and hope someone can help.

An Interface plugin (it does function for the most part, by the way).

In the InterfaceAction class's genesis method, I create a menu and set it as the menu for the plugin's qaction:
Code:
self.menu = QMenu()
self.qaction.setMenu(self.menu)
Set the icon (yada, yada)

And then I connect the menu's aboutToShowMenu signal to my "about_to_show_menu" method.
Code:
self.menu.aboutToShow.connect(self.about_to_show_menu)
I then use the "about_to_show_menu" method to build a menu "on-the-fly" based on criteria concerning which book is highlighted in the calibre library.

So far, so good. The plugin gets installed (to the main toolbar and the library's context menu) and works as expected as long as I use the action/menu on the main toolbar to launch the plugin. Menus get built, actions happen when clicking them.

Where it gets weird is that when trying to launch the plugin from the library context menu, the aboutToShow signal never fires. Or rather, the signal is not being connected to my "about_to_show_menu" method. It used to work ... with no change to the plugin's code.

Any ideas what's going wonky with the aboutToShow signal and calibre's library context menu?

Last edited by DiapDealer; 12-03-2016 at 05:48 PM.
DiapDealer is offline   Reply With Quote