Moved Attract node types from Pillar to bcloud.attract module.

Also added a tuple bcloud.attract.node_types.NODE_TYPES that contains
all Attract node types, for easy reference.
This commit is contained in:
2016-08-30 14:29:24 +02:00
parent 57674502ea
commit f159b14b14
6 changed files with 172 additions and 8 deletions

View File

@@ -65,10 +65,7 @@ def setup_for_attract(project_url, replace=False):
(by default already existing Attract node types are skipped).
"""
# TODO: move those node types into this extension.
from pillar.api.node_types.act import node_type_act
from pillar.api.node_types.scene import node_type_scene
from pillar.api.node_types.shot import node_type_shot
from .node_types import NODE_TYPES
# Copy permissions from the project, then give everyone with PUT
# access also DELETE access.
@@ -85,12 +82,10 @@ def setup_for_attract(project_url, replace=False):
# Make a copy of the node types when setting the permissions, as
# we don't want to mutate the global node type objects.
node_type_act = dict(permissions=permissions, **node_type_act)
node_type_scene = dict(permissions=permissions, **node_type_scene)
node_type_shot = dict(permissions=permissions, **node_type_shot)
node_types = (dict(permissions=permissions, **nt) for nt in NODE_TYPES)
# Add the missing node types.
for node_type in (node_type_act, node_type_scene, node_type_shot):
for node_type in node_types:
found = [nt for nt in project['node_types']
if nt['name'] == node_type['name']]
if found:

View File

@@ -0,0 +1,7 @@
from .act import node_type_act
from .scene import node_type_scene
from .shot import node_type_shot
from .task import node_type_task
NODE_TYPES = (node_type_act, node_type_scene, node_type_shot, node_type_task)

View File

@@ -0,0 +1,5 @@
node_type_act = {
'name': 'act',
'description': 'Act node type',
'parent': []
}

View File

@@ -0,0 +1,5 @@
node_type_scene = {
'name': 'scene',
'description': 'Scene node type',
'parent': ['act'],
}

View File

@@ -0,0 +1,45 @@
node_type_shot = {
'name': 'shot',
'description': 'Shot Node Type, for shots',
'dyn_schema': {
'url': {
'type': 'string',
},
'cut_in': {
'type': 'integer'
},
'cut_out': {
'type': 'integer'
},
'status': {
'type': 'string',
'allowed': [
'on_hold',
'todo',
'in_progress',
'review',
'final'
],
},
'notes': {
'type': 'string',
'maxlength': 256,
},
'shot_group': {
'type': 'string',
#'data_relation': {
# 'resource': 'nodes',
# 'field': '_id',
#},
},
},
'form_schema': {
'url': {},
'cut_in': {},
'cut_out': {},
'status': {},
'notes': {},
'shot_group': {}
},
'parent': ['scene']
}

View File

@@ -0,0 +1,107 @@
node_type_task = {
'name': 'task',
'description': 'Task Node Type, for tasks',
'dyn_schema': {
'status': {
'type': 'string',
'allowed': [
'todo',
'in_progress',
'on_hold',
'approved',
'cbb',
'final',
'review'
],
'required': True,
},
'filepath': {
'type': 'string',
},
'revision': {
'type': 'integer',
},
'owners': {
'type': 'dict',
'schema': {
'users': {
'type': 'list',
'schema': {
'type': 'objectid',
}
},
'groups': {
'type': 'list',
'schema': {
'type': 'objectid',
}
}
}
},
'time': {
'type': 'dict',
'schema': {
'start': {
'type': 'datetime'
},
'duration': {
'type': 'integer'
},
'chunks': {
'type': 'list',
'schema': {
'type': 'dict',
'schema': {
'start': {
'type': 'datetime',
},
'duration': {
'type': 'integer',
}
}
}
},
}
},
'is_conflicting' : {
'type': 'boolean'
},
'is_processing' : {
'type': 'boolean'
},
'is_open' : {
'type': 'boolean'
}
},
'form_schema': {
'status': {},
'filepath': {},
'revision': {},
'owners': {
'schema': {
'users':{
'items': [('User', 'first_name')],
},
'groups': {}
}
},
'time': {
'schema': {
'start': {},
'duration': {},
'chunks': {
'visible': False,
'schema': {
'start': {},
'duration': {}
}
}
}
},
'is_conflicting': {},
'is_open': {},
'is_processing': {},
},
'parent': ['shot']
}