From 1845fe2ba0bb77728bece1c2e50990325c94ac72 Mon Sep 17 00:00:00 2001 From: einarr Date: Thu, 2 Jun 2011 14:38:01 +0000 Subject: [PATCH] Added rudimentary loading of annotation files. --- laydi/project.py | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/laydi/project.py b/laydi/project.py index 48be392..e9789fa 100644 --- a/laydi/project.py +++ b/laydi/project.py @@ -4,6 +4,7 @@ import configobj import time import dataset +import annotations NAME = "laydi-cmd" VERSION = "0.1.0" @@ -279,10 +280,29 @@ class DataDirectory(Directory): filepath = os.path.join(self.path, fn) -def SelectionDirectory(object): +class SelectionDirectory(object): def __init__(self, dirname): pass + +class AnnotationDirectory(Directory): + def __init__(self, dirname, project): + self.project = project + self.dirname = dirname + Directory.__init__(self, dirname) + + def file_created(self, fn): + print "File created: %s" % fn + annotations.read_annotations_file(os.path.join(self.dirname, fn)) + + def file_changed(self, fn): + print "File changed: %s" % fn + annotations.read_annotations_file(os.path.join(self.dirname, fn)) + + def file_removed(self, fn): + print "File removed: %s" % fn + + class Project(object): def __init__(self, dirname): """Opens a project directory. The directory must exist and be a valid project.""" @@ -298,6 +318,7 @@ class Project(object): self.universe = Universe() self.data = DataDirectory(self.datadir, self) + self.annotations = AnnotationDirectory(self.anndir, self) def update(self): print "updating project"