Example #1
0
 def __import(self, activator, library):
     filt = lambda fn: fn.endswith(".pls") or fn.endswith(".m3u")
     from quodlibet.qltk.chooser import FileChooser
     chooser = FileChooser(self, _("Import Playlist"), filt, get_home_dir())
     files = chooser.run()
     chooser.destroy()
     for filename in files:
         if filename.endswith(".m3u"):
             playlist = parse_m3u(filename, library=library)
         elif filename.endswith(".pls"):
             playlist = parse_pls(filename, library=library)
         else:
             qltk.ErrorMessage(
                 qltk.get_top_parent(self), _("Unable to import playlist"),
                 _("Quod Libet can only import playlists in the M3U "
                   "and PLS formats.")).run()
             return
         self.changed(playlist)
         library.add(playlist)
Example #2
0
 def __import(self, activator, library):
     filt = lambda fn: fn.endswith(".pls") or fn.endswith(".m3u")
     from quodlibet.qltk.chooser import FileChooser
     chooser = FileChooser(self, _("Import Playlist"), filt, const.HOME)
     files = chooser.run()
     chooser.destroy()
     for filename in files:
         if filename.endswith(".m3u"):
             playlist = parse_m3u(filename, library=library)
         elif filename.endswith(".pls"):
             playlist = parse_pls(filename, library=library)
         else:
             qltk.ErrorMessage(
                 qltk.get_top_parent(self),
                 _("Unable to import playlist"),
                 _("Quod Libet can only import playlists in the M3U "
                   "and PLS formats.")).run()
             return
         PlaylistsBrowser.changed(playlist)
         library.add(playlist)
Example #3
0
 def test_filter(self):
     f = lambda *x: None
     x = FileChooser(None, "foo", filter=f)
     while Gtk.events_pending():
         Gtk.main_iteration()
     x.destroy()