예제 #1
0
 def __information(self, librarian):
     model, rows = self.get_selection().get_selected_rows()
     if rows:
         songs = [model[row][0] for row in rows]
     else:
         from quodlibet import app
         if app.player.song:
             songs = [app.player.song]
         else:
             return
     window = Information(librarian, songs, self)
     window.show()
예제 #2
0
 def __information(self, librarian):
     model, rows = self.get_selection().get_selected_rows()
     if rows:
         songs = [model[row][0] for row in rows]
     else:
         from quodlibet import app
         if app.player.song:
             songs = [app.player.song]
         else:
             return
     window = Information(librarian, songs, self)
     window.show()
예제 #3
0
    def __key_press(self, songlist, event, librarian):
        rating_accels = [
            "<ctrl>%d" % i for i in range(min(10, config.RATINGS.number + 1))
        ]

        if qltk.is_accel(event, *rating_accels):
            rating = int(chr(event.keyval)) * config.RATINGS.precision
            self.__set_rating(rating, self.get_selected_songs(), librarian)
            return True
        elif qltk.is_accel(event, "<ctrl>Return", "<ctrl>KP_Enter"):
            self.__enqueue(self.get_selected_songs())
            return True
        elif qltk.is_accel(event, "<control>F"):
            self.emit('start-interactive-search')
            return True
        elif qltk.is_accel(event, "<alt>Return"):
            songs = self.get_selected_songs()
            if songs:
                window = SongProperties(librarian, songs, parent=self)
                window.show()
            return True
        elif qltk.is_accel(event, "<control>I"):
            songs = self.get_selected_songs()
            if songs:
                window = Information(librarian, songs, self)
                window.show()
            return True
        return False
예제 #4
0
class TInformation(TestCase):
    def setUp(self):
        quodlibet.config.init()
        init_fake_app()
        self.inf = None
        self.library = SongLibrary()

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

    def test_none(self):
        Information(self.library, []).destroy()

    def test_one(self):
        f = AF({"~filename": fsnative(u"/dev/null")})
        self.inf = Information(self.library, [f])
        self.assert_child_is(OneSong)

    def test_two(self):
        f = AF({"~filename": fsnative(u"/dev/null")})
        f2 = AF({"~filename": fsnative(u"/dev/null2")})
        self.inf = Information(self.library, [f, f2])
        self.assert_child_is(ManySongs)

    def test_album(self):
        f = AF({"~filename": fsnative(u"/dev/null"), "album": "woo"})
        f2 = AF({"~filename": fsnative(u"/dev/null2"), "album": "woo"})
        self.inf = Information(self.library, [f, f2])
        self.assert_child_is(OneAlbum)

    def test_album_special_chars(self):
        f = AF({"~filename": fsnative(u"/dev/null"), "album": "woo & hoo"})
        f2 = AF({"~filename": fsnative(u"/dev/null2"), "album": "woo & hoo"})
        self.inf = Information(self.library, [f, f2])
        self.assert_child_is(OneAlbum)

    def test_artist(self):
        f = AF({"~filename": fsnative(u"/dev/null"), "artist": "woo"})
        f2 = AF({"~filename": fsnative(u"/dev/null2"), "artist": "woo"})
        self.inf = Information(self.library, [f, f2])
        self.assert_child_is(OneArtist)

    def test_performer_roles(self):
        f = AF({"~filename": fsnative(u"/dev/null"), "performer:piano": "woo"})
        self.inf = Information(self.library, [f])
        self.assert_child_is(OneSong)

    def test_remove_song(self):
        f = AF({"~filename": fsnative(u"/dev/null"), "artist": "woo"})
        f2 = AF({"~filename": fsnative(u"/dev/null2"), "artist": "woo"})
        self.library.add([f, f2])
        self.inf = Information(self.library, [f, f2])
        self.library.remove([f])

    def assert_child_is(self, cls):
        self.failUnless(isinstance(self.inf.get_child(), cls))
 def __key_press(self, songlist, event, librarian):
     if event.string in ['0', '1', '2', '3', '4']:
         rating = min(1.0, int(event.string) * config.RATINGS.precision)
         self.__set_rating(rating, self.get_selected_songs(), librarian)
         return True
     elif qltk.is_accel(event, "<ctrl>Return") or \
         qltk.is_accel(event, "<ctrl>KP_Enter"):
         self.__enqueue(self.get_selected_songs())
         return True
     elif qltk.is_accel(event, "<control>F"):
         self.emit('start-interactive-search')
         return True
     elif qltk.is_accel(event, "<alt>Return"):
         songs = self.get_selected_songs()
         if songs:
             window = SongProperties(librarian, songs, parent=self)
             window.show()
         return True
     elif qltk.is_accel(event, "<control>I"):
         songs = self.get_selected_songs()
         if songs:
             window = Information(librarian, songs, self)
             window.show()
         return True
     return False
