diff --git a/SuperScriptViewer/DecoratorCore.py b/SuperScriptViewer/DecoratorCore.py index d0638d6..d3e8ce2 100644 --- a/SuperScriptViewer/DecoratorCore.py +++ b/SuperScriptViewer/DecoratorCore.py @@ -23,6 +23,8 @@ def run(): (gWidth, gHeight) = buildCell(exportDb, decorateDb, i, currentGraphBlockCell) buildLink(exportDb, decorateDb, i, currentGraphBlockCell, gWidth, gHeight) + # export information + buildInfo(exportDb, decorateDb) # give up all change of eexport.db (because no change) exportDb.close() @@ -536,3 +538,12 @@ def computLinkBTerminal(obj, type, index, currentGraphBlockCell, target, maxWidt return (cache.x, cache.y + dcv.BB_BOFFSET + index * (dcv.BB_PBSIZE + dcv.BB_BSPAN)) else: # bOut return (cache.x + cache.w - dcv.BB_PBSIZE, cache.y + dcv.BB_BOFFSET + index * (dcv.BB_PBSIZE + dcv.BB_BSPAN)) + +def buildInfo(exDb, deDb): + exCur = exDb.cursor() + deCur = deDb.cursor() + + # export local data (including proto bb internal data) + exCur.execute("SELECT * FROM pLocalData;") + for i in exCur.fetchall(): + deCur.execute("INSERT INTO info VALUES (?, ?, ?)", (i[2], i[0], i[1])) \ No newline at end of file diff --git a/SuperScriptViewer/ServerCore.py b/SuperScriptViewer/ServerCore.py index 6004c0f..2986e28 100644 --- a/SuperScriptViewer/ServerCore.py +++ b/SuperScriptViewer/ServerCore.py @@ -91,6 +91,28 @@ def scriptHandle(scriptPath): cells = dbCells, links = dbLinks) +@app.route('/', methods=['POST']) +def infoMoveHandle(scriptPath): + cache = request.form['operation'] + if cache == "info": + return infoHandle(request.form['target']) + elif cache == "move": + return moveHandle(request.form['target']) + else: + abort(400) + +def infoHandle(target): + cur = get_db().cursor() + cur.execute("SELECT [field], [data] FROM info WHERE [target] == ?", (target, )) + data = {} + for i in cur.fetchall(): + data[i[0]] = i[1] + + return data + +def moveHandle(target): + return {} + def run(): app.run() diff --git a/SuperScriptViewer/static/site.js b/SuperScriptViewer/static/site.js index ac9dc4a..d3681ff 100644 --- a/SuperScriptViewer/static/site.js +++ b/SuperScriptViewer/static/site.js @@ -29,3 +29,27 @@ function highlightLink(target) { //cancel event seperate event.stopPropagation(); } + +function queryInfo(obj) { + $.post(window.location, + { + operation: "info", + target: obj + }, + function(data, status) { + //set id + $("#propertyWindow-id").text(obj); + + //set data + $("#propertyWindow-container").empty() + for (var key in data) { + $("#propertyWindow-container").append("

" + key + ":
" + data[key] +"

") + } + + $("#propertyWindow-main").show(); + }); +} + +function closePropertyWindow() { + $("#propertyWindow-main").hide(); +} diff --git a/SuperScriptViewer/templates/viewer.html b/SuperScriptViewer/templates/viewer.html index 231a575..fcdfa56 100644 --- a/SuperScriptViewer/templates/viewer.html +++ b/SuperScriptViewer/templates/viewer.html @@ -62,7 +62,7 @@ {% for i in cells %}
+ title="{{ "Name: %s\nType: %s"|format(i[2], i[3]) }}" ondblclick="queryInfo({{ i[1] }});"> {% endfor %} @@ -81,7 +81,14 @@ --> - + +