示例#1
0
	def on_streams_new(self, _action, stream_num=-1):
		if stream_num > -1:
			edit_mode = True
		else:
			edit_mode = False
		# Prompt user for playlist name:
		dialog = ui.dialog(title=None, parent=self.window, flags=gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT, buttons=(gtk.STOCK_CANCEL, gtk.RESPONSE_REJECT, gtk.STOCK_OK, gtk.RESPONSE_ACCEPT), role="streamsNew")
		if edit_mode:
			dialog.set_title(_("Edit Stream"))
		else:
			dialog.set_title(_("New Stream"))
		hbox = gtk.HBox()
		namelabel = ui.label(text=_('Stream name') + ':')
		hbox.pack_start(namelabel, False, False, 5)
		nameentry = ui.entry()
		if edit_mode:
			nameentry.set_text(self.config.stream_names[stream_num])
		hbox.pack_start(nameentry, True, True, 5)
		hbox2 = gtk.HBox()
		urllabel = ui.label(text=_('Stream URL') + ':')
		hbox2.pack_start(urllabel, False, False, 5)
		urlentry = ui.entry()
		if edit_mode:
			urlentry.set_text(self.config.stream_uris[stream_num])
		hbox2.pack_start(urlentry, True, True, 5)
		ui.set_widths_equal([namelabel, urllabel])
		dialog.vbox.pack_start(hbox)
		dialog.vbox.pack_start(hbox2)
		ui.show(dialog.vbox)
		response = dialog.run()
		if response == gtk.RESPONSE_ACCEPT:
			name = nameentry.get_text()
			uri = urlentry.get_text()
			if len(name.decode('utf-8')) > 0 and len(uri.decode('utf-8')) > 0:
				# Make sure this stream name doesn't already exit:
				i = 0
				for item in self.config.stream_names:
					# Prevent a name collision in edit_mode..
					if not edit_mode or (edit_mode and i != stream_num):
						if item == name:
							dialog.destroy()
							if ui.show_msg(self.window, _("A stream with this name already exists. Would you like to replace it?"), _("New Stream"), 'newStreamError', gtk.BUTTONS_YES_NO) == gtk.RESPONSE_YES:
								# Pop existing stream:
								self.config.stream_names.pop(i)
								self.config.stream_uris.pop(i)
							else:
								return
					i = i + 1
				if edit_mode:
					self.config.stream_names.pop(stream_num)
					self.config.stream_uris.pop(stream_num)
				self.config.stream_names.append(name)
				self.config.stream_uris.append(uri)
				self.populate()
				self.settings_save()
		dialog.destroy()
		self.iterate_now()
示例#2
0
	def on_streams_new(self, _action, stream_num=-1):
		if stream_num > -1:
			edit_mode = True
		else:
			edit_mode = False
		# Prompt user for playlist name:
		dialog = ui.dialog(title=None, parent=self.window, flags=gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT, buttons=(gtk.STOCK_CANCEL, gtk.RESPONSE_REJECT, gtk.STOCK_OK, gtk.RESPONSE_ACCEPT), role="streamsNew")
		if edit_mode:
			dialog.set_title(_("Edit Stream"))
		else:
			dialog.set_title(_("New Stream"))
		hbox = gtk.HBox()
		namelabel = ui.label(text=_('Stream name:'))
		hbox.pack_start(namelabel, False, False, 5)
		nameentry = ui.entry()
		if edit_mode:
			nameentry.set_text(self.config.stream_names[stream_num])
		hbox.pack_start(nameentry, True, True, 5)
		hbox2 = gtk.HBox()
		urllabel = ui.label(text=_('Stream URL:'))
		hbox2.pack_start(urllabel, False, False, 5)
		urlentry = ui.entry()
		if edit_mode:
			urlentry.set_text(self.config.stream_uris[stream_num])
		hbox2.pack_start(urlentry, True, True, 5)
		ui.set_widths_equal([namelabel, urllabel])
		dialog.vbox.pack_start(hbox)
		dialog.vbox.pack_start(hbox2)
		ui.show(dialog.vbox)
		response = dialog.run()
		if response == gtk.RESPONSE_ACCEPT:
			name = nameentry.get_text()
			uri = urlentry.get_text()
			if len(name.decode('utf-8')) > 0 and len(uri.decode('utf-8')) > 0:
				# Make sure this stream name doesn't already exit:
				i = 0
				for item in self.config.stream_names:
					# Prevent a name collision in edit_mode..
					if not edit_mode or (edit_mode and i != stream_num):
						if item == name:
							dialog.destroy()
							if ui.show_msg(self.window, _("A stream with this name already exists. Would you like to replace it?"), _("New Stream"), 'newStreamError', gtk.BUTTONS_YES_NO) == gtk.RESPONSE_YES:
								# Pop existing stream:
								self.config.stream_names.pop(i)
								self.config.stream_uris.pop(i)
							else:
								return
					i = i + 1
				if edit_mode:
					self.config.stream_names.pop(stream_num)
					self.config.stream_uris.pop(stream_num)
				self.config.stream_names.append(name)
				self.config.stream_uris.append(uri)
				self.populate()
				self.settings_save()
		dialog.destroy()
