Ejemplo n.º 1
0
    def __init__(self, parent, track, search=None):
        """
        Expects the parent control, a track, an an optional search string
        """
        GObject.GObject.__init__(self)
        self.parent = parent
        self.builder = Gtk.Builder()
        self.builder.add_from_file(xdg.get_data_path('ui', 'coverchooser.ui'))
        self.builder.connect_signals(self)
        self.window = self.builder.get_object('CoverChooser')

        self.window.set_title(
            _("Cover options for %(artist)s - %(album)s")
            % {
                'artist': track.get_tag_display('artist'),
                'album': track.get_tag_display('album'),
            }
        )
        self.window.set_transient_for(parent)

        self.message = dialogs.MessageBar(
            parent=self.builder.get_object('main_container'),
            buttons=Gtk.ButtonsType.CLOSE,
        )
        self.message.connect('response', self.on_message_response)

        self.track = track
        self.covers = []
        self.current = 0

        self.cover = guiutil.ScalableImageWidget()
        self.cover.set_image_size(350, 350)

        self.cover_image_box = self.builder.get_object('cover_image_box')

        self.stack = self.builder.get_object('stack')
        self.stack_ready = self.builder.get_object('stack_ready')

        self.size_label = self.builder.get_object('size_label')
        self.source_label = self.builder.get_object('source_label')

        self.covers_model = self.builder.get_object('covers_model')
        self.previews_box = self.builder.get_object('previews_box')
        self.previews_box.set_no_show_all(True)
        self.previews_box.hide()
        self.previews_box.set_model(None)

        self.set_button = self.builder.get_object('set_button')
        self.set_button.set_sensitive(False)

        self.window.show_all()

        self.stopper = threading.Event()
        self.fetcher_thread = threading.Thread(
            target=self.fetch_cover, name='Coverfetcher'
        )
        self.fetcher_thread.start()
Ejemplo n.º 2
0
    def __init__(self, parent, track, search=None):
        """
            Expects the parent control, a track, an an optional search string
        """
        gobject.GObject.__init__(self)
        self.parent = parent
        self.builder = gtk.Builder()
        self.builder.add_from_file(xdg.get_data_path('ui/coverchooser.ui'))
        self.builder.connect_signals(self)
        self.window = self.builder.get_object('CoverChooser')

        self.window.set_title(_("Cover options for %(artist)s - %(album)s") % {
            'artist': track.get_tag_display('artist'),
            'album': track.get_tag_display('album')
        })
        self.window.set_transient_for(parent)

        self.message = dialogs.MessageBar(
            parent=self.builder.get_object('main_container'),
            buttons=gtk.BUTTONS_CLOSE
        )
        self.message.connect('response', self.on_message_response)

        self.track = track
        self.covers = []
        self.current = 0

        self.cover = guiutil.ScalableImageWidget()
        self.cover.set_image_size(350, 350)

        self.cover_image_box = self.builder.get_object('cover_image_box')

        self.loading_indicator = gtk.Alignment()
        self.loading_indicator.props.xalign = 0.5
        self.loading_indicator.props.yalign = 0.5
        self.loading_indicator.set_size_request(350, 350)
        self.cover_image_box.pack_start(self.loading_indicator)

        try:
            spinner = gtk.Spinner()
            spinner.set_size_request(100, 100)
            spinner.start()
            self.loading_indicator.add(spinner)
        except AttributeError: # Older than GTK 2.20 and PyGTK 2.22
            self.loading_indicator.add(gtk.Label(_('Loading...')))

        self.size_label = self.builder.get_object('size_label')
        self.source_label = self.builder.get_object('source_label')

        self.covers_model = self.builder.get_object('covers_model')
        self.previews_box = self.builder.get_object('previews_box')
        self.previews_box.set_no_show_all(True)
        self.previews_box.hide()
        self.previews_box.set_model(None)

        self.set_button = self.builder.get_object('set_button')
        self.set_button.set_sensitive(False)

        self.window.show_all()

        self.stopper = threading.Event()
        self.fetcher_thread = threading.Thread(target=self.fetch_cover, name='Coverfetcher')
        self.fetcher_thread.start()