diff --git a/TODO b/TODO index 36b9fdd..db4e85f 100644 --- a/TODO +++ b/TODO @@ -1,10 +1,6 @@ ## GENERAL - - * use new js/* in files.py: - - rename rotate->transforms - - then use in viewer to get transform buttons to work - * viewer: + buttons need tootltips can we make it preload next/prev images, and only reload the image div when we jump? to make arrow-based nav much faster im_next = new Image() im_next.src="..." @@ -12,15 +8,6 @@ - have to remember the details of not just the src fname, but also face* details - onload event, what if we use it and use say arrow keys to load/change image, will one beat the other, but if we arrow next too fast, the img wont be loaded? - fullscreen could maybe use a bit of this: - document.getElementById('canvas').requestFullscreen() - - buttons (with tootltips): - rot90, rot180, rot270 - flip h, flip z - fullscreen - to (re)do faces (always or somehow turn on for select???) - * remove dirs after the duplicate cleanup removes all its content * Face matching: @@ -39,7 +26,6 @@ * viewer needs to allow toggle to scan_model (and prob. right-click on file... AI (with CNN) AI (with hog) - make the form-select AI_Model actually do the change (but need more mem on mara really) - ## DB * Dir can have date in the DB, so we can do Oldest/Newest dirs in Folder view diff --git a/files.py b/files.py index 2a78495..36a6069 100644 --- a/files.py +++ b/files.py @@ -593,6 +593,7 @@ def view_img(id): # specific rotation job is finished (/checkrotatejob) which will be called (say) every 1 sec. from f/e # with a spinning wheel, then when pa_job_mgr has finished it will return the rotated thumb @app.route("/rotate", methods=["POST"]) +@app.route("/transform", methods=["POST"]) @login_required def rotate(): id = request.form['id'] @@ -617,6 +618,7 @@ def rotate(): # rotated image's thumbnail is returned so the f/e can # update with it ################################################################################ +@app.route("/checktransformjob", methods=["POST"]) @app.route("/checkrotatejob", methods=["POST"]) @login_required def checkrotatejob(): @@ -637,7 +639,6 @@ def checkrotatejob(): ################################################################################ @app.route("/internal/") def internal(filename): - print( filename ) return send_from_directory("internal/", filename) ################################################################################ diff --git a/internal/js/files_transform.js b/internal/js/files_transform.js new file mode 100644 index 0000000..496461a --- /dev/null +++ b/internal/js/files_transform.js @@ -0,0 +1,29 @@ +function CheckTransformJob(id,job_id) +{ + $.ajax( + { + type: 'POST', data: '&job_id='+job_id, url: '/checktransformjob', success: function(data) { + if( data.finished ) + { + $('#s'+id).hide() + $('#'+id).find('img.thumb').attr('style', 'filter: color(100%);' ); + $('#'+id).addClass('entry') + $('#'+id).find('.thumb').attr('src', 'data:image/jpeg;base64,'+data.thumbnail) + return false; + } + else + { + setTimeout( function() { CheckTransformJob(id,job_id) }, 1000,id, job_id ); + } + }, + } ) +} + +function Transform(amt) +{ + $('.highlight').each(function( id, e ) { + post_data = '&amt='+amt+'&id='+e.id + // send /transform for this image, grayscale the thumbmail, add color spinning wheel overlay, and start checking for job end + $.ajax({ type: 'POST', data: post_data, url: '/transform', success: function(data){ $('#'+e.id).find('img.thumb').attr('style', 'filter: grayscale(100%);' ); $('#'+e.id).removeClass('entry'); $('#s'+e.id).show(); CheckTransformJob(e.id,data.job_id); return false; } }) + } ) +} diff --git a/internal/js/transform.js b/internal/js/transform.js deleted file mode 100644 index b96d1ed..0000000 --- a/internal/js/transform.js +++ /dev/null @@ -1,29 +0,0 @@ -function CheckRotateJob(id,job_id) -{ - $.ajax( - { - type: 'POST', data: '&job_id='+job_id, url: '/checkrotatejob', success: function(data) { - if( data.finished ) - { - $('#s'+id).hide() - $('#'+id).find('img.thumb').attr('style', 'filter: color(100%);' ); - $('#'+id).addClass('entry') - $('#'+id).find('.thumb').attr('src', 'data:image/jpeg;base64,'+data.thumbnail) - return false; - } - else - { - setTimeout( function() { CheckRotateJob(id,job_id) }, 1000,id, job_id ); - } - }, - } ) -} - -function Rotate(amt) -{ - $('.highlight').each(function( id, e ) { - post_data = '&amt='+amt+'&id='+e.id - {# send rotate for this image, grayscale the thumbmail, add color spinning wheel overlay, and start checking for job end #} - $.ajax({ type: 'POST', data: post_data, url: '/rotate', success: function(data){ $('#'+e.id).find('img.thumb').attr('style', 'filter: grayscale(100%);' ); $('#'+e.id).removeClass('entry'); $('#s'+e.id).show(); CheckRotateJob(e.id,data.job_id); return false; } }) - } ) -} diff --git a/internal/js/view_transform.js b/internal/js/view_transform.js new file mode 100644 index 0000000..d8f45b6 --- /dev/null +++ b/internal/js/view_transform.js @@ -0,0 +1,28 @@ +function CheckTransformJob(id,job_id) +{ + $.ajax( + { + type: 'POST', data: '&job_id='+job_id, url: '/checktransformjob', success: function(data) { + if( data.finished ) + { + // stop throbber, remove grayscale & then force reload with timestamped version of im.src + grayscale=0 + throbber=0 + im.src=im.src + '?t=' + new Date().getTime(); + return false; + } + else + { + setTimeout( function() { CheckTransformJob(id,job_id) }, 1000,id, job_id ); + } + }, + } ) +} + +function Transform(amt) +{ + id=$('#current').val() + post_data = '&amt='+amt+'&id='+id + // send /transform for this image, grayscale the thumbmail, add color spinning wheel overlay, and start checking for job end + $.ajax({ type: 'POST', data: post_data, url: '/transform', success: function(data) { grayscale=1; throbber=1; DrawImg(); CheckTransformJob(id,data.job_id); return false; } }) +} diff --git a/templates/files.html b/templates/files.html index ecdb632..dfbdd3a 100644 --- a/templates/files.html +++ b/templates/files.html @@ -1,6 +1,9 @@ {% extends "base.html" %} {% block main_content %} + + +
@@ -233,277 +236,9 @@
{% endblock main_content %} {% block script_content %} + +