View Single Post
Old 04-20-2011, 12:02 PM   #1
meme
Sigil developer
meme ought to be getting tired of karma fortunes by now.meme ought to be getting tired of karma fortunes by now.meme ought to be getting tired of karma fortunes by now.meme ought to be getting tired of karma fortunes by now.meme ought to be getting tired of karma fortunes by now.meme ought to be getting tired of karma fortunes by now.meme ought to be getting tired of karma fortunes by now.meme ought to be getting tired of karma fortunes by now.meme ought to be getting tired of karma fortunes by now.meme ought to be getting tired of karma fortunes by now.meme ought to be getting tired of karma fortunes by now.
 
Posts: 1,275
Karma: 1101600
Join Date: Jan 2011
Location: UK
Device: Kindle PW, K4 NT, K3, Kobo Touch
Refreshing toolbar icons

I've added a feature to my plugin (mainly for kiwidude ) to allow you to change the behaviour of the toolbar icon through customization. By default when you install the plugin its only a dropdown menu. But you can customize it to select any of the menu's functions to be the default action (or to just show the menu). When you restart calibre, the icon will change to the split icon/menu view if you've chosen a function, and if you click the icon it will run the function you configured. You can of course click the down arrow to get the menu as usual.

I'd like to avoid having to restart calibre. I see that if I run Preferences and add/remove another icon and save, that my icon correctly updates, so I know its possible. There are many functions in the source and after testing a few I think it might be safer to ask the right way to do this in order to avoid problems later.

So how to I get the toolbar icons to refresh without restarting?

I expect to call this either in my plugins __init__ save_settings, or possibly within the ui rebuild_menus (but I think that might be calling a refresh inside of a refresh).
meme is offline   Reply With Quote