View Single Post
Old 04-02-2011, 05:58 AM   #23
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,745
Karma: 2208556
Join Date: Oct 2010
Location: Australia
Device: Kindle Oasis
I believe you will need to change the point at which you return the tuple. Of course now we are creating a ConfigWidget class instance, and doing stuff inside the __init__() function of it, whereas previously you were directly inside the config_widget() function itself.

So if I were you I would not put the code in ConfigWidget() at all. Instead put the check in the config_widget() function in your InterfaceActionBase class.
ie.
Code:
def config_widget(self):
    if self.not_valid_to_configure()
        return ('My message', 'My details')
    from calibre_plugins.kindle_collections.config import ConfigWidget
    return ConfigWidget(self.plugin_action_)

Last edited by kiwidude; 04-02-2011 at 06:08 AM. Reason: Added a "from" clause to make this more realistic code
kiwidude is offline   Reply With Quote