fix some bugs
This commit is contained in:
		@ -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 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 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 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);")
 | 
					    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[curLayer] = max(layer_height.get(curLayer, 0), bbResult[i].height)
 | 
				
			||||||
    layer_height[arrangedLayer] = layer_height.get(arrangedLayer, 0) # make sure misc bb height exist
 | 
					    layer_height[arrangedLayer] = layer_height.get(arrangedLayer, 0) # make sure misc bb height exist
 | 
				
			||||||
    for i in occupiedLayerCountForSpecificBB.keys():   # add oper occipation
 | 
					    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
 | 
					    # calc bb Y
 | 
				
			||||||
    baseY = dcv.GRAPH_CONTENTOFFSET_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,))
 | 
					        exCur.execute("SELECT [thisobj], [name], [type] FROM pTarget WHERE [belong_to] == ?;", (i,))
 | 
				
			||||||
        temp = exCur.fetchone()
 | 
					        temp = exCur.fetchone()
 | 
				
			||||||
        if temp == None:
 | 
					        if temp == None:
 | 
				
			||||||
            cache.ptargetData = ''
 | 
					            cache.ptargetData = '{}'
 | 
				
			||||||
        else:
 | 
					        else:
 | 
				
			||||||
            cache.ptargetData = json.dumps(dcv.PinInformation(temp[0], temp[1], temp[2]), cls = dcv.JsonCustomEncoder)
 | 
					            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():
 | 
					    for i in bbResult.keys():
 | 
				
			||||||
        cache = bbResult[i]
 | 
					        cache = bbResult[i]
 | 
				
			||||||
        currentGraphBlockCell[i] = dcv.BlockCellItem(cache.x, cache.y, cache.width, cache.height)
 | 
					        currentGraphBlockCell[i] = dcv.BlockCellItem(cache.x, cache.y, cache.width, cache.height)
 | 
				
			||||||
        deCur.execute('INSERT INTO block VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)',
 | 
					        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))
 | 
					                      (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():
 | 
					    for i in operResult.keys():
 | 
				
			||||||
        cache = operResult[i]
 | 
					        cache = operResult[i]
 | 
				
			||||||
        currentGraphBlockCell[i] = dcv.BlockCellItem(cache.x, cache.y, cache.width, cache.height)
 | 
					        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))
 | 
					                      (target, i, cache.name, cache.pinData, cache.poutData, cache.x, cache.y, cache.width, cache.height))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def recursiveBuildBBTree(node, exCur, processedBB, layer, depth, graphId):
 | 
					def recursiveBuildBBTree(node, exCur, processedBB, layer, depth, graphId):
 | 
				
			||||||
 | 
				
			|||||||
@ -24,9 +24,14 @@ def close_connection(exception):
 | 
				
			|||||||
        db.close()
 | 
					        db.close()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@app.template_global(name = 'pinDecoder')
 | 
					@app.template_global(name = 'pinDecoder')
 | 
				
			||||||
