Example #1
0
 def searchfilter_toggle(self, _widget, initial_text=""):
     if self.filterbox_visible:
         ui.hide(self.filterbox)
         self.filterbox_visible = False
         self.edit_style_orig = self.libsearchfilter_get_style()
         self.filterpattern.set_text("")
         self.searchfilter_stop_loop()
     elif self.connected():
         self.playlist_pos_before_filter = \
                 self.current.get_visible_rect()[1]
         self.filterbox_visible = True
         self.filterpattern.handler_block(self.filter_changed_handler)
         self.filterpattern.set_text(initial_text)
         self.filterpattern.handler_unblock(self.filter_changed_handler)
         self.prevtodo = 'foo'
         ui.show(self.filterbox)
         # extra thread for background search work, synchronized
         # with a condition and its internal mutex
         self.filterbox_cond = threading.Condition()
         self.filterbox_cmd_buf = initial_text
         qsearch_thread = threading.Thread(target=self.searchfilter_loop)
         qsearch_thread.setDaemon(True)
         qsearch_thread.start()
         gobject.idle_add(self.filter_entry_grab_focus, self.filterpattern)
     self.current.set_headers_clickable(not self.filterbox_visible)
Example #2
0
    def _widgets_initialize(self):
        margin = 5
        outter_vbox = gtk.VBox()
        setupfuncs = (getattr(self, "_widgets_%s" % func)
                for func in ['song', 'lyrics', 'album'])
        for setup in setupfuncs:
            widget = setup()
            outter_vbox.pack_start(widget, False, False, margin)

        # Finish..
        if not self.config.show_lyrics:
            ui.hide(self.info_lyrics)
        if not self.config.show_covers:
            ui.hide(self._imagebox)
        self.info_area.add_with_viewport(outter_vbox)
Example #3
0
    def _widgets_initialize(self):
        margin = 5
        outter_vbox = gtk.VBox()
        setupfuncs = (getattr(self, '_widgets_%s' % func)
                      for func in ['song', 'lyrics', 'album'])
        for setup in setupfuncs:
            widget = setup()
            outter_vbox.pack_start(widget, False, False, margin)

        # Finish..
        if not self.config.show_lyrics:
            ui.hide(self.info_lyrics)
        if not self.config.show_covers:
            ui.hide(self._imagebox)
        self.info_area.add_with_viewport(outter_vbox)
Example #4
0
	def on_link_click(self, _widget, _event, linktype):
		if linktype == 'more':
			previous_is_more = (self.info_morelabel.get_text() == "(" + _("more") + ")")
			if previous_is_more:
				self.info_morelabel.set_markup(misc.link_markup(_("hide"), True, True, self.linkcolor))
				self.config.info_song_more = True
			else:
				self.info_morelabel.set_markup(misc.link_markup(_("more"), True, True, self.linkcolor))
				self.config.info_song_more = False
			if self.config.info_song_more:
				for hbox in self.info_boxes_in_more:
					ui.show(hbox)
			else:
				for hbox in self.info_boxes_in_more:
					ui.hide(hbox)
		else:
			self.on_link_click_cb(linktype)
Example #5
0
	def on_link_click(self, _widget, _event, linktype):
		if linktype == 'more':
			previous_is_more = (self.info_morelabel.get_text() == "(" + _("more") + ")")
			if previous_is_more:
				self.info_morelabel.set_markup(misc.link_markup(_("hide"), True, True, self.linkcolor))
				self.config.info_song_more = True
			else:
				self.info_morelabel.set_markup(misc.link_markup(_("more"), True, True, self.linkcolor))
				self.config.info_song_more = False
			if self.config.info_song_more:
				for hbox in self.info_boxes_in_more:
					ui.show(hbox)
			else:
				for hbox in self.info_boxes_in_more:
					ui.hide(hbox)
		else:
			self.on_link_click_cb(linktype)
Example #6
0
	def libsearchfilter_toggle(self, move_focus):
		if not self.search_visible() and self.connected():
			self.library.set_property('has-tooltip', True)
			ui.show(self.searchbutton)
			self.prevlibtodo = 'foo'
			self.prevlibtodo_base = "__"
			self.prevlibtodo_base_results = []
			# extra thread for background search work, synchronized with a condition and its internal mutex
			self.libfilterbox_cond = threading.Condition()
			self.libfilterbox_cmd_buf = self.searchtext.get_text()
			qsearch_thread = threading.Thread(target=self.libsearchfilter_loop)
			qsearch_thread.setDaemon(True)
			qsearch_thread.start()
		elif self.search_visible():
			ui.hide(self.searchbutton)
			self.searchtext.handler_block(self.libfilter_changed_handler)
			self.searchtext.set_text("")
			self.searchtext.handler_unblock(self.libfilter_changed_handler)
			self.libsearchfilter_stop_loop()
			self.library_browse(root=self.config.wd)
			if move_focus:
				self.library.grab_focus()
Example #7
0
 def searchfilter_toggle(self, _widget, initial_text=""):
     if self.filterbox_visible:
         ui.hide(self.filterbox)
         self.filterbox_visible = False
         self.edit_style_orig = self.libsearchfilter_get_style()
         self.filterpattern.set_text("")
         self.searchfilter_stop_loop()
     elif self.connected():
         self.playlist_pos_before_filter = self.current.get_visible_rect(
         )[1]
         self.filterbox_visible = True
         self.filterpattern.handler_block(self.filter_changed_handler)
         self.filterpattern.set_text(initial_text)
         self.filterpattern.handler_unblock(self.filter_changed_handler)
         self.prevtodo = 'foo'
         ui.show(self.filterbox)
         # extra thread for background search work, synchronized with a condition and its internal mutex
         self.filterbox_cond = threading.Condition()
         self.filterbox_cmd_buf = initial_text
         qsearch_thread = threading.Thread(target=self.searchfilter_loop)
         qsearch_thread.setDaemon(True)
         qsearch_thread.start()
         gobject.idle_add(self.filter_entry_grab_focus, self.filterpattern)
     self.current.set_headers_clickable(not self.filterbox_visible)
Example #8
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)
Example #9
0
	def show_lyrics_updated(self):
		if self.config.show_lyrics:
			ui.show(self.info_lyrics)
		else:
			ui.hide(self.info_lyrics)
Example #10
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)
Example #11
0
 def show_lyrics_updated(self):
     if self.config.show_lyrics:
         ui.show(self.info_lyrics)
     else:
         ui.hide(self.info_lyrics)
Example #12
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)