Commit e1812b0f authored by Alice Salsé's avatar Alice Salsé
Browse files

🔨 debug plugin

parent 55efa543
......@@ -230,19 +230,27 @@ class NetworkTools:
if result[0] == False :
self.iface.messageBar().pushMessage("Echec : " + result[1].split('\n')[0], Qgis.Warning)
return
query="UPDATE {0}.{1} SET level = {2} WHERE id in ({3});"
query="UPDATE {0}.{1} SET level = {2} WHERE id in ({3}) and level != {2};"
for typ in ['node', 'pipe', 'part', 'lnode', 'lpipe', 'lpart'] :
ids=[]
column_names, records = executeQuery(first_lyr.dataProvider(), qconst.format(_schema, typ))
for rec in records :
for lyr_id in lyrs :
lyr=self.root.findLayer(lyr_id).layer()
l_sch, l_tab = lyr.dataProvider().uri().schema(), lyr.dataProvider().uri().table()
if l_sch == rec[0] and (l_tab[-len(rec[1]):]== rec[1] or l_tab==typ) :
result=first_lyr.dataProvider().transaction().executeSql(query.format(l_sch, l_tab, lvl, ','.join([str(i) for i in lyrs[lyr_id]]) or '0'))
if result[0] == False :
self.iface.messageBar().pushMessage("Echec : " + result[1].split('\n')[0], Qgis.Warning)
return
print('debuggg')
if l_sch == rec[0] :
if l_tab[-len(rec[1]):]== rec[1] :
result=first_lyr.dataProvider().transaction().executeSql(query.format(l_sch, l_tab, lvl, ','.join([str(i) for i in lyrs[lyr_id]]) or '0'))
if result[0] == False :
self.iface.messageBar().pushMessage("Echec : " + result[1].split('\n')[0], Qgis.Warning)
return
elif l_tab==typ :
ids=list(set(ids+lyrs[lyr_id]))
if len(ids) > 0 :
result=first_lyr.dataProvider().transaction().executeSql(query.format(l_sch, typ, lvl, ','.join([str(i) for i in ids]) or '0'))
if result[0] == False :
self.iface.messageBar().pushMessage("Echec : " + result[1].split('\n')[0], Qgis.Warning)
return
result=first_lyr.dataProvider().transaction().executeSql("SET CONSTRAINTS ALL IMMEDIATE;",True)
if result[0] == True :
self.iface.messageBar().pushMessage("Déplacement vers le niveau {0} réussie".format(level), Qgis.Info)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment