fix some bugs

This commit is contained in:
yyc12345 2020-04-12 16:02:20 +08:00
parent 812ea62561
commit 9d3d7e8aad
4 changed files with 39 additions and 26 deletions

View File

@ -33,7 +33,7 @@ def initDecorateDb(db):
cur.execute("CREATE TABLE graph([graph] INTEGER, [graph_name] TEXT, [width] INTEGER, [height] INTEGER, [index] INTEGER, [belong_to] TEXT);")
cur.execute("CREATE TABLE info([target] INTEGER, [field] TEXT, [data] TEXT);")
cur.execute("CREATE TABLE block([belong_to_graph] INETGER, [thisobj] INTEGER, [name] TEXT, [assist_text] TEXT, [pin-pin] TEXT, [pin-pout] TEXT, [pin-bin] TEXT, [pin-bout] TEXT, [x] REAL, [y] REAL, [width] REAL, [height] REAL, [expandable] INTEGER);")
cur.execute("CREATE TABLE block([belong_to_graph] INETGER, [thisobj] INTEGER, [name] TEXT, [assist_text] TEXT, [pin-ptarget] TEXT, [pin-pin] TEXT, [pin-pout] TEXT, [pin-bin] TEXT, [pin-bout] TEXT, [x] REAL, [y] REAL, [width] REAL, [height] REAL, [expandable] INTEGER);")
cur.execute("CREATE TABLE cell([belong_to_graph] INETGER, [thisobj] INTEGER, [name] TEXT, [assist_text] TEXT, [x] REAL, [y] REAL, [type] INTEGER);")
cur.execute("CREATE TABLE link([belong_to_graph] INETGER, [thisobj] INTEGER, [delay] INTEGER, [startobj] INTEGER, [endobj] INTEGER, [start_index] INTEGER, [end_index] INTEGER, [x1] REAL, [y1] REAL, [x2] REAL, [y2] REAL);")
@ -141,7 +141,7 @@ def buildBlock(exDb, deDb, target, currentGraphBlockCell):
layer_height[curLayer] = max(layer_height.get(curLayer, 0), bbResult[i].height)
layer_height[arrangedLayer] = layer_height.get(arrangedLayer, 0) # make sure misc bb height exist
for i in occupiedLayerCountForSpecificBB.keys(): # add oper occipation
layer_height[i] += occupiedLayerCountForSpecificBB[i] * dcv.GRAPH_SPAN_BB_POPER
layer_height[i] += (occupiedLayerCountForSpecificBB[i] + 1) * dcv.GRAPH_SPAN_BB_POPER
# calc bb Y
baseY = dcv.GRAPH_CONTENTOFFSET_Y
@ -190,7 +190,7 @@ def buildBlock(exDb, deDb, target, currentGraphBlockCell):
exCur.execute("SELECT [thisobj], [name], [type] FROM pTarget WHERE [belong_to] == ?;", (i,))
temp = exCur.fetchone()
if temp == None:
cache.ptargetData = ''
cache.ptargetData = '{}'
else:
cache.ptargetData = json.dumps(dcv.PinInformation(temp[0], temp[1], temp[2]), cls = dcv.JsonCustomEncoder)
@ -244,12 +244,12 @@ def buildBlock(exDb, deDb, target, currentGraphBlockCell):
for i in bbResult.keys():
cache = bbResult[i]
currentGraphBlockCell[i] = dcv.BlockCellItem(cache.x, cache.y, cache.width, cache.height)
deCur.execute('INSERT INTO block VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)',
(target, i, cache.name, cache.assistName, cache.pinData, cache.poutData, cache.binData, cache.boutData, cache.x, cache.y, cache.width, cache.height, cache.expandable))
deCur.execute('INSERT INTO block VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)',
(target, i, cache.name, cache.assistName, cache.ptargetData, cache.pinData, cache.poutData, cache.binData, cache.boutData, cache.x, cache.y, cache.width, cache.height, cache.expandable))
for i in operResult.keys():
cache = operResult[i]
currentGraphBlockCell[i] = dcv.BlockCellItem(cache.x, cache.y, cache.width, cache.height)
deCur.execute("INSERT INTO block VALUES (?, ?, ?, '', ?, ?, '[]', '[]', ?, ?, ?, ?, -1)",
deCur.execute("INSERT INTO block VALUES (?, ?, ?, '', '{}', ?, ?, '[]', '[]', ?, ?, ?, ?, -1)",
(target, i, cache.name, cache.pinData, cache.poutData, cache.x, cache.y, cache.width, cache.height))
def recursiveBuildBBTree(node, exCur, processedBB, layer, depth, graphId):

View File

@ -24,9 +24,14 @@ def close_connection(exception):
db.close()
@app.template_global(name = 'pinDecoder')
def block_pin_filter(target):
def block_pin_decoder(target):
return json.loads(target)
@app.template_global(name = 'pinDecoder2')
def block_pin_decoder2(target):
vab = json.loads(target)
return [vab['name'], vab['type']]
@app.route('/', methods=['GET'])
def indexHandle():
cur = get_db().cursor()

View File

@ -3,6 +3,11 @@ p.hamburger {
padding: 0;
}
div.block-target {
position: absolute;
background: green;
}
div.block-b {
position: absolute;
background: yellow;
@ -34,7 +39,7 @@ p.block-asstext {
margin: 0;
padding: 0;
font-size: 9px;
color: white
color: white;
}
div.block-body {
@ -45,7 +50,7 @@ div.block-body {
div.cell-ptarget {
position: absolute;
background: green
background: green;
border: 1px solid #cfcfcf;
}
@ -57,18 +62,18 @@ div.cell-plocal {
div.cell-shortcut {
position: absolute;
background: purple
background: purple;
border: 1px solid #cfcfcf;
}
div.cell-pio {
position: absolute;
background: blue
background: blue;
border: 1px solid #cfcfcf;
}
div.cell-bio {
position: absolute;
background: yellow
background: yellow;
border: 1px solid #cfcfcf;
}

View File

@ -37,22 +37,25 @@
</svg>
{# blocks content #}
{% for i in blocks %}
<div class="block-body" style="height: {{ i[11] }}px; width: {{ i[10] }}px; top: {{ i[9] }}px; left: {{ i[8] }}px;">
{% for pin in pinDecoder(i[4]) %}
<div class="block-p" title="{{ "Name: %s &#13;Type: %s"|format(pin.name, pin.type) }}" style="height: 6px; width: 6px; top: 0; left: {{ 20 + loop.index0 * ( 6 + 20) }}px;"></div>
<div class="block-body" style="height: {{ i[12] }}px; width: {{ i[11] }}px; top: {{ i[10] }}px; left: {{ i[9] }}px;">
{% if i[4] != '{}' %}
<div class="block-target" title="{{ "Name: %s\nType: %s"|format(*pinDecoder2(i[4])) }}" style="height: 6px; width: 6px; top: 0; left: 0;"></div>
{% endif %}
{% for pin in pinDecoder(i[5]) %}
<div class="block-p" title="{{ "Name: %s\nType: %s"|format(pin.name, pin.type) }}" style="height: 6px; width: 6px; top: 0; left: {{ 20 + loop.index0 * ( 6 + 20) }}px;"></div>
{% endfor %}
{% for pout in pinDecoder(i[5]) %}
<div class="block-p" title="{{ "Name: %s &#13;Type: %s"|format(pout.name, pout.type) }}" style="height: 6px; width: 6px; bottom: 0; left: {{ 20 + loop.index0 * ( 6 + 20) }}px;"></div>
{% for pout in pinDecoder(i[6]) %}
<div class="block-p" title="{{ "Name: %s\nType: %s"|format(pout.name, pout.type) }}" style="height: 6px; width: 6px; bottom: 0; left: {{ 20 + loop.index0 * ( 6 + 20) }}px;"></div>
{% endfor %}
{% for bin in pinDecoder(i[6]) %}
<div class="block-b" title="{{ "Name: %s &#13;Type: %s"|format(bin.name, bin.type) }}" style="height: 6px; width: 6px; top: {{ 10 + loop.index0 * ( 6 + 20) }}px; left: 0;"></div>
{% for bin in pinDecoder(i[7]) %}
<div class="block-b" title="{{ "Name: %s\nType: %s"|format(bin.name, bin.type) }}" style="height: 6px; width: 6px; top: {{ 10 + loop.index0 * ( 6 + 20) }}px; left: 0;"></div>
{% endfor %}
{% for bout in pinDecoder(i[7]) %}
<div class="block-b" title="{{ "Name: %s &#13;Type: %s"|format(bout.name, bout.type) }}" style="height: 6px; width: 6px; top: {{ 10 + loop.index0 * ( 6 + 20) }}px; right: 0;"></div>
{% for bout in pinDecoder(i[8]) %}
<div class="block-b" title="{{ "Name: %s\nType: %s"|format(bout.name, bout.type) }}" style="height: 6px; width: 6px; top: {{ 10 + loop.index0 * ( 6 + 20) }}px; right: 0;"></div>
{% endfor %}
{% if i[12] != -1 %}
<p class="block-expandable-text" style="top: 10px; left: 20px;"><a href="{{ "/%s/%s"|format(currentPath, i[12]) }}">{{ i[2]|e }}</a></p>
{% if i[13] != -1 %}
<p class="block-expandable-text" style="top: 10px; left: 20px;"><a href="{{ "/%s/%s"|format(currentPath, i[13]) }}">{{ i[2]|e }}</a></p>
{% else %}
<p class="block-text" style="top: 10px; left: 20px;">{{ i[2]|e }}</p>
{% endif %}
@ -62,9 +65,9 @@
{# cells content #}
{% 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 %}bio{% else %}cell-ptarget{% endif %}"
style="height: 5px; width: 15px; top: {{ i[5] }}px; left: {{ i[4] }}px;"
title="{{ "Name: %s &#13;Type: %s"|format(i[2], i[3]) }}"></div>
<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>
{% endfor %}
</div>