[Rhythmbox-devel] New Source in a Python plugin



Hi,

Has anyone done a new source type in Python? The code in the wiki is a little confusing. I tried and this is what I got so far, but it doesnt work, Rhythmbox closes with a segmentation fault, with no error messages, if I click on the source name to open it.
This is my testing code:

import sys, os
import gobject
import gtk, gtk.glade, gtk.gdk
import rb, rhythmdb

class TestSourcePlugin (rb.Plugin):
    def __init__(self):
        rb.Plugin.__init__(self)
    def activate(self, shell):
        self.shell = shell
        self.db = shell.get_property('db')
        # Can't initialize TestSource directly, or shell and name are set to None
        self.source = gobject.new (TestSource, shell=self.shell, name="TestSource")
        self.shell.append_source(self.source, None)
    def deactivate(self, shell):
        self.shell = None
        self.db = None

class TestSource(rb.Source):
    def __init__(self):
        rb.Source.__init__(self)
        # Adds a new HBox just to test, this code is executed ok
        self.add(gtk.HBox())


gobject.type_register(TestSource)

----
Thanks in advance,
Alexandre Rosenfeld

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