View Single Post
Old 01-14-2012, 06:03 AM   #338
kiwidude
Calibre Plugins Developer
kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.
 
Posts: 4,733
Karma: 2197770
Join Date: Oct 2010
Location: Australia
Device: Kindle Oasis
I would never say "officially sanctioned" but the way I have always done this through my plugins is to pass self.actual_plugin_ into my ConfigWidget constructor, from the config_widget() function in __init__.py. That gives you access to your Action class from the ConfigWidget class, so of course you can then access the .gui variable on it. You can see the code in ReadingList and most of my plugins for that passing.

That is what I use, but if you don't need the action class for other reasons then there is also another way Kovid made available some months ago, by doing this:
Code:
    from calibre.gui2.ui import get_gui
    gui = get_gui()
kiwidude is offline   Reply With Quote