This commit is contained in:
j 2011-10-09 15:41:09 +02:00
commit 237a6ea39d
11 changed files with 99 additions and 55 deletions

View file

@ -10,13 +10,13 @@
"canSeeExtraItemViews": {"friend": true, "staff": true, "admin": true}
},
"clipKeys": [
{"id": "clip:text", "title": "Text", "type": "string"},
{"id": "clip:position", "title": "Position", "type": "float"},
{"id": "clip:duration", "title": "Duration", "type": "float"},
{"id": "clip:hue", "title": "Hue", "type": "hue"},
{"id": "clip:saturation", "title": "Saturation", "type": "float"},
{"id": "clip:lightness", "title": "Lightness", "type": "float"},
{"id": "clip:volume", "title": "Volume", "type": "float"}
{"id": "text", "title": "Text", "type": "string"},
{"id": "position", "title": "Position", "type": "float", "sortOperator": "-"},
{"id": "duration", "title": "Duration", "type": "float"},
{"id": "hue", "title": "Hue", "type": "float", "sortOperator": "-"},
{"id": "saturation", "title": "Saturation", "type": "float"},
{"id": "lightness", "title": "Lightness", "type": "float"},
{"id": "volume", "title": "Volume", "type": "float"}
],
"groups": [
{"id": "director", "title": "Director", "type": "string"},
@ -298,9 +298,10 @@
{
"id": "hue",
"title": "Hue",
"type": "hue",
"type": "float",
"columnWidth": 90,
"format": {"type": "color", "args": ["hue"]}
"format": {"type": "color", "args": ["hue"]},
"sortOperator": "-"
},
{
"id": "saturation",
@ -567,7 +568,7 @@
"icons": "posters",
"infoIconSize": 256,
"item": "",
"itemSort": [{"key": "clip:position", "operator": "+"}],
"itemSort": [{"key": "position", "operator": "+"}],
"itemView": "info",
"listColumns": ["title", "director", "country", "year", "language", "runtime", "genre"],
"listColumnWidth": {},

View file

@ -50,13 +50,14 @@ class Clip(models.Model):
def json(self, keys=None):
j = {}
clip_keys = ('id', 'in', 'out', 'created', 'modified',
clip_keys = ('id', 'in', 'out', 'position', 'created', 'modified',
'hue', 'saturation', 'lightness', 'volume')
for key in clip_keys:
j[key] = getattr(self, {
'id': 'public_id',
'in': 'start',
'out': 'end',
'position': 'start',
}.get(key, key))
if keys:
for key in j.keys():

View file

@ -31,9 +31,14 @@ def order_query(qs, sort):
operator = e['operator']
if operator != '-':
operator = ''
clip_keys = ('public_id', 'start', 'end', 'hue', 'saturation', 'lightness', 'volume',
'annotations__value')
key = {
'id': 'public_id',
'in': 'start',
'out': 'end',
'position': 'start',
'text': 'annotations__value',
}.get(e['key'], e['key'])
if key.startswith('clip:'):
key = e['key'][len('clip:'):]
@ -41,7 +46,7 @@ def order_query(qs, sort):
'text': 'annotations__value',
'position': 'start',
}.get(key, key)
elif key not in ('start', 'end', 'annotations__value'):
elif key not in clip_keys:
#key mgith need to be changed, see order_sort in item/views.py
key = "item__sort__%s" % key
order = '%s%s' % (operator, key)