From 2b5f4eeda07ea3aed265b371b157fbea3880dd71 Mon Sep 17 00:00:00 2001 From: Charles Haley Date: Thu, 16 Jan 2025 15:44:46 +0000 Subject: [PATCH] TB Icons: Fix showing the "Use default" menu line when there is no item value. --- src/calibre/gui2/tag_browser/view.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/calibre/gui2/tag_browser/view.py b/src/calibre/gui2/tag_browser/view.py index cc303645ac..6d8a5f7cb8 100644 --- a/src/calibre/gui2/tag_browser/view.py +++ b/src/calibre/gui2/tag_browser/view.py @@ -1282,10 +1282,10 @@ class TagsView(QTreeView): # {{{ partial(self.context_menu_handler, action='set_icon', key=key, index=index, category=category, extra=(icon_name, True))) ma.setEnabled(icon_name is not None and not for_child) - im.addAction(_('Use the default icon for {}').format(for_name), + ma = im.addAction(_('Use the default icon for {}').format(for_name), partial(self.context_menu_handler, action='clear_icon', key=key, index=index, category=category)) - ma.setEnabled(icon_name is not None) + ma.setEnabled(name is not None and icon_name is not None) im.addSection(_('Defaults')) im.addAction(_('Use/edit a template to choose the default value icon'), partial(self.context_menu_handler, action='set_icon',