This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def modify_time_sort(file_name): | |
file_path = "uploads/{}".format(file_name) | |
file_stats = os.stat(file_path) | |
last_access_time = file_stats.st_atime | |
return last_access_time |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@app.route("/filenames", methods=["GET"]) | |
def get_filenames(): | |
filenames = os.listdir("uploads/") | |
modify_time_sort = lambda f: os.stat("uploads/{}".format(f)).st_atime | |
filenames = sorted(filenames, key=modify_time_sort) | |
return_dict = dict(filenames=filenames) | |
return jsonify(return_dict) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var refreshFilenameList = function(data){ | |
// Standard handlebars template stuff. | |
var templateText = $("#tableTemplate").html(); | |
var template = Handlebars.compile(templateText); | |
var renderedText = template(data); | |
var renderedDom = $(renderedText); | |
$("#tablearea").empty(); | |
$("#tablearea").append(renderedDom); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var dropHandler = function(evt){ | |
evt.preventDefault(); | |
var files = evt.originalEvent.dataTransfer.files; | |
var formData = new FormData(); | |
formData.append("file2upload", files[0]); | |
var req = { | |
url: "/sendfile", | |
method: "post", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app.config["UPLOAD_FOLDER"] = "uploads" | |
@app.route("/sendfile", methods=["POST"]) | |
def send_file(): | |
fileob = request.files["file2upload"] | |
filename = secure_filename(fileob.filename) | |
save_path = "{}/{}".format(app.config["UPLOAD_FOLDER"], filename) | |
fileob.save(save_path) | |
return "successful_upload" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var dragHandler = function(evt){ | |
evt.preventDefault(); | |
}; | |
var dropHandler = function(evt){ | |
evt.preventDefault(); | |
var files = evt.originalEvent.dataTransfer.files; | |
console.log(files[0]); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<style> | |
.droparea { | |
width: 200px; | |
height: 200px; | |
border-style: solid; | |
border-width: 3px; | |
border-color: red; | |
float: left; | |
line-height: 200px; | |
text-align: center; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import bpy | |
from bpy.props import IntProperty | |
def points(strokes): | |
for stroke in strokes: | |
for point in stroke.points: | |
yield point | |
class GreaseEmpties(bpy.types.Operator): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
ShapeMaker.py | |
A just for fun blender operator that sticks a mesh into the current scene. | |
Mainly just a 'revisiting' exercise in operators that make specialized mesh objects. | |
""" | |
import bpy | |
import bmesh | |
from bpy.props import FloatProperty |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import bpy | |
import bmesh | |
if __name__ == '__main__': | |
verts = [(-5, 0, 0), | |
(5, 0, 0), | |
(2, 5, 0),] | |
mesh = bpy.data.meshes.new("mymesh") | |
bm = bmesh.new() |