예제 #6
0
 def __key_press(self, songlist, event, librarian, player):
     if qltk.is_accel(event, "<Primary>Return", "<Primary>KP_Enter"):
         self.__enqueue(self.get_selected_songs())
         return True
     elif qltk.is_accel(event, "<Primary>F"):
         self.emit('start-interactive-search')
         return True
     elif qltk.is_accel(event, "<Primary>Delete"):
         songs = self.get_selected_songs()
         if songs:
             trash_songs(self, songs, librarian)
         return True
     elif qltk.is_accel(event, "<alt>Return"):
         songs = self.get_selected_songs()
         if songs:
             window = SongProperties(librarian, songs, parent=self)
             window.show()
         return True
     elif qltk.is_accel(event, "<Primary>I"):
         songs = self.get_selected_songs()
         if songs:
             window = Information(librarian, songs, self)
             window.show()
         return True
     elif qltk.is_accel(event, "space", "KP_Space") and player is not None:
         player.paused = not player.paused
         return True
     return False
예제 #7
0
    def __key_pressed(self, widget, event):
        if qltk.is_accel(event, "Delete"):
            model, iter = self.__selected_playlists()
            if not iter:
                return False

            playlist = model[iter][0]
            dialog = ConfirmRemovePlaylistDialog(self, playlist)
            if dialog.run() == Gtk.ResponseType.YES:
                playlist.delete()
                model.get_model().remove(
                    model.convert_iter_to_child_iter(iter))
            return True
        elif qltk.is_accel(event, "F2"):
            model, iter = self.__selected_playlists()
            if iter:
                self._start_rename(model.get_path(iter))
            return True
        elif qltk.is_accel(event, "<Primary>I"):
            songs = self._get_playlist_songs()
            if songs:
                window = Information(self.library.librarian, songs, self)
                window.show()
            return True
        elif qltk.is_accel(event, "<Primary>Return", "<Primary>KP_Enter"):
            qltk.enqueue(self._get_playlist_songs())
            return True
        elif qltk.is_accel(event, "<alt>Return"):
            songs = self._get_playlist_songs()
            if songs:
                window = SongProperties(self.library.librarian, songs, self)
                window.show()
            return True
        return False
예제 #8
0
    def __key_pressed(self, widget, event):
        if qltk.is_accel(event, "Delete"):
            model, iter = self.__selected_playlists()
            if not iter:
                return False

            playlist = model[iter][0]
            if confirm_remove_playlist_dialog_invoke(self, playlist,
                                                     self.Confirmer):
                playlist.delete()
            else:
                print_d("Playlist removal cancelled through prompt")
            return True
        elif qltk.is_accel(event, "F2"):
            model, iter = self.__selected_playlists()
            if iter:
                self._start_rename(model.get_path(iter))
            return True
        elif qltk.is_accel(event, "<Primary>I"):
            songs = self._get_playlist_songs()
            if songs:
                window = Information(self.songs_lib.librarian, songs, self)
                window.show()
            return True
        elif qltk.is_accel(event, "<Primary>Return", "<Primary>KP_Enter"):
            qltk.enqueue(self._get_playlist_songs())
            return True
        elif qltk.is_accel(event, "<alt>Return"):
            songs = self._get_playlist_songs()
            if songs:
                window = SongProperties(self.songs_lib.librarian, songs, self)
                window.show()
            return True
        return False
예제 #9
0
파일: main.py 프로젝트: zsau/quodlibet
    def __key_pressed(self, widget, event):
        if qltk.is_accel(event, "Delete"):
            model, iter = self.__selected_playlists()
            if not iter:
                return False

            playlist = model[iter][0]
            dialog = ConfirmRemovePlaylistDialog(self, playlist)
            if dialog.run() == Gtk.ResponseType.YES:
                playlist.delete()
                model.get_model().remove(
                    model.convert_iter_to_child_iter(iter))
            return True
        elif qltk.is_accel(event, "F2"):
            model, iter = self.__selected_playlists()
            if iter:
                self._start_rename(model.get_path(iter))
            return True
        elif qltk.is_accel(event, "<Primary>I"):
            songs = self._get_playlist_songs()
            if songs:
                window = Information(self.library.librarian, songs, self)
                window.show()
            return True
        elif qltk.is_accel(event, "<Primary>Return", "<Primary>KP_Enter"):
            qltk.enqueue(self._get_playlist_songs())
            return True
        elif qltk.is_accel(event, "<alt>Return"):
            songs = self._get_playlist_songs()
            if songs:
                window = SongProperties(self.library.librarian, songs, self)
                window.show()
            return True
        return False
