|
@@ -35,7 +35,7 @@ class ProjectManager(ObservableDict):
|
|
|
with open(path.join('projects', uuid, 'project.json'), 'w') as file:
|
|
|
dump(copy, file, indent=4)
|
|
|
|
|
|
- def create_project(self, name, description, model, unmanaged=None):
|
|
|
+ def create_project(self, name, description, model, label, unmanaged=None):
|
|
|
# create dict representation
|
|
|
uuid = str(uuid1())
|
|
|
|
|
@@ -58,6 +58,19 @@ class ProjectManager(ObservableDict):
|
|
|
'jobs': {}
|
|
|
}, self)
|
|
|
|
|
|
+ # add labels if id is valid
|
|
|
+ if label in self.parent['labels']:
|
|
|
+ code_path = path.join(self.parent['labels'][label]['path'], self.parent['labels'][label]['code']['module'])
|
|
|
+ module_name = code_path.replace('/', '.').replace('\\', '.')
|
|
|
+ class_name = self.parent['labels'][label]['code']['class']
|
|
|
+
|
|
|
+ mod = __import__(module_name, fromlist=[class_name])
|
|
|
+ cl = getattr(mod, class_name)
|
|
|
+
|
|
|
+ provider = cl(self.parent['labels'][label]['path'], self.parent['labels'][label])
|
|
|
+ for label in provider.get_labels():
|
|
|
+ self[uuid].add_label(label['name'], identifier=label['id'])
|
|
|
+
|
|
|
# create project.json
|
|
|
self.write_project(uuid)
|
|
|
|