Quote:
Originally Posted by capink
I've played with gui.tags_view.context_menu_handler(action='hide', category='#genre') and it seems to working. Is there something that makes calling this non desirable?
|
I don't know. The problem is that the method is normally called when the tag browser is visible and a tag node has the focus. I don't know what happens if either isn't true, or more worrying if there are weird corner cases such as the focus being sometimes yanked to the tag browser. Your plugin could check for tag browser visible, but what do you do if it isn't visible? I don't know how to check for focus.
If you want to play with it then this might work. It uses "recount()' which is what calibre uses when the tag browser data has changed.
Code:
tag_browser = gui.tags_view
cats = tag_browser.hidden_categories
# modify cats as needed, adding or removing categories. It is a set()
self.db.new_api.set_pref('tag_browser_hidden_categories', list(cats))
tag_browser.recount()
EDIT: If the above does work then I could add it as a public API, something like
Code:
change_hidden_categories(operation, category_set)