예제 #10
0
파일: main.py 프로젝트: markshep/quodlibet
 def __key_pressed(self, widget, event, librarian):
     if qltk.is_accel(event, "<Primary>I"):
         songs = self.__get_selected_songs()
         if songs:
             window = Information(librarian, songs, self)
             window.show()
         return True
     elif qltk.is_accel(event, "<alt>Return"):
         songs = self.__get_selected_songs()
         if songs:
             window = SongProperties(librarian, songs, self)
             window.show()
         return True
     return False
예제 #11
0
class TInformation(TestCase):

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

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

    def test_none(self):
        Information(self.library, []).destroy()

    def test_one(self):
        f = AF({"~filename": fsnative(u"/dev/null")})
        self.inf = Information(self.library, [f])
        self.assert_child_is(OneSong)

    def test_two(self):
        f = AF({"~filename": fsnative(u"/dev/null")})
        f2 = AF({"~filename": fsnative(u"/dev/null2")})
        self.inf = Information(self.library, [f, f2])
        self.assert_child_is(ManySongs)

    def test_album(self):
        f = AF({"~filename": fsnative(u"/dev/null"), "album": "woo"})
        f2 = AF({"~filename": fsnative(u"/dev/null2"), "album": "woo"})
        self.inf = Information(self.library, [f, f2])
        self.assert_child_is(OneAlbum)

    def test_artist(self):
        f = AF({"~filename": fsnative(u"/dev/null"), "artist": "woo"})
        f2 = AF({"~filename": fsnative(u"/dev/null2"), "artist": "woo"})
        self.inf = Information(self.library, [f, f2])
        self.assert_child_is(OneArtist)

    def assert_child_is(self, cls):
        self.failUnless(isinstance(self.inf.get_child(), cls))
예제 #12
0
파일: main.py 프로젝트: pfps/quodlibet
 def __key_pressed(self, widget, event, librarian):
     if qltk.is_accel(event, "<Primary>I"):
         songs = self.__get_selected_songs()
         if songs:
             window = Information(librarian, songs, self)
             window.show()
         return True
     elif qltk.is_accel(event, "<alt>Return"):
         songs = self.__get_selected_songs()
         if songs:
             window = SongProperties(librarian, songs, self)
             window.show()
         return True
     return False
예제 #13
0
 def __key_pressed(self, view, event, librarian):
     # if ctrl+a is pressed, intercept and select the All entry instead
     if is_accel(event, "<Primary>a"):
         self.set_selected([])
         return True
     elif is_accel(event, "<Primary>Return", "<Primary>KP_Enter"):
         self.__enqueue(self.__get_selected_songs(sort=True))
         return True
     elif is_accel(event, "<alt>Return"):
         songs = self.__get_selected_songs(sort=True)
         if songs:
             window = SongProperties(librarian, songs, parent=self)
             window.show()
         return True
     elif is_accel(event, "<Primary>I"):
         songs = self.__get_selected_songs(sort=True)
         if songs:
             window = Information(librarian, songs, self)
             window.show()
         return True
     return False
예제 #14
0
 def test_two(self):
     f = AF({"~filename": fsnative(u"/dev/null")})
     f2 = AF({"~filename": fsnative(u"/dev/null2")})
     self.inf = Information(self.library, [f, f2])
     self.assert_child_is(ManySongs)
예제 #15
0
 def test_none(self):
     Information(self.library, []).destroy()
예제 #16
0
 def test_one(self):
     f = AF({"~filename": fsnative(u"/dev/null")})
     self.inf = Information(self.library, [f])
     self.assert_child_is(OneSong)
예제 #17
0
 def information_cb(menu_item):
     window = Information(librarian, songs, parent)
     window.show()
 def test_two(self):
     f = AF({"~filename": "/dev/null"})
     f2 = AF({"~filename": "/dev/null2"})
     Information(self.library, [f, f2]).destroy()
예제 #19
0
 def test_performer_roles(self):
     f = AF({"~filename": fsnative(u"/dev/null"), "performer:piano": "woo"})
     self.inf = Information(self.library, [f])
     self.assert_child_is(OneSong)
예제 #20
0
 def __current_song_info(self, *args):
     song = app.player.song
     if song:
         librarian = self.__library.librarian
         window = Information(librarian, [song], self)
         window.show()
예제 #21
0
 def test_performer_roles(self):
     f = AF({"~filename": fsnative(u"/dev/null"), "performer:piano": "woo"})
     self.inf = Information(self.library, [f])
     self.assert_child_is(OneSong)
예제 #22
0
 def test_one(self):
     f = AF({"~filename": fsnative(u"/dev/null")})
     self.inf = Information(self.library, [f])
     self.assert_child_is(OneSong)
