Esempio n. 1
0
    def __init__(self, library, song):
        super(OneSong, self).__init__()
        vbox = gtk.VBox(spacing=12)
        vbox.set_border_width(12)
        self._title(song, vbox)
        self._album(song, vbox)
        self._people(song, vbox)
        self._library(song, vbox)
        self._file(song, vbox)
        sw = SW()
        sw.title = _("Information")
        sw.add_with_viewport(vbox)
        self.append_page(sw)
        lyrics = LyricsPane(song)
        lyrics.title = _("Lyrics")
        self.append_page(lyrics)

        bookmarks = EditBookmarksPane(None, song)
        bookmarks.title = _("Bookmarks")
        bookmarks.set_border_width(12)
        self.append_page(bookmarks)

        if "~errors" in song:
            errors = ErrorPane(song)
            errors.title = _("Errors")
            self.append_page(errors)

        s = library.connect('changed', self.__check_changed, vbox, song)
        self.connect_object('destroy', library.disconnect, s)
Esempio n. 2
0
    def __init__(self, library, song, lyrics=True, bookmarks=True):
        super(OneSong, self).__init__()
        vbox = Gtk.VBox(spacing=12)
        vbox.set_border_width(12)
        self._title(song, vbox)
        self._album(song, vbox)
        self._people(song, vbox)
        self._library(song, vbox)
        self._file(song, vbox)
        self._additional(song, vbox)
        sw = SW()
        sw.title = _("Information")
        sw.add_with_viewport(vbox)
        self.append_page(sw)
        if lyrics:
            lyrics = LyricsPane(song)
            lyrics.title = _("Lyrics")
            self.append_page(lyrics)

        if bookmarks:
            bookmarks = EditBookmarksPane(None, song)
            bookmarks.title = _("Bookmarks")
            bookmarks.set_border_width(12)
            self.append_page(bookmarks)

        connect_destroy(library, 'changed', self.__check_changed, vbox, song)
Esempio n. 3
0
 def test_save_lyrics_deletes_lyric_file(self):
     af = self.temp_mp3()
     lf_name = af.lyric_filename
     os.makedirs(os.path.dirname(lf_name))
     with open(lf_name, "wb") as f:
         f.write(LYRICS.encode("utf-8"))
     self.failUnless(os.path.exists(lf_name))
     self.pane = LyricsPane(af)
     self.pane._save_lyrics(af, LYRICS)
     self.failIf(os.path.exists(lf_name))
Esempio n. 4
0
class TLyricsPane(TestCase):

    def setUp(self):
        quodlibet.config.init()
        init_fake_app()
        self.pane = None
        self.library = SongLibrary()

    def tearDown(self):
        destroy_fake_app()
        self.library.destroy()
        quodlibet.config.quit()
        if self.pane:
            self.pane.destroy()

    def test_construction(self):
        af = AF({"~filename": fsnative(u"/dev/null")})
        self.pane = LyricsPane(af)

    def test_save_lyrics(self):
        af = self.temp_mp3()
        self.pane = LyricsPane(af)
        self.pane._save_lyrics(af, LYRICS)
        self.failUnlessEqual(af("~lyrics"), LYRICS)

    def test_save_encoded_lyrics(self):
        af = self.temp_mp3()
        self.pane = LyricsPane(af)
        self.pane._save_lyrics(af, LYRICS)
        self.failUnlessEqual(af("~lyrics"), LYRICS)

    def test_save_lyrics_deletes_lyric_file(self):
        af = self.temp_mp3()
        lf_name = af.lyric_filename
        os.makedirs(os.path.dirname(lf_name))
        with open(lf_name, "wb") as f:
            f.write(LYRICS.encode("utf-8"))
        self.failUnless(os.path.exists(lf_name))
        self.pane = LyricsPane(af)
        self.pane._save_lyrics(af, LYRICS)
        self.failIf(os.path.exists(lf_name))

    def temp_mp3(self):
        name = get_temp_copy(get_data_path('silence-44-s.mp3'))
        af = MP3File(name)
        af.sanitize()
        return af
Esempio n. 5
0
class TLyricsPane(TestCase):

    def setUp(self):
        quodlibet.config.init()
        init_fake_app()
        self.pane = None
        self.library = SongLibrary()

    def tearDown(self):
        destroy_fake_app()
        self.library.destroy()
        quodlibet.config.quit()
        if self.pane:
            self.pane.destroy()

    def test_construction(self):
        af = AF({"~filename": fsnative(u"/dev/null")})
        self.pane = LyricsPane(af)

    def test_save_lyrics(self):
        af = self.temp_mp3()
        self.pane = LyricsPane(af)
        self.pane._save_lyrics(af, LYRICS)
        self.failUnlessEqual(af("~lyrics"), LYRICS)

    def test_save_encoded_lyrics(self):
        af = self.temp_mp3()
        self.pane = LyricsPane(af)
        self.pane._save_lyrics(af, LYRICS)
        self.failUnlessEqual(af("~lyrics"), LYRICS)

    def test_save_lyrics_deletes_lyric_file(self):
        af = self.temp_mp3()
        lf_name = af.lyric_filename
        os.makedirs(os.path.dirname(lf_name))
        with open(lf_name, "wb") as f:
            f.write(LYRICS.encode("utf-8"))
        self.failUnless(os.path.exists(lf_name))
        self.pane = LyricsPane(af)
        self.pane._save_lyrics(af, LYRICS)
        self.failIf(os.path.exists(lf_name))

    def temp_mp3(self):
        name = get_temp_copy(get_data_path('silence-44-s.mp3'))
        af = MP3File(name)
        af.sanitize()
        return af
Esempio n. 6
0
 def test_save_encoded_lyrics(self):
     af = self.temp_mp3()
     self.pane = LyricsPane(af)
     self.pane._save_lyrics(af, LYRICS.encode('utf-8'))
     self.failUnlessEqual(af("~lyrics"), LYRICS)
Esempio n. 7
0
 def test_construction(self):
     af = AF({"~filename": fsnative(u"/dev/null")})
     self.pane = LyricsPane(af)
Esempio n. 8
0
 def test_save_encoded_lyrics(self):
     af = self.temp_mp3()
     self.pane = LyricsPane(af)
     self.pane._save_lyrics(af, LYRICS)
     self.failUnlessEqual(af("~lyrics"), LYRICS)
Esempio n. 9
0
 def test_construction(self):
     af = AF({"~filename": fsnative(u"/dev/null")})
     self.pane = LyricsPane(af)