renamed pa_pref to better named pa_user_state, changed code to adapt and made new_view and viewlist work with newer Options/pa_user_state - still more work but it should be functional again

This commit is contained in:
2022-01-20 14:13:50 +11:00
parent 94780119c4
commit 4fa7b4b2d3
6 changed files with 30 additions and 222 deletions

View File

@@ -20,7 +20,7 @@ import re
import json
import datetime
from flask_login import login_required, current_user
from options import Options
from states import Options
################################################################################
# Local Class imports
@@ -526,6 +526,9 @@ def viewlist():
objs = {}
eids=""
for e in entries:
if not e.file_details:
print( f"seems {e.name} is not a file? -- {e.type}" )
continue
objs[e.id]=e
# get new eids for viewer.html
eids=eids+f"{e.id},"
@@ -550,14 +553,22 @@ def viewlist():
def newview_img(id):
OPT=Options( request )
objs = {}
lst = OPT.view_eids.split(',')
print( f"lst={lst}" )
for e in Entry.query.join(File).filter(Entry.id.in_(lst)).all():
print( OPT )
entries=GetEntries( OPT )
eids=""
for e in entries:
print( f"in loop deal with: {e.id}")
objs[e.id]=e
eids += f"{e.id},"
if not e.file_details:
print( f"seems {e.name} is not a file? -- {e.type}" )
continue
# put locn data back into array format
for face in e.file_details.faces:
face.locn = json.loads(face.locn)
return render_template("viewer.html", current=int(id), eids=OPT.view_eids, objs=objs, OPT=OPT )
print("now render the viewer" )
eids=eids.rstrip(",")
return render_template("viewer.html", current=int(id), eids=eids, objs=objs, OPT=OPT )
################################################################################
# /view/id -> grabs data from DB and views it
@@ -566,17 +577,7 @@ def newview_img(id):
@login_required
def view_img(id):
OPT=Options( request )
# return redirect( "/new_view/" + id );
objs = {}
OPT.view_eids = request.form['eids'].rstrip(',')
lst = OPT.view_eids.split(',')
print( f"lst={lst}" )
for e in Entry.query.join(File).filter(Entry.id.in_(lst)).all():
objs[e.id]=e
# put locn data back into array format
for face in e.file_details.faces:
face.locn = json.loads(face.locn)
return render_template("viewer.html", current=int(id), eids=OPT.view_eids, objs=objs, OPT=OPT )
return redirect( "/new_view/" + id );
# route called from front/end - if multiple images are being transformed, each transorm == a separate call
# to this route (and therefore a separate transorm job. Each reponse allows the f/e to check the