diff --git a/libsaria/collection/collection.py b/libsaria/collection/collection.py index 5a0127a6..530c348b 100644 --- a/libsaria/collection/collection.py +++ b/libsaria/collection/collection.py @@ -30,6 +30,8 @@ class Collection: def __init__(self, file): self.file = file self.load() + self.filtered = False + self.visible = None def save(self): libsaria.data.save( @@ -62,6 +64,19 @@ class Collection: #print #self.tag_tree.disp() + def filter(self, text): + if len(text) > 0: + self.visible = self.index.filter(text) + self.filtered = True + else: + self.visible = None + self.filtered = False + + def is_visible(self, id): + if self.filtered == False: + return True + return id in self.visible + def walk_tags(self): for tag in self.tag_tree.walk_forwards(): rec = self.records[tag[3]] diff --git a/libsaria/collection/lens.py b/libsaria/collection/lens.py index 68ea8cfc..d5cc3475 100644 --- a/libsaria/collection/lens.py +++ b/libsaria/collection/lens.py @@ -24,8 +24,6 @@ def set_badfiles(): class Library(collection.Collection): def __init__(self): collection.Collection.__init__(self, "DLTree_test") - self.filtered = False - self.visible = None def scan(self, path): print "Library scanning %s" % path @@ -36,19 +34,6 @@ class Library(collection.Collection): save(badfiles, "badfiles", "") self.disp() - def filter(self, text): - if len(text) > 0: - self.visible = self.index.filter(text) - self.filtered = True - else: - self.visible = None - self.filtered = False - - def is_visible(self, id): - if self.filtered == False: - return True - return id in self.visible - def update(self, path): global badfiles FileRef = libsaria.collection.FileRef