Skip to content

Commit

Permalink
added option to display truncated path of Cicero sequences
Browse files Browse the repository at this point in the history
  • Loading branch information
edjoesu committed Apr 4, 2013
1 parent 6562d4d commit 84094fd
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
3 changes: 3 additions & 0 deletions filelist/filesettings.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
IMG_LOCS = {"pixis":"C:\\Dropbox\\imgpixis\\","pflyold":"C:\\Dropbox\\imgpflyold", "pfly":"C:\\Dropbox\\imgpfly", "andor":"C:\\Dropbox\\imgandor"}
RL_LOCS = {"crunlogs":"C:\\runlogs\\"}
STATIC_DIR = "./static/"

PNG_DIR = "C:\\django\\django\\clinamen\\static\\png\\"
PNG_URL = "../../../static/png/"
THUMB_DIR = "C:\\django\\django\\clinamen\\static\\thumb\\"
THUMB_URL = "../../../static/thumb/"
THUMB_SIZE = 64

SHORT_PATH_LEVELS = 2

11 changes: 10 additions & 1 deletion filelist/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from django.core.paginator import Paginator
from django.template import RequestContext
from clinamen.filelist.models import *
import clinamen.filelist.filesettings as filesettings
import populatedb
import datetime
import json
Expand All @@ -16,6 +17,7 @@ def imagelist(request, url):

def runloglist(request, url):
runlog_list = get_list_or_404(RunLogInfo)
addshortpath(runloglist, filesettings.SHORT_PATH_LEVELS)
return render_to_response('runloglist.html', {'runlog_list': runlog_list})

def render_methodlist(imagetype):
Expand Down Expand Up @@ -120,6 +122,7 @@ def filteredlist(request, url):
if 'updateimg' in request.GET:
populatedb.updateimagesbytime()
q=applyfilters(request)
addshortpath(q, filesettings.SHORT_PATH_LEVELS)
return render_to_response('runloglist.html', {'runlog_list': q}, context_instance=RequestContext(request))

def filteredzip(request, url):
Expand Down Expand Up @@ -254,7 +257,13 @@ def uniquify(seq):
seen_add = seen.add
return [ x for x in seq if x not in seen and not seen_add(x)]


def addshortpath(obj_list, levels_to_keep):
for obj in obj_list:
try:
match = re.search(r"(\\[^\\]*){1," + str(levels_to_keep) + r"}$", obj.sequencepath)
obj.shortpath = match.group(0)
except:
obj.shortpath = ""



Expand Down

0 comments on commit 84094fd

Please sign in to comment.