Nicer description of properties in shot activity feed

This commit is contained in:
2016-10-18 15:00:40 +02:00
parent 963430e6d9
commit b0b5be0df8
2 changed files with 14 additions and 3 deletions

View File

@@ -36,3 +36,9 @@ node_type_shot = {
} }
task_types = ['layout', 'animation', 'lighting', 'fx', 'rendering'] task_types = ['layout', 'animation', 'lighting', 'fx', 'rendering']
human_readable_properties = {
'properties.trim_start_in_frames': 'Trim Start',
'properties.duration_in_edit_in_frames': 'Duration in Edit',
'properties.cut_in_timeline_in_frames': 'Cut-in',
}

View File

@@ -1,7 +1,7 @@
import itertools import itertools
import logging import logging
from attract.node_types.shot import node_type_shot from attract.node_types.shot import node_type_shot, human_readable_properties
from pillar.api.nodes import only_for_node_type_decorator from pillar.api.nodes import only_for_node_type_decorator
import pillar.api.activities import pillar.api.activities
import pillar.api.utils.authentication import pillar.api.utils.authentication
@@ -42,10 +42,15 @@ def activity_after_replacing_shot(shot, original):
if len(changes) == 1: if len(changes) == 1:
(key, val_shot, _) = changes[0] (key, val_shot, _) = changes[0]
human_key = key.rsplit('.', 1)[-1] try:
human_key = human_readable_properties[key]
except KeyError:
human_key = pillar.web.jinja.format_undertitle(key.rsplit('.', 1)[-1])
if key == 'properties.status': if key == 'properties.status':
val_shot = pillar.web.jinja.format_undertitle(val_shot) val_shot = pillar.web.jinja.format_undertitle(val_shot)
descr = 'changed %s to %s in shot "%s"' % (human_key, val_shot, shot['name']) descr = 'changed "%s" to "%s" in shot "%s"' %\
(human_key, val_shot, shot['name'])
else: else:
descr = 'edited shot "%s"' % shot['name'] descr = 'edited shot "%s"' % shot['name']