示例#3
0
	def widgets_initialize(self, info_scrollwindow):

		vert_spacing = 1
		horiz_spacing = 2
		margin = 5
		outter_hbox = gtk.HBox()
		outter_vbox = gtk.VBox()

		# Song info
		info_song = ui.expander(markup="<b>" + _("Song Info") + "</b>", expand=self.config.info_song_expanded, can_focus=False)
		info_song.connect("activate", self.info_expanded, "song")
		inner_hbox = gtk.HBox()

		inner_hbox.pack_start(self.info_imagebox, False, False, horiz_spacing)

		self.info_tagbox = gtk.VBox()

		labels_left = []
		self.info_type = {}
		self.info_labels = []
		self.info_boxes_in_more = []
		labels_type = ['title', 'artist', 'album', 'date', 'track', 'genre', 'file', 'bitrate']
		labels_text = [_("Title"), _("Artist"), _("Album"), _("Date"), _("Track"), _("Genre"), _("File"), _("Bitrate")]
		labels_link = [False, True, True, False, False, False, False, False]
		labels_tooltip = ["", _("Launch artist in Wikipedia"), _("Launch album in Wikipedia"), "", "", "", "", ""]
		labels_in_more = [False, False, False, False, False, False, True, True]
		for i in range(len(labels_text)):
			self.info_type[labels_text[i]] = i
			tmphbox = gtk.HBox()
			if labels_in_more[i]:
				self.info_boxes_in_more += [tmphbox]
			tmplabel = ui.label(markup="<b>" + labels_text[i] + ":</b>", y=0)
			if i == 0:
				self.info_left_label = tmplabel
			if not labels_link[i]:
				tmplabel2 = ui.label(wrap=True, y=0, select=True)
			else:
				# Using set_selectable overrides the hover cursor that sonata
				# tries to set for the links, and I can't figure out how to
				# stop that. So we'll disable set_selectable for these two
				# labels until it's figured out.
				tmplabel2 = ui.label(wrap=True, y=0, select=False)
			if labels_link[i]:
				tmpevbox = ui.eventbox(add=tmplabel2)
				self.info_apply_link_signals(tmpevbox, labels_type[i], labels_tooltip[i])
			tmphbox.pack_start(tmplabel, False, False, horiz_spacing)
			if labels_link[i]:
				tmphbox.pack_start(tmpevbox, False, False, horiz_spacing)
			else:
				tmphbox.pack_start(tmplabel2, False, False, horiz_spacing)
			self.info_labels += [tmplabel2]
			labels_left += [tmplabel]
			self.info_tagbox.pack_start(tmphbox, False, False, vert_spacing)
		ui.set_widths_equal(labels_left)
		
		mischbox = gtk.HBox()
		self.info_morelabel = ui.label(y=0)
		moreevbox = ui.eventbox(add=self.info_morelabel)
		self.info_apply_link_signals(moreevbox, 'more', _("Toggle extra tags"))
		self.info_editlabel = ui.label(y=0)
		editevbox = ui.eventbox(add=self.info_editlabel)
		self.info_apply_link_signals(editevbox, 'edit', _("Edit song tags"))
		mischbox.pack_start(moreevbox, False, False, horiz_spacing)
		mischbox.pack_start(editevbox, False, False, horiz_spacing)

		self.info_tagbox.pack_start(mischbox, False, False, vert_spacing)
		inner_hbox.pack_start(self.info_tagbox, False, False, horiz_spacing)
		info_song.add(inner_hbox)
		outter_vbox.pack_start(info_song, False, False, margin)
		
		# Lyrics
		self.info_lyrics = ui.expander(markup="<b>" + _("Lyrics") + "</b>", expand=self.config.info_lyrics_expanded, can_focus=False)
		self.info_lyrics.connect("activate", self.info_expanded, "lyrics")
		lyricsbox = gtk.VBox()
		lyricsbox_top = gtk.HBox()
		self.lyricsText = ui.label(markup=" ", y=0, select=True, wrap=True)
		lyricsbox_top.pack_start(self.lyricsText, True, True, horiz_spacing)
		lyricsbox.pack_start(lyricsbox_top, True, True, vert_spacing)
		lyricsbox_bottom = gtk.HBox()
		self.info_searchlabel = ui.label(y=0)
		self.info_editlyricslabel = ui.label(y=0)
		searchevbox = ui.eventbox(add=self.info_searchlabel)
		editlyricsevbox = ui.eventbox(add=self.info_editlyricslabel)
		self.info_apply_link_signals(searchevbox, 'search', _("Search Lyricwiki.org for lyrics"))
		self.info_apply_link_signals(editlyricsevbox, 'editlyrics', _("Edit lyrics at Lyricwiki.org"))
		lyricsbox_bottom.pack_start(searchevbox, False, False, horiz_spacing)
		lyricsbox_bottom.pack_start(editlyricsevbox, False, False, horiz_spacing)
		lyricsbox.pack_start(lyricsbox_bottom, False, False, vert_spacing)
		self.info_lyrics.add(lyricsbox)
		outter_vbox.pack_start(self.info_lyrics, False, False, margin)
		
		# Album info
		info_album = ui.expander(markup="<b>" + _("Album Info") + "</b>", expand=self.config.info_album_expanded, can_focus=False)
		info_album.connect("activate", self.info_expanded, "album")
		albumbox = gtk.VBox()
		albumbox_top = gtk.HBox()
		self.albumText = ui.label(markup=" ", y=0, select=True, wrap=True)
		albumbox_top.pack_start(self.albumText, False, False, horiz_spacing)
		albumbox.pack_start(albumbox_top, False, False, vert_spacing)
		info_album.add(albumbox)
		outter_vbox.pack_start(info_album, False, False, margin)
		
		# Finish..
		if not self.config.show_lyrics:
			ui.hide(self.info_lyrics)
		if not self.config.show_covers:
			ui.hide(self.info_imagebox)
		# self.config.info_song_more will be overridden on on_link_click, so
		# store it in a temporary var..
		temp = self.config.info_song_more
		self.on_link_click(moreevbox, None, 'more')
		self.config.info_song_more = temp
		if self.config.info_song_more:
			self.on_link_click(moreevbox, None, 'more')
		outter_hbox.pack_start(outter_vbox, False, False, margin)
		info_scrollwindow.add_with_viewport(outter_hbox)
    def on_prefs_real(self, parent_window, popuptimes, as_imported, as_import,
                      as_init, as_reauth, trayicon_available, trayicon_in_use,
                      reconnect, renotify, reinfofile, prefs_notif_toggled,
                      prefs_stylized_toggled, prefs_art_toggled,
                      prefs_playback_toggled, prefs_progress_toggled,
                      prefs_statusbar_toggled, prefs_lyrics_toggled,
                      prefs_trayicon_toggled, prefs_window_response):
        """Display the preferences dialog"""
        self.window = parent_window
        self.as_imported = as_imported
        self.as_import = as_import
        self.as_init = as_init
        self.as_reauth = as_reauth
        self.reconnect = reconnect
        self.renotify = renotify
        self.reinfofile = reinfofile

        prefswindow = ui.dialog(title=_("Preferences"),
                                parent=self.window,
                                flags=gtk.DIALOG_DESTROY_WITH_PARENT,
                                role='preferences',
                                resizable=False,
                                separator=False)
        hbox = gtk.HBox()
        prefsnotebook = gtk.Notebook()
        # MPD tab
        mpdlabel = ui.label(markup='<b>' + _('MPD Connection') + '</b>', y=1)
        controlbox = gtk.HBox()
        profiles = ui.combo()
        add_profile = ui.button(img=ui.image(stock=gtk.STOCK_ADD))
        remove_profile = ui.button(img=ui.image(stock=gtk.STOCK_REMOVE))
        self.prefs_populate_profile_combo(profiles, self.profile_num,
                                          remove_profile)
        controlbox.pack_start(profiles, False, False, 2)
        controlbox.pack_start(remove_profile, False, False, 2)
        controlbox.pack_start(add_profile, False, False, 2)
        namebox = gtk.HBox()
        namelabel = ui.label(text=_("Name") + ":")
        namebox.pack_start(namelabel, False, False, 0)
        nameentry = ui.entry()
        namebox.pack_start(nameentry, True, True, 10)
        hostbox = gtk.HBox()
        hostlabel = ui.label(text=_("Host") + ":")
        hostbox.pack_start(hostlabel, False, False, 0)
        hostentry = ui.entry()
        hostbox.pack_start(hostentry, True, True, 10)
        portbox = gtk.HBox()
        portlabel = ui.label(text=_("Port") + ":")
        portbox.pack_start(portlabel, False, False, 0)
        portentry = ui.entry()
        portbox.pack_start(portentry, True, True, 10)
        dirbox = gtk.HBox()
        dirlabel = ui.label(text=_("Music dir") + ":")
        dirbox.pack_start(dirlabel, False, False, 0)
        direntry = ui.entry()
        direntry.connect('changed', self.prefs_direntry_changed, profiles)
        dirbox.pack_start(direntry, True, True, 10)
        passwordbox = gtk.HBox()
        passwordlabel = ui.label(text=_("Password") + ":")
        passwordbox.pack_start(passwordlabel, False, False, 0)
        passwordentry = ui.entry(password=True)
        passwordentry.set_tooltip_text(
            _("Leave blank if no password is required."))
        passwordbox.pack_start(passwordentry, True, True, 10)
        mpd_labels = [namelabel, hostlabel, portlabel, passwordlabel, dirlabel]
        ui.set_widths_equal(mpd_labels)
        autoconnect = gtk.CheckButton(_("Autoconnect on start"))
        autoconnect.set_active(self.autoconnect)
        # Fill in entries with current profile:
        self.prefs_profile_chosen(profiles, nameentry, hostentry, portentry,
                                  passwordentry, direntry)
        # Update display if $MPD_HOST or $MPD_PORT is set:
        host, port, password = misc.mpd_env_vars()
        if host or port:
            using_mpd_env_vars = True
            if not host:
                host = ""
            if not port:
                port = ""
            if not password:
                password = ""
            hostentry.set_text(str(host))
            portentry.set_text(str(port))
            passwordentry.set_text(str(password))
            nameentry.set_text(_("Using MPD_HOST/PORT"))
            for widget in [
                    hostentry, portentry, passwordentry, nameentry, profiles,
                    add_profile, remove_profile
            ]:
                widget.set_sensitive(False)
        else:
            using_mpd_env_vars = False
            # remove_profile is properly set in populate_profile_combo:
            for widget in [
                    hostentry, portentry, passwordentry, nameentry, profiles,
                    add_profile
            ]:
                widget.set_sensitive(True)
            nameentry.connect('changed', self.prefs_nameentry_changed,
                              profiles, remove_profile)
            hostentry.connect('changed', self.prefs_hostentry_changed,
                              profiles)
            portentry.connect('changed', self.prefs_portentry_changed,
                              profiles)
            passwordentry.connect('changed', self.prefs_passwordentry_changed,
                                  profiles)
            profiles.connect('changed', self.prefs_profile_chosen, nameentry,
                             hostentry, portentry, passwordentry, direntry)
            add_profile.connect('clicked', self.prefs_add_profile, nameentry,
                                profiles, remove_profile)
            remove_profile.connect('clicked', self.prefs_remove_profile,
                                   profiles, remove_profile)
        mpd_frame = gtk.Frame()
        table = gtk.Table(6, 2, False)
        table.set_col_spacings(3)
        table.attach(ui.label(), 1, 3, 1, 2, gtk.FILL | gtk.EXPAND,
                     gtk.FILL | gtk.EXPAND, 10, 0)
        table.attach(namebox, 1, 3, 2, 3, gtk.FILL | gtk.EXPAND,
                     gtk.FILL | gtk.EXPAND, 10, 0)
        table.attach(hostbox, 1, 3, 3, 4, gtk.FILL | gtk.EXPAND,
                     gtk.FILL | gtk.EXPAND, 10, 0)
        table.attach(portbox, 1, 3, 4, 5, gtk.FILL | gtk.EXPAND,
                     gtk.FILL | gtk.EXPAND, 10, 0)
        table.attach(passwordbox, 1, 3, 5, 6, gtk.FILL | gtk.EXPAND,
                     gtk.FILL | gtk.EXPAND, 10, 0)
        table.attach(dirbox, 1, 3, 6, 7, gtk.FILL | gtk.EXPAND,
                     gtk.FILL | gtk.EXPAND, 10, 0)
        table.attach(ui.label(), 1, 3, 7, 8, gtk.FILL | gtk.EXPAND,
                     gtk.FILL | gtk.EXPAND, 10, 0)
        mpd_frame.add(table)
        mpd_frame.set_label_widget(controlbox)
        mpd_table = gtk.Table(9, 2, False)
        mpd_table.set_col_spacings(3)
        mpd_table.attach(ui.label(), 1, 3, 1, 2, gtk.FILL | gtk.EXPAND,
                         gtk.FILL | gtk.EXPAND, 10, 0)
        mpd_table.attach(mpdlabel, 1, 3, 2, 3, gtk.FILL | gtk.EXPAND,
                         gtk.FILL | gtk.EXPAND, 15, 0)
        mpd_table.attach(ui.label(), 1, 3, 3, 4, gtk.FILL | gtk.EXPAND,
                         gtk.FILL | gtk.EXPAND, 10, 0)
        mpd_table.attach(mpd_frame, 1, 3, 4, 10, gtk.FILL | gtk.EXPAND,
                         gtk.FILL | gtk.EXPAND, 30, 0)
        mpd_table.attach(ui.label(), 1, 3, 10, 11, gtk.FILL | gtk.EXPAND,
                         gtk.FILL | gtk.EXPAND, 30, 0)
        mpd_table.attach(autoconnect, 1, 3, 11, 12, gtk.FILL | gtk.EXPAND,
                         gtk.FILL | gtk.EXPAND, 30, 0)
        mpd_table.attach(ui.label(), 1, 3, 12, 13, gtk.FILL | gtk.EXPAND,
                         gtk.FILL | gtk.EXPAND, 30, 0)
        mpd_table.attach(ui.label(), 1, 3, 13, 14, gtk.FILL | gtk.EXPAND,
                         gtk.FILL | gtk.EXPAND, 30, 0)
        mpd_table.attach(ui.label(), 1, 3, 14, 15, gtk.FILL | gtk.EXPAND,
                         gtk.FILL | gtk.EXPAND, 30, 0)
        # Extras tab
        if not as_imported:
            self.as_enabled = False
        as_label = ui.label(markup='<b>' + _('Extras') + '</b>')
        as_frame = gtk.Frame()
        as_frame.set_label_widget(as_label)
        as_frame.set_shadow_type(gtk.SHADOW_NONE)
        as_frame.set_border_width(15)
        as_vbox = gtk.VBox()
        as_vbox.set_border_width(15)
        as_checkbox = gtk.CheckButton(_("Enable Audioscrobbler"))
        as_checkbox.set_active(self.as_enabled)
        as_vbox.pack_start(as_checkbox, False)
        as_table = gtk.Table(2, 2)
        as_table.set_col_spacings(3)
        as_user_label = ui.label(text="          " + _("Username:"******"          " + _("Password:"******"Popup notification on song changes"))
        display_notification.set_active(self.show_notification)
        notifhbox = gtk.HBox()
        notif_blank = ui.label(x=1)
        notifhbox.pack_start(notif_blank)

        time_names = []
        for i in popuptimes:
            if i != _('Entire song'):
                time_names.append(
                    i + ' ' + gettext.ngettext('second', 'seconds', int(i)))
            else:
                time_names.append(i)
        notification_options = ui.combo(
            items=time_names,
            active=self.popup_option,
            changed_cb=self.prefs_notiftime_changed)

        notification_locs = ui.combo(
            items=self.popuplocations,
            active=self.traytips_notifications_location,
            changed_cb=self.prefs_notiflocation_changed)
        display_notification.connect('toggled', prefs_notif_toggled, notifhbox)
        notifhbox.pack_start(notification_options, False, False, 2)
        notifhbox.pack_start(notification_locs, False, False, 2)
        if not self.show_notification:
            notifhbox.set_sensitive(False)
        crossfadecheck = gtk.CheckButton(_("Enable Crossfade"))
        crossfadespin = gtk.SpinButton()
        crossfadespin.set_digits(0)
        crossfadespin.set_range(1, 30)
        crossfadespin.set_value(self.xfade)
        crossfadespin.set_numeric(True)
        crossfadespin.set_increments(1, 5)
        crossfadespin.set_size_request(70, -1)
        crossfadelabel2 = ui.label(text=_("Fade length") + ":", x=1)
        crossfadelabel3 = ui.label(text=_("sec"))
        if not self.xfade_enabled:
            crossfadespin.set_sensitive(False)
            crossfadelabel2.set_sensitive(False)
            crossfadelabel3.set_sensitive(False)
            crossfadecheck.set_active(False)
        else:
            crossfadespin.set_sensitive(True)
            crossfadelabel2.set_sensitive(True)
            crossfadelabel3.set_sensitive(True)
            crossfadecheck.set_active(True)
        crossfadebox = gtk.HBox()
        crossfadebox.pack_start(crossfadelabel2)
        crossfadebox.pack_start(crossfadespin, False, False, 5)
        crossfadebox.pack_start(crossfadelabel3, False, False, 0)
        crossfadecheck.connect('toggled', self.prefs_crossfadecheck_toggled,
                               crossfadespin, crossfadelabel2, crossfadelabel3)
        as_table.attach(as_user_label, 0, 1, 0, 1)
        as_table.attach(as_user_entry, 1, 2, 0, 1)
        as_table.attach(as_pass_label, 0, 1, 1, 2)
        as_table.attach(as_pass_entry, 1, 2, 1, 2)
        as_table.attach(ui.label(), 0, 2, 2, 3)
        as_table.attach(display_notification, 0, 2, 3, 4)
        as_table.attach(notifhbox, 0, 2, 4, 5)
        as_table.attach(ui.label(), 0, 2, 5, 6)
        as_table.attach(crossfadecheck, 0, 2, 6, 7)
        as_table.attach(crossfadebox, 0, 2, 7, 8)
        as_table.attach(ui.label(), 0, 2, 8, 9)
        as_vbox.pack_start(as_table, False)
        as_frame.add(as_vbox)
        as_checkbox.connect('toggled', self.prefs_as_enabled_toggled,
                            as_user_entry, as_pass_entry, as_user_label,
                            as_pass_label)
        if not self.as_enabled or not as_imported:
            as_user_entry.set_sensitive(False)
            as_pass_entry.set_sensitive(False)
            as_user_label.set_sensitive(False)
            as_pass_label.set_sensitive(False)
        # Display tab
        table2 = gtk.Table(7, 2, False)
        displaylabel = ui.label(markup='<b>' + _('Display') + '</b>', y=1)
        display_art_hbox = gtk.HBox()
        display_art = gtk.CheckButton(_("Enable album art"))
        display_art.set_active(self.show_covers)
        display_stylized_combo = ui.combo(items=[_("Standard"),
                                                 _("Stylized")],
                                          active=self.covers_type,
                                          changed_cb=prefs_stylized_toggled)
        display_stylized_hbox = gtk.HBox()
        display_stylized_hbox.pack_start(
            ui.label(text=_("Artwork style:"), x=1))
        display_stylized_hbox.pack_start(display_stylized_combo, False, False,
                                         5)
        display_stylized_hbox.set_sensitive(self.show_covers)
        display_art_combo = ui.combo(
            items=[_("Local only"), _("Local and remote")],
            active=self.covers_pref)
        orderart_label = ui.label(text=_("Search locations:"), x=1)
        display_art_hbox.pack_start(orderart_label)
        display_art_hbox.pack_start(display_art_combo, False, False, 5)
        display_art_hbox.set_sensitive(self.show_covers)
        display_art_location_hbox = gtk.HBox()
        display_art_location_hbox.pack_start(
            ui.label(text=_("Save art to:"), x=1))

        art_paths = ["~/.covers/"]
        for item in [
                "/cover.jpg", "/album.jpg", "/folder.jpg", "/" + _("custom")
        ]:
            art_paths.append("../" + _("file_path") + item)
        display_art_location = ui.combo(
            items=art_paths,
            active=self.art_location,
            changed_cb=self.prefs_art_location_changed)

        display_art_location_hbox.pack_start(display_art_location, False,
                                             False, 5)
        display_art_location_hbox.set_sensitive(self.show_covers)
        display_art.connect('toggled', prefs_art_toggled, display_art_hbox,
                            display_art_location_hbox, display_stylized_hbox)
        display_playback = gtk.CheckButton(_("Enable playback/volume buttons"))
        display_playback.set_active(self.show_playback)
        display_playback.connect('toggled', prefs_playback_toggled)
        display_progress = gtk.CheckButton(_("Enable progressbar"))
        display_progress.set_active(self.show_progress)
        display_progress.connect('toggled', prefs_progress_toggled)
        display_statusbar = gtk.CheckButton(_("Enable statusbar"))
        display_statusbar.set_active(self.show_statusbar)
        display_statusbar.connect('toggled', prefs_statusbar_toggled)
        display_lyrics = gtk.CheckButton(_("Enable lyrics"))
        display_lyrics.set_active(self.show_lyrics)
        display_lyrics_location_hbox = gtk.HBox()
        savelyrics_label = ui.label(text=_("Save lyrics to:"), x=1)
        display_lyrics_location_hbox.pack_start(savelyrics_label)
        display_lyrics_location = ui.combo(
            items=["~/.lyrics/", "../" + _("file_path") + "/"],
            active=self.lyrics_location,
            changed_cb=self.prefs_lyrics_location_changed)
        display_lyrics_location_hbox.pack_start(display_lyrics_location, False,
                                                False, 5)
        display_lyrics_location_hbox.set_sensitive(self.show_lyrics)
        display_lyrics.connect('toggled', prefs_lyrics_toggled,
                               display_lyrics_location_hbox)
        display_trayicon = gtk.CheckButton(_("Enable system tray icon"))
        display_trayicon.set_active(self.show_trayicon)
        display_trayicon.set_sensitive(trayicon_available)
        table2.attach(ui.label(), 1, 3, 1, 2, gtk.FILL | gtk.EXPAND,
                      gtk.FILL | gtk.EXPAND, 15, 0)
        table2.attach(displaylabel, 1, 3, 2, 3, gtk.FILL | gtk.EXPAND,
                      gtk.FILL | gtk.EXPAND, 15, 0)
        table2.attach(ui.label(), 1, 3, 3, 4, gtk.FILL | gtk.EXPAND,
                      gtk.FILL | gtk.EXPAND, 15, 0)
        table2.attach(display_playback, 1, 3, 4, 5, gtk.FILL | gtk.EXPAND,
                      gtk.FILL | gtk.EXPAND, 30, 0)
        table2.attach(display_progress, 1, 3, 5, 6, gtk.FILL | gtk.EXPAND,
                      gtk.FILL | gtk.EXPAND, 30, 0)
        table2.attach(display_statusbar, 1, 3, 6, 7, gtk.FILL | gtk.EXPAND,
                      gtk.FILL | gtk.EXPAND, 30, 0)
        table2.attach(display_trayicon, 1, 3, 7, 8, gtk.FILL | gtk.EXPAND,
                      gtk.FILL | gtk.EXPAND, 30, 0)
        table2.attach(display_lyrics, 1, 3, 8, 9, gtk.FILL | gtk.EXPAND,
                      gtk.FILL | gtk.EXPAND, 30, 0)
        table2.attach(display_lyrics_location_hbox, 1, 3, 9, 10,
                      gtk.FILL | gtk.EXPAND, gtk.FILL | gtk.EXPAND, 30, 0)
        table2.attach(display_art, 1, 3, 10, 11, gtk.FILL | gtk.EXPAND,
                      gtk.FILL | gtk.EXPAND, 30, 0)
        table2.attach(display_stylized_hbox, 1, 3, 11, 12,
                      gtk.FILL | gtk.EXPAND, gtk.FILL | gtk.EXPAND, 30, 0)
        table2.attach(display_art_hbox, 1, 3, 12, 13, gtk.FILL | gtk.EXPAND,
                      gtk.FILL | gtk.EXPAND, 30, 0)
        table2.attach(display_art_location_hbox, 1, 3, 13, 14,
                      gtk.FILL | gtk.EXPAND, gtk.FILL | gtk.EXPAND, 30, 0)
        table2.attach(ui.label(), 1, 3, 14, 15, gtk.FILL | gtk.EXPAND,
                      gtk.FILL | gtk.EXPAND, 75, 0)
        # Behavior tab
        table3 = gtk.Table()
        behaviorlabel = ui.label(markup='<b>' + _('Window Behavior') + '</b>',
                                 y=1)
        win_sticky = gtk.CheckButton(_("Show window on all workspaces"))
        win_sticky.set_active(self.sticky)
        win_ontop = gtk.CheckButton(_("Keep window above other windows"))
        win_ontop.set_active(self.ontop)
        update_start = gtk.CheckButton(_("Update MPD library on start"))
        update_start.set_active(self.update_on_start)
        update_start.set_tooltip_text(
            _("If enabled, Sonata will automatically update your MPD library when it starts up."
              ))
        exit_stop = gtk.CheckButton(_("Stop playback on exit"))
        exit_stop.set_active(self.stop_on_exit)
        exit_stop.set_tooltip_text(
            _("MPD allows playback even when the client is not open. If enabled, Sonata will behave like a more conventional music player and, instead, stop playback upon exit."
              ))
        minimize = gtk.CheckButton(
            _("Minimize to system tray on close/escape"))
        minimize.set_active(self.minimize_to_systray)
        minimize.set_tooltip_text(
            _("If enabled, closing Sonata will minimize it to the system tray. Note that it's currently impossible to detect if there actually is a system tray, so only check this if you have one."
              ))
        display_trayicon.connect('toggled', prefs_trayicon_toggled, minimize)
        minimize.set_sensitive(trayicon_in_use)
        infofilebox = gtk.HBox()
        infofile_usage = gtk.CheckButton(_("Write status file:"))
        infofile_usage.set_active(self.use_infofile)
        infofile_usage.set_tooltip_text(
            _("If enabled, Sonata will create a xmms-infopipe like file containing information about the current song. Many applications support the xmms-info file (Instant Messengers, IRC Clients...)"
              ))
        infopath_options = ui.entry(text=self.infofile_path)
        infopath_options.set_tooltip_text(
            _("If enabled, Sonata will create a xmms-infopipe like file containing information about the current song. Many applications support the xmms-info file (Instant Messengers, IRC Clients...)"
              ))
        if not self.use_infofile:
            infopath_options.set_sensitive(False)
        infofile_usage.connect('toggled', self.prefs_infofile_toggled,
                               infopath_options)
        infofilebox.pack_start(infofile_usage, False, False, 0)
        infofilebox.pack_start(infopath_options, True, True, 5)
        behaviorlabel2 = ui.label(markup='<b>' + _('Miscellaneous') + '</b>',
                                  y=1)
        table3.attach(ui.label(), 1, 3, 1, 2, gtk.FILL | gtk.EXPAND,
                      gtk.FILL | gtk.EXPAND, 15, 0)
        table3.attach(behaviorlabel, 1, 3, 2, 3, gtk.FILL | gtk.EXPAND,
                      gtk.FILL | gtk.EXPAND, 15, 0)
        table3.attach(ui.label(), 1, 3, 3, 4, gtk.FILL | gtk.EXPAND,
                      gtk.FILL | gtk.EXPAND, 15, 0)
        table3.attach(win_sticky, 1, 3, 4, 5, gtk.FILL | gtk.EXPAND,
                      gtk.FILL | gtk.EXPAND, 30, 0)
        table3.attach(win_ontop, 1, 3, 5, 6, gtk.FILL | gtk.EXPAND,
                      gtk.FILL | gtk.EXPAND, 30, 0)
        table3.attach(minimize, 1, 3, 6, 7, gtk.FILL | gtk.EXPAND,
                      gtk.FILL | gtk.EXPAND, 30, 0)
        table3.attach(ui.label(), 1, 3, 7, 8, gtk.FILL | gtk.EXPAND,
                      gtk.FILL | gtk.EXPAND, 15, 0)
        table3.attach(behaviorlabel2, 1, 3, 8, 9, gtk.FILL | gtk.EXPAND,
                      gtk.FILL | gtk.EXPAND, 15, 0)
        table3.attach(ui.label(), 1, 3, 9, 10, gtk.FILL | gtk.EXPAND,
                      gtk.FILL | gtk.EXPAND, 15, 0)
        table3.attach(update_start, 1, 3, 10, 11, gtk.FILL | gtk.EXPAND,
                      gtk.FILL | gtk.EXPAND, 30, 0)
        table3.attach(exit_stop, 1, 3, 11, 12, gtk.FILL | gtk.EXPAND,
                      gtk.FILL | gtk.EXPAND, 30, 0)
        table3.attach(infofilebox, 1, 3, 12, 13, gtk.FILL | gtk.EXPAND,
                      gtk.FILL | gtk.EXPAND, 30, 0)
        table3.attach(ui.label(), 1, 3, 13, 14, gtk.FILL | gtk.EXPAND,
                      gtk.FILL | gtk.EXPAND, 30, 0)
        table3.attach(ui.label(), 1, 3, 14, 15, gtk.FILL | gtk.EXPAND,
                      gtk.FILL | gtk.EXPAND, 30, 0)
        table3.attach(ui.label(), 1, 3, 15, 16, gtk.FILL | gtk.EXPAND,
                      gtk.FILL | gtk.EXPAND, 30, 0)
        table3.attach(ui.label(), 1, 3, 16, 17, gtk.FILL | gtk.EXPAND,
                      gtk.FILL | gtk.EXPAND, 30, 0)
        table3.attach(ui.label(), 1, 3, 17, 18, gtk.FILL | gtk.EXPAND,
                      gtk.FILL | gtk.EXPAND, 30, 0)
        table3.attach(ui.label(), 1, 3, 18, 19, gtk.FILL | gtk.EXPAND,
                      gtk.FILL | gtk.EXPAND, 30, 0)
        # Format tab
        table4 = gtk.Table(9, 2, False)
        table4.set_col_spacings(3)
        formatlabel = ui.label(markup='<b>' + _('Song Formatting') + '</b>',
                               y=1)
        currentformatbox = gtk.HBox()
        currentlabel = ui.label(text=_("Current playlist:"))
        currentoptions = ui.entry(text=self.currentformat)
        currentformatbox.pack_start(currentlabel, False, False, 0)
        currentformatbox.pack_start(currentoptions, False, False, 10)
        libraryformatbox = gtk.HBox()
        librarylabel = ui.label(text=_("Library:"))
        libraryoptions = ui.entry(text=self.libraryformat)
        libraryformatbox.pack_start(librarylabel, False, False, 0)
        libraryformatbox.pack_start(libraryoptions, False, False, 10)
        titleformatbox = gtk.HBox()
        titlelabel = ui.label(text=_("Window title:"))
        titleoptions = ui.entry(text=self.titleformat)
        titleoptions.set_text(self.titleformat)
        titleformatbox.pack_start(titlelabel, False, False, 0)
        titleformatbox.pack_start(titleoptions, False, False, 10)
        currsongformatbox1 = gtk.HBox()
        currsonglabel1 = ui.label(text=_("Current song line 1:"))
        currsongoptions1 = ui.entry(text=self.currsongformat1)
        currsongformatbox1.pack_start(currsonglabel1, False, False, 0)
        currsongformatbox1.pack_start(currsongoptions1, False, False, 10)
        currsongformatbox2 = gtk.HBox()
        currsonglabel2 = ui.label(text=_("Current song line 2:"))
        currsongoptions2 = ui.entry(text=self.currsongformat2)
        currsongformatbox2.pack_start(currsonglabel2, False, False, 0)
        currsongformatbox2.pack_start(currsongoptions2, False, False, 10)
        formatlabels = [
            currentlabel, librarylabel, titlelabel, currsonglabel1,
            currsonglabel2
        ]
        for label in formatlabels:
            label.set_alignment(0, 0.5)
        ui.set_widths_equal(formatlabels)
        availableheading = ui.label(markup='<small>' + _('Available options') +
                                    ':</small>',
                                    y=0)
        availablevbox = gtk.VBox()
        availableformatbox = gtk.HBox()
        availableformatting = ui.label(
            markup='<small><span font_family="Monospace">%A</span> - ' +
            _('Artist name') + '\n<span font_family="Monospace">%B</span> - ' +
            _('Album name') + '\n<span font_family="Monospace">%T</span> - ' +
            _('Track name') + '\n<span font_family="Monospace">%N</span> - ' +
            _('Track number') +
            '\n<span font_family="Monospace">%D</span> - ' + _('Disc Number') +
            '\n<span font_family="Monospace">%Y</span> - ' + _('Year') +
            '</small>',
            y=0)
        availableformatting2 = ui.label(
            markup='<small><span font_family="Monospace">%G</span> - ' +
            _('Genre') + '\n<span font_family="Monospace">%F</span> - ' +
            _('File name') + '\n<span font_family="Monospace">%S</span> - ' +
            _('Stream name') + '\n<span font_family="Monospace">%L</span> - ' +
            _('Song length') + '\n<span font_family="Monospace">%E</span> - ' +
            _('Elapsed time (title only)') + '</small>',
            y=0)
        availableformatbox.pack_start(availableformatting)
        availableformatbox.pack_start(availableformatting2)
        availablevbox.pack_start(availableformatbox, False, False, 0)
        additionalinfo = ui.label(
            markup='<small>{ } - ' +
            _('Info displayed only if all enclosed tags are defined') + '\n' +
            '| - ' + _('Creates columns in the current playlist') + '</small>',
            y=0)
        availablevbox.pack_start(additionalinfo, False, False, 4)
        table4.attach(ui.label(), 1, 3, 1, 2, gtk.FILL | gtk.EXPAND,
                      gtk.FILL | gtk.EXPAND, 15, 0)
        table4.attach(formatlabel, 1, 3, 2, 3, gtk.FILL | gtk.EXPAND,
                      gtk.FILL | gtk.EXPAND, 15, 0)
        table4.attach(ui.label(), 1, 3, 3, 4, gtk.FILL | gtk.EXPAND,
                      gtk.FILL | gtk.EXPAND, 15, 0)
        table4.attach(currentformatbox, 1, 3, 4, 5, gtk.FILL | gtk.EXPAND,
                      gtk.FILL | gtk.EXPAND, 30, 0)
        table4.attach(libraryformatbox, 1, 3, 5, 6, gtk.FILL | gtk.EXPAND,
                      gtk.FILL | gtk.EXPAND, 30, 0)
        table4.attach(titleformatbox, 1, 3, 6, 7, gtk.FILL | gtk.EXPAND,
                      gtk.FILL | gtk.EXPAND, 30, 0)
        table4.attach(currsongformatbox1, 1, 3, 7, 8, gtk.FILL | gtk.EXPAND,
                      gtk.FILL | gtk.EXPAND, 30, 0)
        table4.attach(currsongformatbox2, 1, 3, 8, 9, gtk.FILL | gtk.EXPAND,
                      gtk.FILL | gtk.EXPAND, 30, 0)
        table4.attach(ui.label(), 1, 3, 9, 10, gtk.FILL | gtk.EXPAND,
                      gtk.FILL | gtk.EXPAND, 30, 0)
        table4.attach(availableheading, 1, 3, 10, 11, gtk.FILL | gtk.EXPAND,
                      gtk.FILL | gtk.EXPAND, 30, 0)
        table4.attach(availablevbox, 1, 3, 11, 12, gtk.FILL | gtk.EXPAND,
                      gtk.FILL | gtk.EXPAND, 45, 0)
        table4.attach(ui.label(), 1, 3, 12, 13, gtk.FILL | gtk.EXPAND,
                      gtk.FILL | gtk.EXPAND, 30, 0)
        table_names = [[_("_MPD"), mpd_table], [_("_Display"), table2],
                       [_("_Behavior"), table3], [_("_Format"), table4],
                       [_("_Extras"), as_frame]]
        for table_name in table_names:
            tmplabel = ui.label(textmn=table_name[0])
            prefsnotebook.append_page(table_name[1], tmplabel)
        hbox.pack_start(prefsnotebook, False, False, 10)
        prefswindow.vbox.pack_start(hbox, False, False, 10)
        close_button = prefswindow.add_button(gtk.STOCK_CLOSE,
                                              gtk.RESPONSE_CLOSE)
        prefswindow.show_all()
        close_button.grab_focus()
        prefswindow.connect('response', prefs_window_response, prefsnotebook,
                            exit_stop, win_ontop, display_art_combo,
                            win_sticky, direntry, minimize, update_start,
                            autoconnect, currentoptions, libraryoptions,
                            titleoptions, currsongoptions1, currsongoptions2,
                            crossfadecheck, crossfadespin, infopath_options,
                            using_mpd_env_vars, self.prev_host, self.prev_port,
                            self.prev_password)
        # Save previous connection properties to determine if we should try to
        # connect to MPD after prefs are closed:
        self.prev_host = self.host[self.profile_num]
        self.prev_port = self.port[self.profile_num]
        self.prev_password = self.password[self.profile_num]
        prefswindow.show()
示例#5
0
    def widgets_initialize(self, info_scrollwindow):

        vert_spacing = 1
        horiz_spacing = 2
        margin = 5
        outter_hbox = gtk.HBox()
        outter_vbox = gtk.VBox()

        # Song info
        info_song = ui.expander(markup="<b>" + _("Song Info") + "</b>",
                                expand=self.config.info_song_expanded,
                                can_focus=False)
        info_song.connect("activate", self.info_expanded, "song")
        inner_hbox = gtk.HBox()

        inner_hbox.pack_start(self.info_imagebox, False, False, horiz_spacing)

        self.info_tagbox = gtk.VBox()

        labels_left = []
        self.info_type = {}
        self.info_labels = []
        self.info_boxes_in_more = []
        labels_type = [
            'title', 'artist', 'album', 'date', 'track', 'genre', 'file',
            'bitrate'
        ]
        labels_text = [
            _("Title"),
            _("Artist"),
            _("Album"),
            _("Date"),
            _("Track"),
            _("Genre"),
            _("File"),
            _("Bitrate")
        ]
        labels_link = [False, True, True, False, False, False, False, False]
        labels_tooltip = [
            "",
            _("Launch artist in Wikipedia"),
            _("Launch album in Wikipedia"), "", "", "", "", ""
        ]
        labels_in_more = [False, False, False, False, False, False, True, True]
        for i in range(len(labels_text)):
            self.info_type[labels_text[i]] = i
            tmphbox = gtk.HBox()
            if labels_in_more[i]:
                self.info_boxes_in_more += [tmphbox]
            tmplabel = ui.label(markup="<b>" + labels_text[i] + ":</b>", y=0)
            if i == 0:
                self.info_left_label = tmplabel
            if not labels_link[i]:
                tmplabel2 = ui.label(wrap=True, y=0, select=True)
            else:
                # Using set_selectable overrides the hover cursor that sonata
                # tries to set for the links, and I can't figure out how to
                # stop that. So we'll disable set_selectable for these two
                # labels until it's figured out.
                tmplabel2 = ui.label(wrap=True, y=0, select=False)
            if labels_link[i]:
                tmpevbox = ui.eventbox(add=tmplabel2)
                self.info_apply_link_signals(tmpevbox, labels_type[i],
                                             labels_tooltip[i])
            tmphbox.pack_start(tmplabel, False, False, horiz_spacing)
            if labels_link[i]:
                tmphbox.pack_start(tmpevbox, False, False, horiz_spacing)
            else:
                tmphbox.pack_start(tmplabel2, False, False, horiz_spacing)
            self.info_labels += [tmplabel2]
            labels_left += [tmplabel]
            self.info_tagbox.pack_start(tmphbox, False, False, vert_spacing)
        ui.set_widths_equal(labels_left)

        mischbox = gtk.HBox()
        self.info_morelabel = ui.label(y=0)
        moreevbox = ui.eventbox(add=self.info_morelabel)
        self.info_apply_link_signals(moreevbox, 'more', _("Toggle extra tags"))
        self.info_editlabel = ui.label(y=0)
        editevbox = ui.eventbox(add=self.info_editlabel)
        self.info_apply_link_signals(editevbox, 'edit', _("Edit song tags"))
        mischbox.pack_start(moreevbox, False, False, horiz_spacing)
        mischbox.pack_start(editevbox, False, False, horiz_spacing)

        self.info_tagbox.pack_start(mischbox, False, False, vert_spacing)
        inner_hbox.pack_start(self.info_tagbox, False, False, horiz_spacing)
        info_song.add(inner_hbox)
        outter_vbox.pack_start(info_song, False, False, margin)

        # Lyrics
        self.info_lyrics = ui.expander(markup="<b>" + _("Lyrics") + "</b>",
                                       expand=self.config.info_lyrics_expanded,
                                       can_focus=False)
        self.info_lyrics.connect("activate", self.info_expanded, "lyrics")
        lyricsbox = gtk.VBox()
        lyricsbox_top = gtk.HBox()
        self.lyricsText = ui.label(markup=" ", y=0, select=True, wrap=True)
        lyricsbox_top.pack_start(self.lyricsText, True, True, horiz_spacing)
        lyricsbox.pack_start(lyricsbox_top, True, True, vert_spacing)
        lyricsbox_bottom = gtk.HBox()
        self.info_searchlabel = ui.label(y=0)
        self.info_editlyricslabel = ui.label(y=0)
        searchevbox = ui.eventbox(add=self.info_searchlabel)
        editlyricsevbox = ui.eventbox(add=self.info_editlyricslabel)
        self.info_apply_link_signals(searchevbox, 'search',
                                     _("Search Lyricwiki.org for lyrics"))
        self.info_apply_link_signals(editlyricsevbox, 'editlyrics',
                                     _("Edit lyrics at Lyricwiki.org"))
        lyricsbox_bottom.pack_start(searchevbox, False, False, horiz_spacing)
        lyricsbox_bottom.pack_start(editlyricsevbox, False, False,
                                    horiz_spacing)
        lyricsbox.pack_start(lyricsbox_bottom, False, False, vert_spacing)
        self.info_lyrics.add(lyricsbox)
        outter_vbox.pack_start(self.info_lyrics, False, False, margin)

        # Album info
        info_album = ui.expander(markup="<b>" + _("Album Info") + "</b>",
                                 expand=self.config.info_album_expanded,
                                 can_focus=False)
        info_album.connect("activate", self.info_expanded, "album")
        albumbox = gtk.VBox()
        albumbox_top = gtk.HBox()
        self.albumText = ui.label(markup=" ", y=0, select=True, wrap=True)
        albumbox_top.pack_start(self.albumText, False, False, horiz_spacing)
        albumbox.pack_start(albumbox_top, False, False, vert_spacing)
        info_album.add(albumbox)
        outter_vbox.pack_start(info_album, False, False, margin)

        # Finish..
        if not self.config.show_lyrics:
            ui.hide(self.info_lyrics)
        if not self.config.show_covers:
            ui.hide(self.info_imagebox)
        # self.config.info_song_more will be overridden on on_link_click, so
        # store it in a temporary var..
        temp = self.config.info_song_more
        self.on_link_click(moreevbox, None, 'more')
        self.config.info_song_more = temp
        if self.config.info_song_more:
            self.on_link_click(moreevbox, None, 'more')
        outter_hbox.pack_start(outter_vbox, False, False, margin)
        info_scrollwindow.add_with_viewport(outter_hbox)
示例#6
0
    def on_tags_edit(self, files, temp_mpdpaths, music_dir):
        """Display the editing dialog"""
        # Try loading module
        global tagpy
        if tagpy is None:
            try:
                import tagpy
            except ImportError:
                ui.show_msg(
                    self.window,
                    _("Taglib and/or tagpy not found, tag editing support disabled."
                      ),
                    _("Edit Tags"),
                    'editTagsError',
                    gtk.BUTTONS_CLOSE,
                    response_cb=ui.dialog_destroy)
                ui.change_cursor(None)
                return
            # Set default tag encoding to utf8.. fixes some reported bugs.
            import tagpy.id3v2 as id3v2
            id3v2.FrameFactory.instance().setDefaultTextEncoding(
                tagpy.StringType.UTF8)

        # Make sure tagpy is at least 0.91
        if hasattr(tagpy.Tag.title, '__call__'):
            ui.show_msg(
                self.window,
                _("Tagpy version < 0.91. Please upgrade to a newer version, tag editing support disabled."
                  ),
                _("Edit Tags"),
                'editTagsError',
                gtk.BUTTONS_CLOSE,
                response_cb=ui.dialog_destroy)
            ui.change_cursor(None)
            return

        if not os.path.isdir(misc.file_from_utf8(music_dir)):
            ui.show_msg(
                self.window,
                _("The path") + " " + music_dir + " " +
                _("does not exist. Please specify a valid music directory in preferences."
                  ),
                _("Edit Tags"),
                'editTagsError',
                gtk.BUTTONS_CLOSE,
                response_cb=ui.dialog_destroy)
            ui.change_cursor(None)
            return

# XXX file list was created here

        if len(files) == 0:
            ui.change_cursor(None)
            return

        # Initialize:
        self.tagnum = -1

        tags = [{
            'title': '',
            'artist': '',
            'album': '',
            'year': '',
            'track': '',
            'genre': '',
            'comment': '',
            'title-changed': False,
            'artist-changed': False,
            'album-changed': False,
            'year-changed': False,
            'track-changed': False,
            'genre-changed': False,
            'comment-changed': False,
            'fullpath': misc.file_from_utf8(filename),
            'mpdpath': path
        } for filename, path in zip(files, temp_mpdpaths)]

        if not os.path.exists(tags[0]['fullpath']):
            ui.change_cursor(None)
            ui.show_msg(
                self.window,
                _("File ") + "\"" + tags[0]['fullpath'] + "\"" +
                _(" not found. Please specify a valid music directory in preferences."
                  ),
                _("Edit Tags"),
                'editTagsError',
                gtk.BUTTONS_CLOSE,
                response_cb=ui.dialog_destroy)
            return
        if not self.tags_next_tag(tags):
            ui.change_cursor(None)
            ui.show_msg(self.window,
                        _("No music files with editable tags found."),
                        _("Edit Tags"),
                        'editTagsError',
                        gtk.BUTTONS_CLOSE,
                        response_cb=ui.dialog_destroy)
            return
        editwindow = ui.dialog(parent=self.window,
                               flags=gtk.DIALOG_MODAL,
                               role='editTags',
                               resizable=False,
                               separator=False)
        editwindow.set_size_request(375, -1)
        table = gtk.Table(9, 2, False)
        table.set_row_spacings(2)
        self.filelabel = ui.label(select=True, wrap=True)
        filehbox = gtk.HBox()
        sonataicon = ui.image(stock='sonata', stocksize=gtk.ICON_SIZE_DND, x=1)
        expandbutton = ui.button(" ")
        self.set_expandbutton_state(expandbutton)
        expandvbox = gtk.VBox()
        expandvbox.pack_start(ui.label(), True, True)
        expandvbox.pack_start(expandbutton, False, False)
        expandvbox.pack_start(ui.label(), True, True)
        expandbutton.connect('clicked', self.toggle_path)
        blanklabel = ui.label(w=5, h=12)
        filehbox.pack_start(sonataicon, False, False, 2)
        filehbox.pack_start(self.filelabel, True, True, 2)
        filehbox.pack_start(expandvbox, False, False, 2)
        filehbox.pack_start(blanklabel, False, False, 2)

        titlelabel, titleentry, titlebutton, titlehbox = self._create_label_entry_button_hbox(
            _("Title"))
        artistlabel, artistentry, artistbutton, artisthbox = self._create_label_entry_button_hbox(
            _("Artist"))
        albumlabel, albumentry, albumbutton, albumhbox = self._create_label_entry_button_hbox(
            _("Album"))
        yearlabel, yearentry, yearbutton, yearhbox = self._create_label_entry_button_hbox(
            _("Year"))
        yearentry.set_size_request(50, -1)
        tracklabel, trackentry, trackbutton, trackhbox = self._create_label_entry_button_hbox(
            "  " + _("Track"), True)
        trackentry.set_size_request(50, -1)
        yearandtrackhbox = gtk.HBox()
        yearandtrackhbox.pack_start(yearhbox, True, True, 0)
        yearandtrackhbox.pack_start(trackhbox, True, True, 0)

        yearentry.connect("insert_text", self.tags_win_entry_constraint, True)
        trackentry.connect("insert_text", self.tags_win_entry_constraint,
                           False)

        genrelabel = ui.label(text=_("Genre") + ":", x=1)
        genrecombo = ui.comboentry(items=self.tags_win_genres(), wrap=2)
        genreentry = genrecombo.get_child()
        genrehbox = gtk.HBox()
        genrebutton = ui.button()
        genrebuttonvbox = self.tags_win_create_apply_all_button(
            genrebutton, genreentry)
        genrehbox.pack_start(genrelabel, False, False, 2)
        genrehbox.pack_start(genrecombo, True, True, 2)
        genrehbox.pack_start(genrebuttonvbox, False, False, 2)

        commentlabel, commententry, commentbutton, commenthbox = self._create_label_entry_button_hbox(
            _("Comment"))

        ui.set_widths_equal([
            titlelabel, artistlabel, albumlabel, yearlabel, genrelabel,
            commentlabel, sonataicon
        ])
        genrecombo.set_size_request(-1, titleentry.size_request()[1])
        tablewidgets = [
            ui.label(), filehbox,
            ui.label(), titlehbox, artisthbox, albumhbox, yearandtrackhbox,
            genrehbox, commenthbox,
            ui.label()
        ]
        for i, widget in enumerate(tablewidgets):
            table.attach(widget, 1, 2, i + 1, i + 2, gtk.FILL | gtk.EXPAND,
                         gtk.FILL | gtk.EXPAND, 2, 0)
        editwindow.vbox.pack_start(table)
        saveall_button = None
        if len(files) > 1:
            # Only show save all button if more than one song being edited.
            saveall_button = ui.button(text=_("Save _All"))
            editwindow.action_area.pack_start(saveall_button)
        editwindow.add_button(gtk.STOCK_CANCEL, gtk.RESPONSE_REJECT)
        editwindow.add_button(gtk.STOCK_SAVE, gtk.RESPONSE_ACCEPT)
        editwindow.connect('delete_event', self.tags_win_hide, tags)
        entries = [
            titleentry, artistentry, albumentry, yearentry, trackentry,
            genreentry, commententry
        ]
        buttons = [
            titlebutton, artistbutton, albumbutton, yearbutton, trackbutton,
            genrebutton, commentbutton
        ]
        entries_names = [
            "title", "artist", "album", "year", "track", "genre", "comment"
        ]
        editwindow.connect('response', self.tags_win_response, tags, entries,
                           entries_names)
        if saveall_button:
            saveall_button.connect('clicked', self.tags_win_save_all,
                                   editwindow, tags, entries, entries_names)

        for button, name, entry in zip(buttons, entries_names, entries):
            entry.connect('changed', self.tags_win_entry_changed)
            button.connect('clicked', self.tags_win_apply_all, name, tags,
                           entry)

        self.tags_win_update(editwindow, tags, entries, entries_names)
        ui.change_cursor(None)
        self.filelabel.set_size_request(
            editwindow.size_request()[0] - titlelabel.size_request()[0] - 70,
            -1)
        editwindow.show_all()
示例#7
0
    def on_tags_edit(self, files, temp_mpdpaths, music_dir):
        """Display the editing dialog"""
        # Try loading module
        global tagpy
        if tagpy is None:
            try:
                import tagpy
            except ImportError:
                ui.show_msg(self.window, _("Taglib and/or tagpy not found, tag editing support disabled."), _("Edit Tags"), 'editTagsError', gtk.BUTTONS_CLOSE, response_cb=ui.dialog_destroy)
                ui.change_cursor(None)
                return
            # Set default tag encoding to utf8.. fixes some reported bugs.
            import tagpy.id3v2 as id3v2
            id3v2.FrameFactory.instance().setDefaultTextEncoding(tagpy.StringType.UTF8)

        # Make sure tagpy is at least 0.91
        if hasattr(tagpy.Tag.title, '__call__'):
            ui.show_msg(self.window, _("Tagpy version < 0.91. Please upgrade to a newer version, tag editing support disabled."), _("Edit Tags"), 'editTagsError', gtk.BUTTONS_CLOSE, response_cb=ui.dialog_destroy)
            ui.change_cursor(None)
            return

        if not os.path.isdir(misc.file_from_utf8(music_dir)):
            ui.show_msg(self.window, _("The path %s does not exist. Please specify a valid music directory in preferences.") % music_dir, _("Edit Tags"), 'editTagsError', gtk.BUTTONS_CLOSE, response_cb=ui.dialog_destroy)
            ui.change_cursor(None)
            return

                # XXX file list was created here

        if len(files) == 0:
            ui.change_cursor(None)
            return

        # Initialize:
        self.tagnum = -1

        tags = [{'title':'', 'artist':'', 'album':'', 'year':'', 'track':'',
             'genre':'', 'comment':'', 'title-changed':False,
             'artist-changed':False, 'album-changed':False,
             'year-changed':False, 'track-changed':False,
             'genre-changed':False, 'comment-changed':False,
             'fullpath':misc.file_from_utf8(filename),
             'mpdpath':path}
            for filename, path in zip(files, temp_mpdpaths)]

        if not os.path.exists(tags[0]['fullpath']):
            ui.change_cursor(None)
            ui.show_msg(self.window, _("File '%s' not found. Please specify a valid music directory in preferences.") % tags[0]['fullpath'], _("Edit Tags"), 'editTagsError', gtk.BUTTONS_CLOSE, response_cb=ui.dialog_destroy)
            return
        if not self.tags_next_tag(tags):
            ui.change_cursor(None)
            ui.show_msg(self.window, _("No music files with editable tags found."), _("Edit Tags"), 'editTagsError', gtk.BUTTONS_CLOSE, response_cb=ui.dialog_destroy)
            return
        editwindow = ui.dialog(parent=self.window, flags=gtk.DIALOG_MODAL, role='editTags', resizable=False, separator=False)
        editwindow.set_size_request(375, -1)
        table = gtk.Table(9, 2, False)
        table.set_row_spacings(2)
        self.filelabel = ui.label(select=True, wrap=True)
        filehbox = gtk.HBox()
        sonataicon = ui.image(stock='sonata', stocksize=gtk.ICON_SIZE_DND, x=1)
        expandbutton = ui.button(" ")
        self.set_expandbutton_state(expandbutton)
        expandvbox = gtk.VBox()
        expandvbox.pack_start(ui.label(), True, True)
        expandvbox.pack_start(expandbutton, False, False)
        expandvbox.pack_start(ui.label(), True, True)
        expandbutton.connect('clicked', self.toggle_path)
        blanklabel = ui.label(w=5, h=12)
        filehbox.pack_start(sonataicon, False, False, 2)
        filehbox.pack_start(self.filelabel, True, True, 2)
        filehbox.pack_start(expandvbox, False, False, 2)
        filehbox.pack_start(blanklabel, False, False, 2)

        titlelabel, titleentry, titlebutton, titlehbox = self._create_label_entry_button_hbox(_("Title:"))
        artistlabel, artistentry, artistbutton, artisthbox = self._create_label_entry_button_hbox(_("Artist:"))
        albumlabel, albumentry, albumbutton, albumhbox = self._create_label_entry_button_hbox(_("Album:"))
        yearlabel, yearentry, yearbutton, yearhbox = self._create_label_entry_button_hbox(_("Year:"))
        yearentry.set_size_request(50,-1)
        tracklabel, trackentry, trackbutton, trackhbox = self._create_label_entry_button_hbox("  " + _("Track:"), True)
        trackentry.set_size_request(50,-1)
        yearandtrackhbox = gtk.HBox()
        yearandtrackhbox.pack_start(yearhbox, True, True, 0)
        yearandtrackhbox.pack_start(trackhbox, True, True, 0)

        yearentry.connect("insert_text", self.tags_win_entry_constraint, True)
        trackentry.connect("insert_text", self.tags_win_entry_constraint, False)

        genrelabel = ui.label(text=_("Genre:"), x=1)
        genrecombo = ui.comboentry(items=self.tags_win_genres(), wrap=2)
        genreentry = genrecombo.get_child()
        genrehbox = gtk.HBox()
        genrebutton = ui.button()
        genrebuttonvbox = self.tags_win_create_apply_all_button(genrebutton,
                                                                genreentry)
        genrehbox.pack_start(genrelabel, False, False, 2)
        genrehbox.pack_start(genrecombo, True, True, 2)
        genrehbox.pack_start(genrebuttonvbox, False, False, 2)

        commentlabel, commententry, commentbutton, commenthbox = self._create_label_entry_button_hbox(_("Comment:"))

        ui.set_widths_equal([titlelabel, artistlabel, albumlabel, yearlabel, genrelabel, commentlabel, sonataicon])
        genrecombo.set_size_request(-1, titleentry.size_request()[1])
        tablewidgets = [ui.label(), filehbox, ui.label(), titlehbox, artisthbox, albumhbox, yearandtrackhbox, genrehbox, commenthbox, ui.label()]
        for i, widget in enumerate(tablewidgets):
            table.attach(widget, 1, 2, i+1, i+2, gtk.FILL|gtk.EXPAND, gtk.FILL|gtk.EXPAND, 2, 0)
        editwindow.vbox.pack_start(table)
        saveall_button = None
        if len(files) > 1:
            # Only show save all button if more than one song being edited.
            saveall_button = ui.button(text=_("Save _All"))
            editwindow.action_area.pack_start(saveall_button)
        editwindow.add_button(gtk.STOCK_CANCEL, gtk.RESPONSE_REJECT)
        editwindow.add_button(gtk.STOCK_SAVE, gtk.RESPONSE_ACCEPT)
        editwindow.connect('delete_event', self.tags_win_hide, tags)
        entries = [titleentry, artistentry, albumentry, yearentry, trackentry, genreentry, commententry]
        buttons = [titlebutton, artistbutton, albumbutton, yearbutton, trackbutton, genrebutton, commentbutton]
        entries_names = ["title", "artist", "album", "year", "track", "genre", "comment"]
        editwindow.connect('response', self.tags_win_response, tags, entries, entries_names)
        if saveall_button:
            saveall_button.connect('clicked', self.tags_win_save_all, editwindow, tags, entries, entries_names)

        for button, name, entry in zip(buttons, entries_names, entries):
            entry.connect('changed', self.tags_win_entry_changed)
            button.connect('clicked', self.tags_win_apply_all, name, tags, entry)

        self.tags_win_update(editwindow, tags, entries, entries_names)
        ui.change_cursor(None)
        self.filelabel.set_size_request(editwindow.size_request()[0] - titlelabel.size_request()[0] - 70, -1)
        editwindow.show_all()
	def on_prefs_real(self, parent_window, popuptimes, as_imported, as_import, as_init, as_reauth, trayicon_available, trayicon_in_use, reconnect, renotify, reinfofile, prefs_notif_toggled, prefs_stylized_toggled, prefs_art_toggled, prefs_playback_toggled, prefs_progress_toggled, prefs_statusbar_toggled, prefs_lyrics_toggled, prefs_trayicon_toggled, prefs_window_response):
		"""Display the preferences dialog"""
		self.window = parent_window
		self.as_imported = as_imported
		self.as_import = as_import
		self.as_init = as_init
		self.as_reauth = as_reauth
		self.reconnect = reconnect
		self.renotify = renotify
		self.reinfofile = reinfofile

		prefswindow = ui.dialog(title=_("Preferences"), parent=self.window, flags=gtk.DIALOG_DESTROY_WITH_PARENT, role='preferences', resizable=False, separator=False)
		hbox = gtk.HBox()
		prefsnotebook = gtk.Notebook()
		# MPD tab
		mpdlabel = ui.label(markup='<b>' + _('MPD Connection') + '</b>', y=1)
		controlbox = gtk.HBox()
		profiles = ui.combo()
		add_profile = ui.button(img=ui.image(stock=gtk.STOCK_ADD))
		remove_profile = ui.button(img=ui.image(stock=gtk.STOCK_REMOVE))
		self.prefs_populate_profile_combo(profiles, self.profile_num, remove_profile)
		controlbox.pack_start(profiles, False, False, 2)
		controlbox.pack_start(remove_profile, False, False, 2) 
		controlbox.pack_start(add_profile, False, False, 2)
		namebox = gtk.HBox()
		namelabel = ui.label(text=_("Name") + ":")
		namebox.pack_start(namelabel, False, False, 0)
		nameentry = ui.entry()
		namebox.pack_start(nameentry, True, True, 10)
		hostbox = gtk.HBox()
		hostlabel = ui.label(text=_("Host") + ":")
		hostbox.pack_start(hostlabel, False, False, 0)
		hostentry = ui.entry()
		hostbox.pack_start(hostentry, True, True, 10)
		portbox = gtk.HBox()
		portlabel = ui.label(text=_("Port") + ":")
		portbox.pack_start(portlabel, False, False, 0)
		portentry = ui.entry()
		portbox.pack_start(portentry, True, True, 10)
		dirbox = gtk.HBox()
		dirlabel = ui.label(text=_("Music dir") + ":")
		dirbox.pack_start(dirlabel, False, False, 0)
		direntry = ui.entry()
		direntry.connect('changed', self.prefs_direntry_changed, profiles)
		dirbox.pack_start(direntry, True, True, 10)
		passwordbox = gtk.HBox()
		passwordlabel = ui.label(text=_("Password") + ":")
		passwordbox.pack_start(passwordlabel, False, False, 0)
		passwordentry = ui.entry(password=True)
		passwordentry.set_tooltip_text(_("Leave blank if no password is required."))
		passwordbox.pack_start(passwordentry, True, True, 10)
		mpd_labels = [namelabel, hostlabel, portlabel, passwordlabel, dirlabel]
		ui.set_widths_equal(mpd_labels)
		autoconnect = gtk.CheckButton(_("Autoconnect on start"))
		autoconnect.set_active(self.autoconnect)
		# Fill in entries with current profile:
		self.prefs_profile_chosen(profiles, nameentry, hostentry, portentry, passwordentry, direntry)
		# Update display if $MPD_HOST or $MPD_PORT is set:
		host, port, password = misc.mpd_env_vars()
		if host or port:
			using_mpd_env_vars = True
			if not host:
				host = ""
			if not port:
				port = ""
			if not password:
				password = ""
			hostentry.set_text(str(host))
			portentry.set_text(str(port))
			passwordentry.set_text(str(password))
			nameentry.set_text(_("Using MPD_HOST/PORT"))
			for widget in [hostentry, portentry, passwordentry, nameentry, profiles, add_profile, remove_profile]:
				widget.set_sensitive(False)
		else:
			using_mpd_env_vars = False
			# remove_profile is properly set in populate_profile_combo:
			for widget in [hostentry, portentry, passwordentry, nameentry, profiles, add_profile]: 
				widget.set_sensitive(True)
			nameentry.connect('changed', self.prefs_nameentry_changed, profiles, remove_profile)
			hostentry.connect('changed', self.prefs_hostentry_changed, profiles)
			portentry.connect('changed', self.prefs_portentry_changed, profiles)
			passwordentry.connect('changed', self.prefs_passwordentry_changed, profiles)
			profiles.connect('changed', self.prefs_profile_chosen, nameentry, hostentry, portentry, passwordentry, direntry)
			add_profile.connect('clicked', self.prefs_add_profile, nameentry, profiles, remove_profile)
			remove_profile.connect('clicked', self.prefs_remove_profile, profiles, remove_profile)
		mpd_frame = gtk.Frame()
		table = gtk.Table(6, 2, False)
		table.set_col_spacings(3)
		table.attach(ui.label(), 1, 3, 1, 2, gtk.FILL|gtk.EXPAND, gtk.FILL|gtk.EXPAND, 10, 0)
		table.attach(namebox, 1, 3, 2, 3, gtk.FILL|gtk.EXPAND, gtk.FILL|gtk.EXPAND, 10, 0)
		table.attach(hostbox, 1, 3, 3, 4, gtk.FILL|gtk.EXPAND, gtk.FILL|gtk.EXPAND, 10, 0)
		table.attach(portbox, 1, 3, 4, 5, gtk.FILL|gtk.EXPAND, gtk.FILL|gtk.EXPAND, 10, 0)
		table.attach(passwordbox, 1, 3, 5, 6, gtk.FILL|gtk.EXPAND, gtk.FILL|gtk.EXPAND, 10, 0)
		table.attach(dirbox, 1, 3, 6, 7, gtk.FILL|gtk.EXPAND, gtk.FILL|gtk.EXPAND, 10, 0)
		table.attach(ui.label(), 1, 3, 7, 8, gtk.FILL|gtk.EXPAND, gtk.FILL|gtk.EXPAND, 10, 0)
		mpd_frame.add(table)
		mpd_frame.set_label_widget(controlbox)
		mpd_table = gtk.Table(9, 2, False)
		mpd_table.set_col_spacings(3)
		mpd_table.attach(ui.label(), 1, 3, 1, 2, gtk.FILL|gtk.EXPAND, gtk.FILL|gtk.EXPAND, 10, 0)
		mpd_table.attach(mpdlabel, 1, 3, 2, 3, gtk.FILL|gtk.EXPAND, gtk.FILL|gtk.EXPAND, 15, 0)
		mpd_table.attach(ui.label(), 1, 3, 3, 4, gtk.FILL|gtk.EXPAND, gtk.FILL|gtk.EXPAND, 10, 0)
		mpd_table.attach(mpd_frame, 1, 3, 4, 10, gtk.FILL|gtk.EXPAND, gtk.FILL|gtk.EXPAND, 30, 0)
		mpd_table.attach(ui.label(), 1, 3, 10, 11, gtk.FILL|gtk.EXPAND, gtk.FILL|gtk.EXPAND, 30, 0)
		mpd_table.attach(autoconnect, 1, 3, 11, 12, gtk.FILL|gtk.EXPAND, gtk.FILL|gtk.EXPAND, 30, 0)
		mpd_table.attach(ui.label(), 1, 3, 12, 13, gtk.FILL|gtk.EXPAND, gtk.FILL|gtk.EXPAND, 30, 0)
		mpd_table.attach(ui.label(), 1, 3, 13, 14, gtk.FILL|gtk.EXPAND, gtk.FILL|gtk.EXPAND, 30, 0)
		mpd_table.attach(ui.label(), 1, 3, 14, 15, gtk.FILL|gtk.EXPAND, gtk.FILL|gtk.EXPAND, 30, 0)
		# Extras tab
		if not as_imported:
			self.as_enabled = False
		as_label = ui.label(markup='<b>' + _('Extras') + '</b>')
		as_frame = gtk.Frame()
		as_frame.set_label_widget(as_label)
		as_frame.set_shadow_type(gtk.SHADOW_NONE)
		as_frame.set_border_width(15)
		as_vbox = gtk.VBox()
		as_vbox.set_border_width(15)
		as_checkbox = gtk.CheckButton(_("Enable Audioscrobbler"))
		as_checkbox.set_active(self.as_enabled)
		as_vbox.pack_start(as_checkbox, False)
		as_table = gtk.Table(2, 2)
		as_table.set_col_spacings(3)
		as_user_label = ui.label(text="          " + _("Username:"******"          " + _("Password:"******"Popup notification on song changes"))
		display_notification.set_active(self.show_notification)
		notifhbox = gtk.HBox()
		notif_blank = ui.label(x=1)
		notifhbox.pack_start(notif_blank)

		time_names = []
		for i in popuptimes:
			if i != _('Entire song'):
				time_names.append(i + ' ' + gettext.ngettext('second', 'seconds', int(i)))
			else:
				time_names.append(i)
		notification_options = ui.combo(items=time_names, active=self.popup_option, changed_cb=self.prefs_notiftime_changed)

		notification_locs = ui.combo(items=self.popuplocations, active=self.traytips_notifications_location, changed_cb=self.prefs_notiflocation_changed)
		display_notification.connect('toggled', prefs_notif_toggled, notifhbox)
		notifhbox.pack_start(notification_options, False, False, 2)
		notifhbox.pack_start(notification_locs, False, False, 2)
		if not self.show_notification:
			notifhbox.set_sensitive(False)
		crossfadecheck = gtk.CheckButton(_("Enable Crossfade"))
		crossfadespin = gtk.SpinButton()
		crossfadespin.set_digits(0)
		crossfadespin.set_range(1, 30)
		crossfadespin.set_value(self.xfade)
		crossfadespin.set_numeric(True)
		crossfadespin.set_increments(1, 5)
		crossfadespin.set_size_request(70, -1)
		crossfadelabel2 = ui.label(text=_("Fade length") + ":", x=1)
		crossfadelabel3 = ui.label(text=_("sec"))
		if not self.xfade_enabled:
			crossfadespin.set_sensitive(False)
			crossfadelabel2.set_sensitive(False)
			crossfadelabel3.set_sensitive(False)
			crossfadecheck.set_active(False)
		else:
			crossfadespin.set_sensitive(True)
			crossfadelabel2.set_sensitive(True)
			crossfadelabel3.set_sensitive(True)
			crossfadecheck.set_active(True)
		crossfadebox = gtk.HBox()
		crossfadebox.pack_start(crossfadelabel2)
		crossfadebox.pack_start(crossfadespin, False, False, 5)
		crossfadebox.pack_start(crossfadelabel3, False, False, 0)
		crossfadecheck.connect('toggled', self.prefs_crossfadecheck_toggled, crossfadespin, crossfadelabel2, crossfadelabel3)
		as_table.attach(as_user_label, 0, 1, 0, 1)
		as_table.attach(as_user_entry, 1, 2, 0, 1)
		as_table.attach(as_pass_label, 0, 1, 1, 2)
		as_table.attach(as_pass_entry, 1, 2, 1, 2)
		as_table.attach(ui.label(), 0, 2, 2, 3)
		as_table.attach(display_notification, 0, 2, 3, 4)
		as_table.attach(notifhbox, 0, 2, 4, 5)
		as_table.attach(ui.label(), 0, 2, 5, 6)
		as_table.attach(crossfadecheck, 0, 2, 6, 7)
		as_table.attach(crossfadebox, 0, 2, 7, 8)
		as_table.attach(ui.label(), 0, 2, 8, 9)
		as_vbox.pack_start(as_table, False)
		as_frame.add(as_vbox)
		as_checkbox.connect('toggled', self.prefs_as_enabled_toggled, as_user_entry, as_pass_entry, as_user_label, as_pass_label)
		if not self.as_enabled or not as_imported:
			as_user_entry.set_sensitive(False)
			as_pass_entry.set_sensitive(False)
			as_user_label.set_sensitive(False)
			as_pass_label.set_sensitive(False)
		# Display tab
		table2 = gtk.Table(7, 2, False)
		displaylabel = ui.label(markup='<b>' + _('Display') + '</b>', y=1)
		display_art_hbox = gtk.HBox()
		display_art = gtk.CheckButton(_("Enable album art"))
		display_art.set_active(self.show_covers)
		display_stylized_combo = ui.combo(items=[_("Standard"), _("Stylized")], active=self.covers_type, changed_cb=prefs_stylized_toggled)
		display_stylized_hbox = gtk.HBox()
		display_stylized_hbox.pack_start(ui.label(text=_("Artwork style:"), x=1))
		display_stylized_hbox.pack_start(display_stylized_combo, False, False, 5)
		display_stylized_hbox.set_sensitive(self.show_covers)
		display_art_combo = ui.combo(items=[_("Local only"), _("Local and remote")], active=self.covers_pref)
		orderart_label = ui.label(text=_("Search locations:"), x=1)
		display_art_hbox.pack_start(orderart_label)
		display_art_hbox.pack_start(display_art_combo, False, False, 5)
		display_art_hbox.set_sensitive(self.show_covers)
		display_art_location_hbox = gtk.HBox()
		display_art_location_hbox.pack_start(ui.label(text=_("Save art to:"), x=1))

		art_paths = ["~/.covers/"]
		for item in ["/cover.jpg", "/album.jpg", "/folder.jpg", "/" + _("custom")]:
			art_paths.append("../" + _("file_path") + item)
		display_art_location = ui.combo(items=art_paths, active=self.art_location, changed_cb=self.prefs_art_location_changed)

		display_art_location_hbox.pack_start(display_art_location, False, False, 5)
		display_art_location_hbox.set_sensitive(self.show_covers)
		display_art.connect('toggled', prefs_art_toggled, display_art_hbox, display_art_location_hbox, display_stylized_hbox)
		display_playback = gtk.CheckButton(_("Enable playback/volume buttons"))
		display_playback.set_active(self.show_playback)
		display_playback.connect('toggled', prefs_playback_toggled)
		display_progress = gtk.CheckButton(_("Enable progressbar"))
		display_progress.set_active(self.show_progress)
		display_progress.connect('toggled', prefs_progress_toggled)
		display_statusbar = gtk.CheckButton(_("Enable statusbar"))
		display_statusbar.set_active(self.show_statusbar)
		display_statusbar.connect('toggled', prefs_statusbar_toggled)
		display_lyrics = gtk.CheckButton(_("Enable lyrics"))
		display_lyrics.set_active(self.show_lyrics)
		display_lyrics_location_hbox = gtk.HBox()
		savelyrics_label = ui.label(text=_("Save lyrics to:"), x=1)
		display_lyrics_location_hbox.pack_start(savelyrics_label)
		display_lyrics_location = ui.combo(items=["~/.lyrics/", "../" + _("file_path") + "/"], active=self.lyrics_location, changed_cb=self.prefs_lyrics_location_changed)
		display_lyrics_location_hbox.pack_start(display_lyrics_location, False, False, 5)
		display_lyrics_location_hbox.set_sensitive(self.show_lyrics)
		display_lyrics.connect('toggled', prefs_lyrics_toggled, display_lyrics_location_hbox)
		display_trayicon = gtk.CheckButton(_("Enable system tray icon"))
		display_trayicon.set_active(self.show_trayicon)
		display_trayicon.set_sensitive(trayicon_available)
		table2.attach(ui.label(), 1, 3, 1, 2, gtk.FILL|gtk.EXPAND, gtk.FILL|gtk.EXPAND, 15, 0)
		table2.attach(displaylabel, 1, 3, 2, 3, gtk.FILL|gtk.EXPAND, gtk.FILL|gtk.EXPAND, 15, 0)
		table2.attach(ui.label(), 1, 3, 3, 4, gtk.FILL|gtk.EXPAND, gtk.FILL|gtk.EXPAND, 15, 0)
		table2.attach(display_playback, 1, 3, 4, 5, gtk.FILL|gtk.EXPAND, gtk.FILL|gtk.EXPAND, 30, 0)
		table2.attach(display_progress, 1, 3, 5, 6, gtk.FILL|gtk.EXPAND, gtk.FILL|gtk.EXPAND, 30, 0)
		table2.attach(display_statusbar, 1, 3, 6, 7, gtk.FILL|gtk.EXPAND, gtk.FILL|gtk.EXPAND, 30, 0)
		table2.attach(display_trayicon, 1, 3, 7, 8, gtk.FILL|gtk.EXPAND, gtk.FILL|gtk.EXPAND, 30, 0)
		table2.attach(display_lyrics, 1, 3, 8, 9, gtk.FILL|gtk.EXPAND, gtk.FILL|gtk.EXPAND, 30, 0)
		table2.attach(display_lyrics_location_hbox, 1, 3, 9, 10, gtk.FILL|gtk.EXPAND, gtk.FILL|gtk.EXPAND, 30, 0)
		table2.attach(display_art, 1, 3, 10, 11, gtk.FILL|gtk.EXPAND, gtk.FILL|gtk.EXPAND, 30, 0)
		table2.attach(display_stylized_hbox, 1, 3, 11, 12, gtk.FILL|gtk.EXPAND, gtk.FILL|gtk.EXPAND, 30, 0)
		table2.attach(display_art_hbox, 1, 3, 12, 13, gtk.FILL|gtk.EXPAND, gtk.FILL|gtk.EXPAND, 30, 0)
		table2.attach(display_art_location_hbox, 1, 3, 13, 14, gtk.FILL|gtk.EXPAND, gtk.FILL|gtk.EXPAND, 30, 0)
		table2.attach(ui.label(), 1, 3, 14, 15, gtk.FILL|gtk.EXPAND, gtk.FILL|gtk.EXPAND, 75, 0)
		# Behavior tab
		table3 = gtk.Table()
		behaviorlabel = ui.label(markup='<b>' + _('Window Behavior') + '</b>', y=1)
		win_sticky = gtk.CheckButton(_("Show window on all workspaces"))
		win_sticky.set_active(self.sticky)
		win_ontop = gtk.CheckButton(_("Keep window above other windows"))
		win_ontop.set_active(self.ontop)
		update_start = gtk.CheckButton(_("Update MPD library on start"))
		update_start.set_active(self.update_on_start)
		update_start.set_tooltip_text(_("If enabled, Sonata will automatically update your MPD library when it starts up."))
		exit_stop = gtk.CheckButton(_("Stop playback on exit"))
		exit_stop.set_active(self.stop_on_exit)
		exit_stop.set_tooltip_text(_("MPD allows playback even when the client is not open. If enabled, Sonata will behave like a more conventional music player and, instead, stop playback upon exit."))
		minimize = gtk.CheckButton(_("Minimize to system tray on close/escape"))
		minimize.set_active(self.minimize_to_systray)
		minimize.set_tooltip_text(_("If enabled, closing Sonata will minimize it to the system tray. Note that it's currently impossible to detect if there actually is a system tray, so only check this if you have one."))
		display_trayicon.connect('toggled', prefs_trayicon_toggled, minimize)
		minimize.set_sensitive(trayicon_in_use)
		infofilebox = gtk.HBox()
		infofile_usage = gtk.CheckButton(_("Write status file:"))
		infofile_usage.set_active(self.use_infofile)
		infofile_usage.set_tooltip_text(_("If enabled, Sonata will create a xmms-infopipe like file containing information about the current song. Many applications support the xmms-info file (Instant Messengers, IRC Clients...)"))
		infopath_options = ui.entry(text=self.infofile_path)
		infopath_options.set_tooltip_text(_("If enabled, Sonata will create a xmms-infopipe like file containing information about the current song. Many applications support the xmms-info file (Instant Messengers, IRC Clients...)"))
		if not self.use_infofile:
			infopath_options.set_sensitive(False)
		infofile_usage.connect('toggled', self.prefs_infofile_toggled, infopath_options)
		infofilebox.pack_start(infofile_usage, False, False, 0)
		infofilebox.pack_start(infopath_options, True, True, 5)
		behaviorlabel2 = ui.label(markup='<b>' + _('Miscellaneous') + '</b>', y=1)
		table3.attach(ui.label(), 1, 3, 1, 2, gtk.FILL|gtk.EXPAND, gtk.FILL|gtk.EXPAND, 15, 0)
		table3.attach(behaviorlabel, 1, 3, 2, 3, gtk.FILL|gtk.EXPAND, gtk.FILL|gtk.EXPAND, 15, 0)
		table3.attach(ui.label(), 1, 3, 3, 4, gtk.FILL|gtk.EXPAND, gtk.FILL|gtk.EXPAND, 15, 0)
		table3.attach(win_sticky, 1, 3, 4, 5, gtk.FILL|gtk.EXPAND, gtk.FILL|gtk.EXPAND, 30, 0)
		table3.attach(win_ontop, 1, 3, 5, 6, gtk.FILL|gtk.EXPAND, gtk.FILL|gtk.EXPAND, 30, 0)
		table3.attach(minimize, 1, 3, 6, 7, gtk.FILL|gtk.EXPAND, gtk.FILL|gtk.EXPAND, 30, 0)
		table3.attach(ui.label(), 1, 3, 7, 8, gtk.FILL|gtk.EXPAND, gtk.FILL|gtk.EXPAND, 15, 0)
		table3.attach(behaviorlabel2, 1, 3, 8, 9, gtk.FILL|gtk.EXPAND, gtk.FILL|gtk.EXPAND, 15, 0)
		table3.attach(ui.label(), 1, 3, 9, 10, gtk.FILL|gtk.EXPAND, gtk.FILL|gtk.EXPAND, 15, 0)
		table3.attach(update_start, 1, 3, 10, 11, gtk.FILL|gtk.EXPAND, gtk.FILL|gtk.EXPAND, 30, 0)
		table3.attach(exit_stop, 1, 3, 11, 12, gtk.FILL|gtk.EXPAND, gtk.FILL|gtk.EXPAND, 30, 0)
		table3.attach(infofilebox, 1, 3, 12, 13, gtk.FILL|gtk.EXPAND, gtk.FILL|gtk.EXPAND, 30, 0)
		table3.attach(ui.label(), 1, 3, 13, 14, gtk.FILL|gtk.EXPAND, gtk.FILL|gtk.EXPAND, 30, 0)
		table3.attach(ui.label(), 1, 3, 14, 15, gtk.FILL|gtk.EXPAND, gtk.FILL|gtk.EXPAND, 30, 0)
		table3.attach(ui.label(), 1, 3, 15, 16, gtk.FILL|gtk.EXPAND, gtk.FILL|gtk.EXPAND, 30, 0)
		table3.attach(ui.label(), 1, 3, 16, 17, gtk.FILL|gtk.EXPAND, gtk.FILL|gtk.EXPAND, 30, 0)
		table3.attach(ui.label(), 1, 3, 17, 18, gtk.FILL|gtk.EXPAND, gtk.FILL|gtk.EXPAND, 30, 0)
		table3.attach(ui.label(), 1, 3, 18, 19, gtk.FILL|gtk.EXPAND, gtk.FILL|gtk.EXPAND, 30, 0)
		# Format tab
		table4 = gtk.Table(9, 2, False)
		table4.set_col_spacings(3)
		formatlabel = ui.label(markup='<b>' + _('Song Formatting') + '</b>', y=1)
		currentformatbox = gtk.HBox()
		currentlabel = ui.label(text=_("Current playlist:"))
		currentoptions = ui.entry(text=self.currentformat)
		currentformatbox.pack_start(currentlabel, False, False, 0)
		currentformatbox.pack_start(currentoptions, False, False, 10)
		libraryformatbox = gtk.HBox()
		librarylabel = ui.label(text=_("Library:"))
		libraryoptions = ui.entry(text=self.libraryformat)
		libraryformatbox.pack_start(librarylabel, False, False, 0)
		libraryformatbox.pack_start(libraryoptions, False, False, 10)
		titleformatbox = gtk.HBox()
		titlelabel = ui.label(text=_("Window title:"))
		titleoptions = ui.entry(text=self.titleformat)
		titleoptions.set_text(self.titleformat)
		titleformatbox.pack_start(titlelabel, False, False, 0)
		titleformatbox.pack_start(titleoptions, False, False, 10)
		currsongformatbox1 = gtk.HBox()
		currsonglabel1 = ui.label(text=_("Current song line 1:"))
		currsongoptions1 = ui.entry(text=self.currsongformat1)
		currsongformatbox1.pack_start(currsonglabel1, False, False, 0)
		currsongformatbox1.pack_start(currsongoptions1, False, False, 10)
		currsongformatbox2 = gtk.HBox()
		currsonglabel2 = ui.label(text=_("Current song line 2:"))
		currsongoptions2 = ui.entry(text=self.currsongformat2)
		currsongformatbox2.pack_start(currsonglabel2, False, False, 0)
		currsongformatbox2.pack_start(currsongoptions2, False, False, 10)
		formatlabels = [currentlabel, librarylabel, titlelabel, currsonglabel1, currsonglabel2]
		for label in formatlabels:
			label.set_alignment(0, 0.5)
		ui.set_widths_equal(formatlabels)
		availableheading = ui.label(markup='<small>' + _('Available options') + ':</small>', y=0)
		availablevbox = gtk.VBox()
		availableformatbox = gtk.HBox()
		availableformatting = ui.label(markup='<small><span font_family="Monospace">%A</span> - ' + _('Artist name') + '\n<span font_family="Monospace">%B</span> - ' + _('Album name') + '\n<span font_family="Monospace">%T</span> - ' + _('Track name') + '\n<span font_family="Monospace">%N</span> - ' + _('Track number') + '\n<span font_family="Monospace">%D</span> - ' + _('Disc Number') + '\n<span font_family="Monospace">%Y</span> - ' + _('Year') + '</small>', y=0)
		availableformatting2 = ui.label(markup='<small><span font_family="Monospace">%G</span> - ' + _('Genre') + '\n<span font_family="Monospace">%F</span> - ' + _('File name') + '\n<span font_family="Monospace">%S</span> - ' + _('Stream name') + '\n<span font_family="Monospace">%L</span> - ' + _('Song length') + '\n<span font_family="Monospace">%E</span> - ' + _('Elapsed time (title only)') + '</small>', y=0)
		availableformatbox.pack_start(availableformatting)
		availableformatbox.pack_start(availableformatting2)
		availablevbox.pack_start(availableformatbox, False, False, 0)
		additionalinfo = ui.label(markup='<small>{ } - ' + _('Info displayed only if all enclosed tags are defined') + '\n' + '| - ' + _('Creates columns in the current playlist') + '</small>', y=0)
		availablevbox.pack_start(additionalinfo, False, False, 4)
		table4.attach(ui.label(), 1, 3, 1, 2, gtk.FILL|gtk.EXPAND, gtk.FILL|gtk.EXPAND, 15, 0)
		table4.attach(formatlabel, 1, 3, 2, 3, gtk.FILL|gtk.EXPAND, gtk.FILL|gtk.EXPAND, 15, 0)
		table4.attach(ui.label(), 1, 3, 3, 4, gtk.FILL|gtk.EXPAND, gtk.FILL|gtk.EXPAND, 15, 0)
		table4.attach(currentformatbox, 1, 3, 4, 5, gtk.FILL|gtk.EXPAND, gtk.FILL|gtk.EXPAND, 30, 0)
		table4.attach(libraryformatbox, 1, 3, 5, 6, gtk.FILL|gtk.EXPAND, gtk.FILL|gtk.EXPAND, 30, 0)
		table4.attach(titleformatbox, 1, 3, 6, 7, gtk.FILL|gtk.EXPAND, gtk.FILL|gtk.EXPAND, 30, 0)
		table4.attach(currsongformatbox1, 1, 3, 7, 8, gtk.FILL|gtk.EXPAND, gtk.FILL|gtk.EXPAND, 30, 0)
		table4.attach(currsongformatbox2, 1, 3, 8, 9, gtk.FILL|gtk.EXPAND, gtk.FILL|gtk.EXPAND, 30, 0)
		table4.attach(ui.label(), 1, 3, 9, 10, gtk.FILL|gtk.EXPAND, gtk.FILL|gtk.EXPAND, 30, 0)
		table4.attach(availableheading, 1, 3, 10, 11, gtk.FILL|gtk.EXPAND, gtk.FILL|gtk.EXPAND, 30, 0)
		table4.attach(availablevbox, 1, 3, 11, 12, gtk.FILL|gtk.EXPAND, gtk.FILL|gtk.EXPAND, 45, 0)
		table4.attach(ui.label(), 1, 3, 12, 13, gtk.FILL|gtk.EXPAND, gtk.FILL|gtk.EXPAND, 30, 0)
		table_names = [[_("_MPD"), mpd_table], 
		               [_("_Display"), table2], 
		               [_("_Behavior"), table3], 
		               [_("_Format"), table4], 
		               [_("_Extras"), as_frame]]
		for table_name in table_names:
			tmplabel = ui.label(textmn=table_name[0])
			prefsnotebook.append_page(table_name[1], tmplabel)
		hbox.pack_start(prefsnotebook, False, False, 10)
		prefswindow.vbox.pack_start(hbox, False, False, 10)
		close_button = prefswindow.add_button(gtk.STOCK_CLOSE, gtk.RESPONSE_CLOSE)
		prefswindow.show_all()
		close_button.grab_focus()
		prefswindow.connect('response', prefs_window_response, prefsnotebook, exit_stop, win_ontop, display_art_combo, win_sticky, direntry, minimize, update_start, autoconnect, currentoptions, libraryoptions, titleoptions, currsongoptions1, currsongoptions2, crossfadecheck, crossfadespin, infopath_options, using_mpd_env_vars, self.prev_host, self.prev_port, self.prev_password)
		# Save previous connection properties to determine if we should try to
		# connect to MPD after prefs are closed:
		self.prev_host = self.host[self.profile_num]
		self.prev_port = self.port[self.profile_num]
		self.prev_password = self.password[self.profile_num]
		prefswindow.show()
示例#9
0
    def widgets_initialize(self, info_scrollwindow):

        vert_spacing = 1
        horiz_spacing = 2
        margin = 5
        outter_hbox = gtk.HBox()
        outter_vbox = gtk.VBox()

        # Song info
        info_song = ui.expander(
            markup="<b>" + _("Song Info") + "</b>", expand=self.config.info_song_expanded, can_focus=False
        )
        info_song.connect("activate", self.info_expanded, "song")
        inner_hbox = gtk.HBox()

        inner_hbox.pack_start(self.info_imagebox, False, False, horiz_spacing)

        self.info_tagbox = gtk.VBox()

        labels_left = []
        self.info_type = {}
        self.info_labels = []
        self.info_boxes_in_more = []
        labels = [
            (_("Title"), "title", False, "", False),
            (_("Artist"), "artist", True, _("Launch artist in Wikipedia"), False),
            (_("Album"), "album", True, _("Launch album in Wikipedia"), False),
            (_("Date"), "date", False, "", False),
            (_("Track"), "track", False, "", False),
            (_("Genre"), "genre", False, "", False),
            (_("File"), "file", False, "", True),
            (_("Bitrate"), "bitrate", False, "", True),
        ]

        for i, (text, name, link, tooltip, in_more) in enumerate(labels):
            self.info_type[name] = i
            tmphbox = gtk.HBox()
            if in_more:
                self.info_boxes_in_more += [tmphbox]
            tmplabel = ui.label(markup="<b>%s:</b>" % text, y=0)
            if i == 0:
                self.info_left_label = tmplabel
                # Using set_selectable overrides the hover cursor that
                # sonata tries to set for the links, and I can't figure
                # out how to stop that. So we'll disable set_selectable
                # for those labels until it's figured out.
            tmplabel2 = ui.label(wrap=True, y=0, select=not link)
            if link:
                tmpevbox = ui.eventbox(add=tmplabel2)
                self.info_apply_link_signals(tmpevbox, name, tooltip)
            tmphbox.pack_start(tmplabel, False, False, horiz_spacing)
            to_pack = tmpevbox if link else tmplabel2
            tmphbox.pack_start(to_pack, False, False, horiz_spacing)
            self.info_labels += [tmplabel2]
            labels_left += [tmplabel]
            self.info_tagbox.pack_start(tmphbox, False, False, vert_spacing)
        ui.set_widths_equal(labels_left)

        mischbox = gtk.HBox()
        self.info_morelabel = ui.label(y=0)
        moreevbox = ui.eventbox(add=self.info_morelabel)
        self.info_apply_link_signals(moreevbox, "more", _("Toggle extra tags"))
        self.info_editlabel = ui.label(y=0)
        editevbox = ui.eventbox(add=self.info_editlabel)
        self.info_apply_link_signals(editevbox, "edit", _("Edit song tags"))
        mischbox.pack_start(moreevbox, False, False, horiz_spacing)
        mischbox.pack_start(editevbox, False, False, horiz_spacing)

        self.info_tagbox.pack_start(mischbox, False, False, vert_spacing)
        inner_hbox.pack_start(self.info_tagbox, False, False, horiz_spacing)
        info_song.add(inner_hbox)
        outter_vbox.pack_start(info_song, False, False, margin)

        # Lyrics
        self.info_lyrics = ui.expander(
            markup="<b>" + _("Lyrics") + "</b>", expand=self.config.info_lyrics_expanded, can_focus=False
        )
        self.info_lyrics.connect("activate", self.info_expanded, "lyrics")
        lyricsbox = gtk.VBox()
        lyricsbox_top = gtk.HBox()
        self.lyricsText = ui.label(markup=" ", y=0, select=True, wrap=True)
        lyricsbox_top.pack_start(self.lyricsText, True, True, horiz_spacing)
        lyricsbox.pack_start(lyricsbox_top, True, True, vert_spacing)
        lyricsbox_bottom = gtk.HBox()
        self.info_searchlabel = ui.label(y=0)
        self.info_editlyricslabel = ui.label(y=0)
        searchevbox = ui.eventbox(add=self.info_searchlabel)
        editlyricsevbox = ui.eventbox(add=self.info_editlyricslabel)
        self.info_apply_link_signals(searchevbox, "search", _("Search Lyricwiki.org for lyrics"))
        self.info_apply_link_signals(editlyricsevbox, "editlyrics", _("Edit lyrics at Lyricwiki.org"))
        lyricsbox_bottom.pack_start(searchevbox, False, False, horiz_spacing)
        lyricsbox_bottom.pack_start(editlyricsevbox, False, False, horiz_spacing)
        lyricsbox.pack_start(lyricsbox_bottom, False, False, vert_spacing)
        self.info_lyrics.add(lyricsbox)
        outter_vbox.pack_start(self.info_lyrics, False, False, margin)

        # Album info
        info_album = ui.expander(
            markup="<b>" + _("Album Info") + "</b>", expand=self.config.info_album_expanded, can_focus=False
        )
        info_album.connect("activate", self.info_expanded, "album")
        albumbox = gtk.VBox()
        albumbox_top = gtk.HBox()
        self.albumText = ui.label(markup=" ", y=0, select=True, wrap=True)
        albumbox_top.pack_start(self.albumText, False, False, horiz_spacing)
        albumbox.pack_start(albumbox_top, False, False, vert_spacing)
        info_album.add(albumbox)
        outter_vbox.pack_start(info_album, False, False, margin)

        # Finish..
        if not self.config.show_lyrics:
            ui.hide(self.info_lyrics)
        if not self.config.show_covers:
            ui.hide(self.info_imagebox)
            # self.config.info_song_more will be overridden on on_link_click, so
            # store it in a temporary var..
        temp = self.config.info_song_more
        self.on_link_click(moreevbox, None, "more")
        self.config.info_song_more = temp
        if self.config.info_song_more:
            self.on_link_click(moreevbox, None, "more")
        outter_hbox.pack_start(outter_vbox, False, False, margin)
        info_scrollwindow.add_with_viewport(outter_hbox)