예제 #23
0
 def test_album(self):
     f = AF({"~filename": fsnative(u"/dev/null"), "album": "woo"})
     f2 = AF({"~filename": fsnative(u"/dev/null2"), "album": "woo"})
     Information(self.library, [f, f2]).destroy()
예제 #24
0
 def information_cb(menu_item):
     parent = get_menu_item_top_parent(menu_item)
     window = Information(librarian, songs, parent)
     window.show()
예제 #25
0
 def __information(self, *args):
     song = app.player.song
     if song:
         window = Information(app.librarian, [song])
         window.show()
예제 #26
0
파일: menu.py 프로젝트: azarmadr/quodlibet
 def on_information(*args):
     song = player.song
     window = Information(app.librarian, [song])
     window.show()
 def test_one(self):
     f = AF({"~filename": "/dev/null"})
     Information(self.library, [f]).destroy()
예제 #28
0
 def test_album_special_chars(self):
     f = AF({"~filename": fsnative(u"/dev/null"), "album": "woo & hoo"})
     f2 = AF({"~filename": fsnative(u"/dev/null2"), "album": "woo & hoo"})
     self.inf = Information(self.library, [f, f2])
     self.assert_child_is(OneAlbum)
예제 #29
0
 def test_two(self):
     f = AF({"~filename": fsnative(u"/dev/null")})
     f2 = AF({"~filename": fsnative(u"/dev/null2")})
     self.inf = Information(self.library, [f, f2])
     self.assert_child_is(ManySongs)
예제 #30
0
 def test_artist(self):
     f = AF({"~filename": fsnative(u"/dev/null"), "artist": "woo"})
     f2 = AF({"~filename": fsnative(u"/dev/null2"), "artist": "woo"})
     self.inf = Information(self.library, [f, f2])
     self.assert_child_is(OneArtist)
예제 #31
0
 def test_artist(self):
     f = AF({"~filename": fsnative(u"/dev/null"), "artist": "woo"})
     f2 = AF({"~filename": fsnative(u"/dev/null2"), "artist": "woo"})
     self.inf = Information(self.library, [f, f2])
     self.assert_child_is(OneArtist)
예제 #32
0
 def test_remove_song(self):
     f = AF({"~filename": fsnative(u"/dev/null"), "artist": "woo"})
     f2 = AF({"~filename": fsnative(u"/dev/null2"), "artist": "woo"})
     self.library.add([f, f2])
     self.inf = Information(self.library, [f, f2])
     self.library.remove([f])
예제 #33
0
 def test_remove_song(self):
     f = AF({"~filename": fsnative(u"/dev/null"), "artist": "woo"})
     f2 = AF({"~filename": fsnative(u"/dev/null2"), "artist": "woo"})
     self.library.add([f, f2])
     self.inf = Information(self.library, [f, f2])
     self.library.remove([f])
예제 #34
0
 def on_information(*args):
     song = player.song
     window = Information(app.librarian, [song])
     window.show()
 def test_artist(self):
     f = AF({"~filename": "/dev/null", "artist": "woo"})
     f2 = AF({"~filename": "/dev/null2", "artist": "woo"})
     Information(self.library, [f, f2]).destroy()
예제 #36
0
 def edit(widget):
     print_d("Launching lyrics editor for %s" % song("~filename"))
     assert isinstance(song, SongWrapper)
     information = Information(app.librarian, [song._song])
     information.get_child()._switch_to_lyrics()
     information.show()
예제 #37
0
 def __current_song_info(self, *args):
     song = app.player.song
     if song:
         librarian = self.__library.librarian
         window = Information(librarian, [song], self)
         window.show()
예제 #38
0
 def __information(self, *args):
     song = app.player.song
     if song:
         window = Information(app.librarian, [song])
         window.show()
예제 #39
0
파일: songsmenu.py 프로젝트: bp0/quodlibet
 def information_cb(menu_item):
     parent = get_menu_item_top_parent(menu_item)
     window = Information(librarian, songs, parent)
     window.show()
예제 #40
0
 def edit(widget):
     print_d("Launching lyrics editor for %s" % song("~filename"))
     assert isinstance(song, SongWrapper)
     information = Information(app.librarian, [song._song])
     information.get_child()._switch_to_lyrics()
     information.show()
예제 #41
0
 def test_album_special_chars(self):
     f = AF({"~filename": fsnative(u"/dev/null"), "album": "woo & hoo"})
     f2 = AF({"~filename": fsnative(u"/dev/null2"), "album": "woo & hoo"})
     self.inf = Information(self.library, [f, f2])
     self.assert_child_is(OneAlbum)