def block_pin_filter(target):
 | 
					def block_pin_decoder(target):
 | 
				
			||||||
    return json.loads(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'])
 | 
					@app.route('/', methods=['GET'])
 | 
				
			||||||
def indexHandle():
 | 
					def indexHandle():
 | 
				
			||||||
    cur = get_db().cursor()
 | 
					    cur = get_db().cursor()
 | 
				
			||||||
 | 
				
			|||||||
@ -3,6 +3,11 @@ p.hamburger {
 | 
				
			|||||||
    padding: 0;
 | 
					    padding: 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					div.block-target {
 | 
				
			||||||
 | 
					    position: absolute;
 | 
				
			||||||
 | 
					    background: green;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
div.block-b {
 | 
					div.block-b {
 | 
				
			||||||
    position: absolute;
 | 
					    position: absolute;
 | 
				
			||||||
    background: yellow;
 | 
					    background: yellow;
 | 
				
			||||||
@ -34,7 +39,7 @@ p.block-asstext {
 | 
				
			|||||||
    margin: 0; 
 | 
					    margin: 0; 
 | 
				
			||||||
    padding: 0;
 | 
					    padding: 0;
 | 
				
			||||||
    font-size: 9px;
 | 
					    font-size: 9px;
 | 
				
			||||||
    color: white
 | 
					    color: white;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
div.block-body {
 | 
					div.block-body {
 | 
				
			||||||
@ -45,7 +50,7 @@ div.block-body {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
div.cell-ptarget {
 | 
					div.cell-ptarget {
 | 
				
			||||||
    position: absolute;
 | 
					    position: absolute;
 | 
				
			||||||
    background: green
 | 
					    background: green;
 | 
				
			||||||
    border: 1px solid #cfcfcf;
 | 
					    border: 1px solid #cfcfcf;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -57,18 +62,18 @@ div.cell-plocal {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
div.cell-shortcut {
 | 
					div.cell-shortcut {
 | 
				
			||||||
    position: absolute;
 | 
					    position: absolute;
 | 
				
			||||||
    background: purple
 | 
					    background: purple;
 | 
				
			||||||
    border: 1px solid #cfcfcf;
 | 
					    border: 1px solid #cfcfcf;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
div.cell-pio {
 | 
					div.cell-pio {
 | 
				
			||||||
    position: absolute;
 | 
					    position: absolute;
 | 
				
			||||||
    background: blue
 | 
					    background: blue;
 | 
				
			||||||
    border: 1px solid #cfcfcf;
 | 
					    border: 1px solid #cfcfcf;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
div.cell-bio {
 | 
					div.cell-bio {
 | 
				
			||||||
    position: absolute;
 | 
					    position: absolute;
 | 
				
			||||||
    background: yellow
 | 
					    background: yellow;
 | 
				
			||||||
    border: 1px solid #cfcfcf;
 | 
					    border: 1px solid #cfcfcf;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@ -37,22 +37,25 @@
 | 
				
			|||||||
            </svg>
 | 
					            </svg>
 | 
				
			||||||
            {# blocks content #}
 | 
					            {# blocks content #}
 | 
				
			||||||
            {% for i in blocks %}
 | 
					            {% 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;">
 | 
					            <div class="block-body" style="height: {{ i[12] }}px; width: {{ i[11] }}px; top: {{ i[10] }}px; left: {{ i[9] }}px;">
 | 
				
			||||||
                {% for pin in pinDecoder(i[4]) %}
 | 
					                {% if i[4] != '{}' %}
 | 
				
			||||||
                <div class="block-p" title="{{ "Name: %s 
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-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 %}
 | 
					                {% endfor %}
 | 
				
			||||||
                {% for pout in pinDecoder(i[5]) %}
 | 
					                {% for pout in pinDecoder(i[6]) %}
 | 
				
			||||||
                <div class="block-p" title="{{ "Name: %s 
Type: %s"|format(pout.name, pout.type) }}" style="height: 6px; width: 6px; bottom: 0; left: {{ 20 + loop.index0 * ( 6 + 20) }}px;"></div>
 | 
					                <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 %}
 | 
					                {% endfor %}
 | 
				
			||||||
                {% for bin in pinDecoder(i[6]) %}
 | 
					                {% for bin in pinDecoder(i[7]) %}
 | 
				
			||||||
                <div class="block-b" title="{{ "Name: %s 
Type: %s"|format(bin.name, bin.type) }}" style="height: 6px; width: 6px; top: {{ 10 + loop.index0 * ( 6 + 20) }}px; left: 0;"></div>
 | 
					                <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 %}
 | 
					                {% endfor %}
 | 
				
			||||||
                {% for bout in pinDecoder(i[7]) %}
 | 
					                {% for bout in pinDecoder(i[8]) %}
 | 
				
			||||||
                <div class="block-b" title="{{ "Name: %s 
Type: %s"|format(bout.name, bout.type) }}" style="height: 6px; width: 6px; top: {{ 10 + loop.index0 * ( 6 + 20) }}px; right: 0;"></div>
 | 
					                <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 %}
 | 
					                {% endfor %}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                {% if i[12] != -1 %}
 | 
					                {% if i[13] != -1 %}
 | 
				
			||||||
                <p class="block-expandable-text" style="top: 10px; left: 20px;"><a href="{{ "/%s/%s"|format(currentPath, i[12]) }}">{{ i[2]|e }}</a></p>
 | 
					                <p class="block-expandable-text" style="top: 10px; left: 20px;"><a href="{{ "/%s/%s"|format(currentPath, i[13]) }}">{{ i[2]|e }}</a></p>
 | 
				
			||||||
                {% else %}
 | 
					                {% else %}
 | 
				
			||||||
                <p class="block-text" style="top: 10px; left: 20px;">{{ i[2]|e }}</p>
 | 
					                <p class="block-text" style="top: 10px; left: 20px;">{{ i[2]|e }}</p>
 | 
				
			||||||
                {% endif %}
 | 
					                {% endif %}
 | 
				
			||||||
@ -62,9 +65,9 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
            {# cells content #}
 | 
					            {# cells content #}
 | 
				
			||||||
            {% for i in cells %}
 | 
					            {% 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 %}"
 | 
					            <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: 5px; width: 15px; top: {{ i[5] }}px; left: {{ i[4] }}px;"
 | 
					            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 
Type: %s"|format(i[2], i[3]) }}"></div>
 | 
					            title="{{ "Name: %s\nType: %s"|format(i[2], i[3]) }}"></div>
 | 
				
			||||||
            {% endfor %}
 | 
					            {% endfor %}
 | 
				
			||||||
        </div>
 | 
					        </div>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user