Ejemplo n.º 1
0
    def on_set_button_clicked(self, button):
        """
            Chooses the current cover and saves it to the database
        """
        paths = self.previews_box.get_selected_items()

        if paths:
            path = paths[0]
            coverdata = self.covers_model[path][0]

            COVER_MANAGER.set_cover(self.track, coverdata[0], coverdata[1])

            self.emit('cover-chosen', self.track, coverdata[1])
            self.window.destroy()
Ejemplo n.º 2
0
    def on_set_button_clicked(self, button):
        """
            Chooses the current cover and saves it to the database
        """
        paths = self.previews_box.get_selected_items()

        if paths:
            path = paths[0]
            coverdata = self.covers_model[path][0]

            COVER_MANAGER.set_cover(self.track, coverdata[0], coverdata[1])

            self.emit('cover-chosen', self.track, coverdata[1])
            self.window.destroy()
Ejemplo n.º 3
0
    def do_drag_data_received(self, context, x, y, selection, info, time):
        """
        Sets the cover based on the dragged data
        """
        if self.__track is not None:
            uri = selection.get_uris()[0]
            db_string = 'localfile:%s' % uri

            try:
                stream = Gio.File.new_for_uri(uri).read()
            except GLib.Error:
                return

            self.cover_data = stream.read()
            width = settings.get_option('gui/cover_width', 100)
            pixbuf = pixbuf_from_data(self.cover_data, (width, width))

            if pixbuf is not None:
                self.image.set_from_pixbuf(pixbuf)
                COVER_MANAGER.set_cover(self.__track, db_string, self.cover_data)
Ejemplo n.º 4
0
    def do_drag_data_received(self, context, x, y, selection, info, time):
        """
            Sets the cover based on the dragged data
        """
        if self.__track is not None:
            uri = selection.get_uris()[0]
            db_string = "localfile:%s" % uri

            try:
                stream = gio.File(uri).read()
            except gio.Error:
                return

            self.cover_data = stream.read()
            width = settings.get_option("gui/cover_width", 100)
            pixbuf = icons.MANAGER.pixbuf_from_data(self.cover_data, (width, width))

            if pixbuf is not None:
                self.image.set_from_pixbuf(pixbuf)
                COVER_MANAGER.set_cover(self.__track, db_string, self.cover_data)