Exemplo n.º 1
0
    def do_impl_activate(self):
        # first time of activation -> add graphical stuff
        if self.hasActivated:
            return

        # initialise some variables
        self.plugin = self.props.plugin
        self.shell = self.props.shell

        #indicate that the source was activated before
        self.hasActivated = True

        # dialog has not been created so lets do so.
        ui = Gtk.Builder()
        ui.set_translation_domain('coverart_browser')
        ui.add_from_file(
            rb.find_plugin_file(self.plugin, "coverart_browser.ui"))
        ui.connect_signals(self)

        # load the page and put it in the source
        self.page = ui.get_object('main_box')
        self.pack_start(self.page, True, True, 0)

        # get widgets
        self.status_label = ui.get_object('status_label')
        self.covers_view = ui.get_object('covers_view')
        self.search_entry = ui.get_object('search_entry')

        # set the model for the icon view
        self.covers_model_store = Gtk.ListStore(GObject.TYPE_STRING,
                                                GdkPixbuf.Pixbuf, object)

        self.covers_model = self.covers_model_store.filter_new()
        self.covers_model.set_visible_func(self.visible_covers_callback)

        self.covers_view.set_model(self.covers_model)

        # size pixbuf updated workaround
        self.covers_model_store.connect('row-changed',
                                        self.update_iconview_callback)

        # load the albums
        self.loader = AlbumLoader(self.plugin, self.covers_model_store)
        self.loader.load_albums()

        print "CoverArtBrowser DEBUG - end show_browser_dialog"