From 65c182f410a57919e9a45bb3f92bec2b5d917cf4 Mon Sep 17 00:00:00 2001 From: j Date: Mon, 20 Feb 2017 16:38:23 +0100 Subject: [PATCH] documentcollection icons --- pandora/documentcollection/models.py | 12 +++++++++++- pandora/settings.py | 1 + static/js/info.js | 6 +++++- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/pandora/documentcollection/models.py b/pandora/documentcollection/models.py index 93fbe12a..dc88f642 100644 --- a/pandora/documentcollection/models.py +++ b/pandora/documentcollection/models.py @@ -260,6 +260,16 @@ class Collection(models.Model): if 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') icon = self.icon.path if frames: @@ -270,7 +280,7 @@ class Collection(models.Model): for f in glob("%s/icon*.jpg" % folder): os.unlink(f) cmd = [ - settings.collection_ICON, + settings.COLLECTION_ICON, '-f', ','.join(frames), '-o', icon ] diff --git a/pandora/settings.py b/pandora/settings.py index a0435826..3c709514 100644 --- a/pandora/settings.py +++ b/pandora/settings.py @@ -231,6 +231,7 @@ SCRIPT_ROOT = normpath(join(PROJECT_ROOT, '..', 'scripts')) ITEM_POSTER = join(SCRIPT_ROOT, 'poster.py') ITEM_ICON = join(SCRIPT_ROOT, 'item_icon.py') LIST_ICON = join(SCRIPT_ROOT, 'list_icon.py') +COLLECTION_ICON = join(SCRIPT_ROOT, 'list_icon.py') DB_GIN_TRGM = False diff --git a/static/js/info.js b/static/js/info.js index c12fbf74..1fe902e3 100644 --- a/static/js/info.js +++ b/static/js/info.js @@ -364,7 +364,11 @@ pandora.ui.listInfo = function() { } 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); return Ox.extend({ width: size + 'px',