def __init__(self, s): samplerobject.SamplerObject.__init__(self, s, None, "recordingtools") self.attrs = ["status", "progress", "max_rec_time", "input", "mode", "monitor", "rec_time", "pitch", "threshold", "trigger_src", "bit_depth", "prerec_time", "name", "name_seed", "autorec_mode", "autonormalize"] if not fileutils.is_valid_name(self.s.recordingtools.get_name()): self.set("name", "Sample %i" % (self.s.sampletools.get_no_items() + 1)) self.update()
def __init__(self, s): samplerobject.SamplerObject.__init__(self, s, None, "recordingtools") self.attrs = [ "status", "progress", "max_rec_time", "input", "mode", "monitor", "rec_time", "pitch", "threshold", "trigger_src", "bit_depth", "prerec_time", "name", "name_seed", "autorec_mode", "autonormalize" ] if not fileutils.is_valid_name(self.s.recordingtools.get_name()): self.set("name", "Sample %i" % (self.s.sampletools.get_no_items() + 1)) self.update()
def get_children(self): """Gets the children of this folder or returns a cached version when already retrieved. """ if len(self.children) > 0: return self.children self.set_current() folder_names = handlers[Disk].get_folder_names() if folder_names: self.children = [Folder(os.path.join(self.path, folder_name)) for folder_name in folder_names if fileutils.is_valid_name(folder_name)] file_names_sizes = handlers[Disk].get_filenames() if file_names_sizes: self.children.extend(self.get_filename_sizes(file_names_sizes)) return self.children
def get_children(self): """Gets the children of this folder or returns a cached version when already retrieved. """ if len(self.children) > 0: return self.children self.set_current() folder_names = handlers[Disk].get_folder_names() if folder_names: self.children = [ Folder(os.path.join(self.path, folder_name)) for folder_name in folder_names if fileutils.is_valid_name(folder_name) ] file_names_sizes = handlers[Disk].get_filenames() if file_names_sizes: self.children.extend(self.get_filename_sizes(file_names_sizes)) return self.children
def test_is_invalid_name(self): self.assertFalse(fileutils.is_valid_name(INVALID_FILENAMES[0]))
def test_is_valid_name(self): for name in VALID_FILENAMES: self.assertTrue(fileutils.is_valid_name(name), msg='%s should be valid' % name) self.assertTrue(fileutils.is_valid_name('abc'))