def open_chooser(self, action): if action.get_name() == "AddFolders": fns = choose_folders(self, _("Add Music"), _("_Add Folders")) if fns: # scan them copool.add(self.__library.scan, fns, cofuncid="library", funcid="library") else: patterns = ["*" + path2fsn(k) for k in formats.loaders.keys()] choose_filter = create_chooser_filter(_("Music Files"), patterns) fns = choose_files( self, _("Add Music"), _("_Add Files"), choose_filter) if fns: for filename in fns: self.__library.add_filename(filename)
def __add(self, *args): fns = choose_folders(self, _("Select Directories"), _("_Add Folders")) for fn in fns: self.model.append(row=[fn]) self.__save()
def test_choose_folders(self): w = Gtk.Window() with with_response(Gtk.ResponseType.CANCEL): assert choose_folders(w, u"title", u"action") == []