diff --git a/bcloud/attract/cli.py b/bcloud/attract/cli.py index 00d3ad7..4135eab 100644 --- a/bcloud/attract/cli.py +++ b/bcloud/attract/cli.py @@ -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: diff --git a/bcloud/attract/node_types/__init__.py b/bcloud/attract/node_types/__init__.py new file mode 100644 index 0000000..9ee89ef --- /dev/null +++ b/bcloud/attract/node_types/__init__.py @@ -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) + diff --git a/bcloud/attract/node_types/act.py b/bcloud/attract/node_types/act.py new file mode 100644 index 0000000..d434602 --- /dev/null +++ b/bcloud/attract/node_types/act.py @@ -0,0 +1,5 @@ +node_type_act = { + 'name': 'act', + 'description': 'Act node type', + 'parent': [] +} diff --git a/bcloud/attract/node_types/scene.py b/bcloud/attract/node_types/scene.py new file mode 100644 index 0000000..9977875 --- /dev/null +++ b/bcloud/attract/node_types/scene.py @@ -0,0 +1,5 @@ +node_type_scene = { + 'name': 'scene', + 'description': 'Scene node type', + 'parent': ['act'], +} diff --git a/bcloud/attract/node_types/shot.py b/bcloud/attract/node_types/shot.py new file mode 100644 index 0000000..99b5460 --- /dev/null +++ b/bcloud/attract/node_types/shot.py @@ -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'] +} diff --git a/bcloud/attract/node_types/task.py b/bcloud/attract/node_types/task.py new file mode 100644 index 0000000..5fdb350 --- /dev/null +++ b/bcloud/attract/node_types/task.py @@ -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'] +}