Re: [Rhythmbox-devel] registering plugin



On Fri, Jan 7, 2011 at 7:23 AM, Richard Henwood <rjhenwood yahoo co uk> wrote:
> Hi All,
>
> I recently attempted to write a plugin [1]. I received an anonymous bug (I suspect some one on this list as this is the only place I've publicised it). I'm grateful for this and it should be fixed now....
>
>
> But my question is:
>
> On my computer, RB: 0.13.1 is register my plugin __init__.py
>  self.entry_type = GutenbergEntryType()
>  self.db.register_entry_type(self.entry_type)
>
> works, on another computer, RB: 0.12.8
>  self.entry_type = self.db.entry_register_type("GutenbergEntryType")
>
> works. But if I try one incantation on the other version I get an error:
>
> AttributeError: '__main__.RhythmDBTree' object has no attribute 'entry_register_type'
>
> or
>
> NotImplementedError: GutenbergEntryType is an abstract widget.

This is one of the unpleasant things about developing plugins. The
plugin API is not stable and you generally don't get notified when it
breaks, unless you're paying close attention.

You can work around it in this case with something like this:

    if hasattr(self.db, 'entry_register_type'):
        self.entry_type = self.db.entry_register_type("GutenbergEntryType")
    else:
        self.entry_type = GutenbergEntryType()
        self.db.register_entry_type(self.entry_type)

if you want to maintain compatibility with older versions of rhythmbox.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]