View Single Post
Old 04-02-2011, 03:18 PM   #24
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,274
Karma: 1101600
Join Date: Jan 2011
Location: UK
Device: Kindle PW, K4 NT, K3, Kobo Touch
Kiwidude, thanks. Makes perfect sense. There's obviously a lot more changed than I thought, and the previous approach of copy/paste has its limits.

So now in __init.py__:

Code:
    def config_widget(self):
        if self.actual_plugin_:
            error_tuple = self.actual_plugin_.is_configurable()
            if error_tuple:
                return error_tuple

            from calibre_plugins.kindle_collections.config import ConfigWidget
            return ConfigWidget(self.actual_plugin_)
and in ui.py:

Code:
    def is_configurable(self):
        if not initialize_data(self.gui):
            (info, error, detail) = msg.message.get_all()
            return (error, detail)
        return None
where I use message to save messages.

I'm still working out how best to handle global variables. I've removed quite a few already by using them as arguments but still have several. Splitting into files means I have one file with just global variables. Which works, but just doesn't 'feel' right. The issue is the routines have interdependencies, but I'll continue to look at the structure.

Kovid, thanks for updating the plugin api. I know its a bit of work now, but I can already see its a lot easier to work with my code now that I can split it up and do away with extra layers of proxy classes.
meme is offline   Reply With Quote