Never mind, I figured it out. My problem was due to a missing line.
Code:
popup_type = QToolButton.InstantPopup
I never have been exactly sure about the available options for popup_type. I just learnt the hard way.
Hi Kovid,
calibre 4.10.1 Win10 32-bit ... Can you shed any light on the following:
This is not a showstopper but I've just noticed a problem with non-display of the main plugin icon in some of my UI plugins. It may have been around longer but I've only just noticed it.
The problem seems to occur only in the right-click context menu and only for UI plugins which don't have a sub-menu. See attached screenshots.
Using ScrambleEbook as an example of a UI plugin with no sub-menu, as you can see (2nd image) the plugin icon displays OK in the main toolbar and in the main menu. However in the right-click context menu (1st image) the icon is blank.
Compare this with the 'TTS to MP3' (which does have a sub-menu) next to ScrambleEbook where the icon displays OK everywhere.
I notice that the built-in tools/plugins which don't have a sub-menu (e.g. 'Polish book', 'Unpack book') don't have the same problem. I don't think the problem is specific to ScrambleEbook because 2 of my other (personal) plugins have the same problem.
This is the genesis code from ScrambleEbook in case this is where the problem lies.
Code:
def genesis(self):
self.is_library_selected = True
self.icons = get_icons(['images/plugin_icon.png',
'images/azw3.png',
'images/epub.png',
'images/kepub.png',
'images/azw3.svg',
'images/epub.svg',
'images/kepub.svg'
])
icon = get_icons('images/plugin_icon.png')
self.qaction.setIcon(icon)
self.qaction.triggered.connect(self.show_dialog)