I submitted the changes. I will add a post if and when Kovid accepts them into calibre source.
Prefs / Look & feel / Tag browser contains the new option, unchecked by default.
The implementation provides an API for plugins.
To get the current expanded item:
Code:
tbw = gui.tb_widget
state = tbw.get_expansion_state()
To set the current expansion state using a previously retrieved state:
Code:
tbw = gui.tb_widget
tbw.restore_expansion_state(state)