Disabling self.menuless_qaction too does fix the problem. I've changed my code to:
# disable when not in library. (main,carda,cardb)
def location_selected(self, loc):
enabled = loc == 'library'
Thanks for pointing it out.
Does that suggest that some of calibre's built in actions need that change, too?
I see the same issue--disabled button, but keyboard shortcut works with on last selected library book with ConvertAction, SendToDeviceAction and EditMetadataAction.
And a quick grep finds 12 places gui2/actions/*.py using 'self.qaction.setEnabled(enabled)'.