Example #1
0
class Renamer(Gtk.EventBox):

    __gsignals__ = {
        'changed': (GObject.SignalFlags.RUN_LAST, None, (object, )),
    }

    def __init__(self, *args, **kwargs):
        super(Renamer, self).__init__()

        from quodlibet.library.libraries import SongLibrary

        self.library = SongLibrary()
        box = Gtk.EventBox()
        self.renamer = RenameFiles(self.library, box)
        box.add(self.renamer)

        self.renamer.test_mode = True

    def add_songs(self, songs):
        self.library.add(songs)

    def rename(self, pattern, songs):
        self.renamer.combo.get_child().set_text(pattern)
        self.renamer._preview(songs)
        self.renamer._rename(self.library)
class Renamer(Gtk.EventBox):

    __gsignals__ = {
        'changed': (GObject.SignalFlags.RUN_LAST, None, (object,)),
    }

    def __init__(self, *args, **kwargs):
        super(Renamer, self).__init__()

        from quodlibet.library.libraries import SongLibrary

        self.library = SongLibrary()
        box = Gtk.EventBox()
        self.renamer = RenameFiles(self.library, box)
        box.add(self.renamer)

        self.renamer.test_mode = True

    def add_songs(self, songs):
        self.library.add(songs)

    def rename(self, pattern, songs):
        self.renamer.combo.get_child().set_text(pattern)
        self.renamer._preview(songs)
        self.renamer._rename(self.library)
    def __init__(self, *args, **kwargs):
        super().__init__()

        from quodlibet.library.libraries import SongLibrary

        self.library = SongLibrary()
        box = Gtk.EventBox()
        self.renamer = RenameFiles(self.library, box)
        box.add(self.renamer)

        self.renamer.test_mode = True
    def __init__(self, *args, **kwargs):
        super(Renamer, self).__init__()

        from quodlibet.library.libraries import SongLibrary

        self.library = SongLibrary()
        box = Gtk.EventBox()
        self.renamer = RenameFiles(self.library, box)
        box.add(self.renamer)

        self.renamer.test_mode = True
    def setUp(self):
        lib = SongLibrary()
        received = []

        def listen(name, items):
            received.append(name)

        self._sigs = [
            connect_obj(lib, 'added', listen, 'added'),
            connect_obj(lib, 'changed', listen, 'changed'),
            connect_obj(lib, 'removed', listen, 'removed'),
        ]

        albums = lib.albums
        self._asigs = [
            connect_obj(albums, 'added', listen, 'a_added'),
            connect_obj(albums, 'changed', listen, 'a_changed'),
            connect_obj(albums, 'removed', listen, 'a_removed'),
        ]

        self.lib = lib
        self.albums = albums
        self.received = received