documentcollection icons

This commit is contained in:
j 2017-02-20 16:38:23 +01:00
parent 9021f6d075
commit 65c182f410
3 changed files with 17 additions and 2 deletions

View file

@ -260,6 +260,16 @@ class Collection(models.Model):
if frame: if frame:
frames.append(frame) frames.append(frame)
''' '''
from item.models import Item
for i in self.poster_frames:
try:
qs = Item.objects.filter(public_id=i['item'])
if qs.count() > 0:
frame = qs[0].frame(i['position'])
if frame:
frames.append(frame)
except:
pass
self.icon.name = self.path('icon.jpg') self.icon.name = self.path('icon.jpg')
icon = self.icon.path icon = self.icon.path
if frames: if frames:
@ -270,7 +280,7 @@ class Collection(models.Model):
for f in glob("%s/icon*.jpg" % folder): for f in glob("%s/icon*.jpg" % folder):
os.unlink(f) os.unlink(f)
cmd = [ cmd = [
settings.collection_ICON, settings.COLLECTION_ICON,
'-f', ','.join(frames), '-f', ','.join(frames),
'-o', icon '-o', icon
] ]

View file

@ -231,6 +231,7 @@ SCRIPT_ROOT = normpath(join(PROJECT_ROOT, '..', 'scripts'))
ITEM_POSTER = join(SCRIPT_ROOT, 'poster.py') ITEM_POSTER = join(SCRIPT_ROOT, 'poster.py')
ITEM_ICON = join(SCRIPT_ROOT, 'item_icon.py') ITEM_ICON = join(SCRIPT_ROOT, 'item_icon.py')
LIST_ICON = join(SCRIPT_ROOT, 'list_icon.py') LIST_ICON = join(SCRIPT_ROOT, 'list_icon.py')
COLLECTION_ICON = join(SCRIPT_ROOT, 'list_icon.py')
DB_GIN_TRGM = False DB_GIN_TRGM = False

View file

@ -364,7 +364,11 @@ pandora.ui.listInfo = function() {
} }
function getIconCSS() { function getIconCSS() {
var list = pandora.user.ui.section == 'items' ? pandora.user.ui._list : ui[folderItem.toLowerCase()], var list = pandora.user.ui.section == 'items'
? pandora.user.ui._list
: pandora.user.ui.section == 'documents'
? pandora.user.ui._collection
: ui[folderItem.toLowerCase()],
size = Math.round(pandora.user.ui.sidebarSize / 2); size = Math.round(pandora.user.ui.sidebarSize / 2);
return Ox.extend({ return Ox.extend({
width: size + 'px', width: size + 'px',