RGB only, add resetUI url

This commit is contained in:
j 2011-10-21 20:36:21 +02:00
parent 624a69a89f
commit e1c62e831e
3 changed files with 13 additions and 1 deletions

View file

@ -291,7 +291,7 @@ def average_color(prefix, start=0, end=0):
timelines = sorted(filter(lambda t: t!= '%s%sp.png'%(prefix,height), glob("%s%sp*.png"%(prefix, height))))
for image in timelines:
start_offset = 0
timeline = Image.open(image)
timeline = Image.open(image).convert('RGB')
frames += timeline.size[0]
if start and frames < start:
continue

View file

@ -27,6 +27,7 @@ urlpatterns = patterns('',
(r'^url=(?P<url>.*)$', 'app.views.redirect_url'),
(r'^file/(?P<oshash>.*)$', 'archive.views.lookup_file'),
(r'^api/$', include('api.urls')),
(r'^resetUI$', 'user.views.reset_ui'),
(r'', include('item.urls')),
(r'^list/(?P<id>.*?)/icon(?P<size>\d*).jpg$', 'itemlist.views.icon'),
(r'^robots.txt$', serve_static_file, {'location': os.path.join(settings.STATIC_ROOT, 'robots.txt'), 'content_type': 'text/plain'}),

View file

@ -12,6 +12,7 @@ from django.utils import simplejson as json
from django.conf import settings
from django.core.mail import send_mail, BadHeaderError
from django.db.models import Sum
from django.shortcuts import redirect
from ox.django.shortcuts import render_to_json_response, json_response, get_object_or_404_json
from ox.django.decorators import admin_required_json, login_required_json
@ -607,6 +608,16 @@ def editPreferences(request):
actions.register(editPreferences, cache=False)
def reset_ui(request):
response = json_response()
if request.user.is_authenticated():
profile = request.user.get_profile()
profile.ui = {}
profile.save()
else:
request.session['ui'] = '{}'
return redirect('/')
def resetUI(request):
'''
reset user ui settings to defaults