add infomation support
This commit is contained in:
parent
144e2c585d
commit
4f941f606b
|
@ -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]))
|
|
@ -91,6 +91,28 @@ def scriptHandle(scriptPath):
|
|||
cells = dbCells,
|
||||
links = dbLinks)
|
||||
|
||||
@app.route('/<path:scriptPath>', 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()
|
||||
|
||||
|
|
|
@ -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("<p><b>" + key + ":</b><br />" + data[key] +"</p>")
|
||||
}
|
||||
|
||||
$("#propertyWindow-main").show();
|
||||
});
|
||||
}
|
||||
|
||||
function closePropertyWindow() {
|
||||
$("#propertyWindow-main").hide();
|
||||
}
|
||||
|
|
|
@ -62,7 +62,7 @@
|
|||
{% for i in cells %}
|
||||
<div class="{% if i[6] == 0 %}cell-plocal{% elif i[6] == 1 %}cell-shortcut{% elif i[6] == 2 %}cell-pio{% elif i[6] == 3 %}cell-bio{% else %}cell-ptarget{% endif %}"
|
||||
style="height: {% if i[6] == 2 or i[6] == 3 %}6{% else %}5{% endif %}px; width: {% if i[6] == 2 or i[6] == 3 %}6{% else %}15{% endif %}px; top: {{ i[5] }}px; left: {{ i[4] }}px;"
|
||||
title="{{ "Name: %s\nType: %s"|format(i[2], i[3]) }}"></div>
|
||||
title="{{ "Name: %s\nType: %s"|format(i[2], i[3]) }}" ondblclick="queryInfo({{ i[1] }});"></div>
|
||||
{% endfor %}
|
||||
|
||||
<svg version="1.1" width="{{ gWidth }}px" height="{{ gHeight }}px" style="position: absolute; top: 0; left: 0;pointer-events: none;">
|
||||
|
@ -81,7 +81,14 @@
|
|||
</line>-->
|
||||
</svg>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div id="propertyWindow-main" style="position: absolute; background: #0000007f; width: 100%; height: 100%; top: 0; left: 0; display: none;">
|
||||
<div style="position: absolute; background: white; width: 50%; height: 50%; top: 25%; left: 25%; display: flex; flex-flow: column;">
|
||||
<p style="margin: 5px;">Properties of <b id="propertyWindow-id"></b></p>
|
||||
<div id="propertyWindow-container" style="width: 100%; height: 100%; overflow: scroll;">
|
||||
</div>
|
||||
<button style="width: 100px; height: 25px; margin: 5px;" onclick="closePropertyWindow();">Close</button>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user