test maj new pc
This commit is contained in:
@@ -335,7 +335,7 @@ class Flux_Editor(QDialog, EDITOR_CLASS):
|
||||
item = QTableWidgetItem(table_name)
|
||||
self.tableWidget.setItem(i, 3, item)
|
||||
|
||||
if dbtype == sigdb:
|
||||
if True:
|
||||
if (str(value[0]) + '.' + str(value[1])) in GrandUser:
|
||||
pass
|
||||
else:
|
||||
@@ -483,7 +483,7 @@ class Flux_Editor(QDialog, EDITOR_CLASS):
|
||||
for row in range(0, self.tableWidget_2.rowCount()):
|
||||
color_rgba_db = 855030089
|
||||
color_rgba_droit = 851150528
|
||||
print(self.tableWidget_2.item(row, 1).background().color().rgba())
|
||||
# print(self.tableWidget_2.item(row, 1).background().color().rgba())
|
||||
if self.tableWidget_2.item(row, 1).background().color().rgba() == color_rgba_droit:
|
||||
self.QMBquestion = QMessageBox.question(iface.mainWindow(), u"Attention !", "Vous ne disposez pas des droit pour la couche «" + str(self.tableWidget_2.item(row, 1).text()) + ' ' + str(self.tableWidget_2.item(row, 2).text()) + "» !", QMessageBox.StandardButton(0x00004000))
|
||||
elif self.tableWidget_2.item(row, 1).background().color().rgba() != color_rgba_db:
|
||||
@@ -525,8 +525,14 @@ class Flux_Editor(QDialog, EDITOR_CLASS):
|
||||
|
||||
# Chargement de la couche PostGIS
|
||||
geom_type = 'SELECT right(st_geometrytype(geom),-3) as a FROM ' + schema + '.' + table + ' GROUP BY a'
|
||||
cur.execute(geom_type)
|
||||
list_typegeom = cur.fetchall()
|
||||
try:
|
||||
cur.execute(geom_type)
|
||||
list_typegeom = cur.fetchall()
|
||||
UndefinedTable = True
|
||||
except psycopg2.errors.UndefinedTable:
|
||||
print("Error table name")
|
||||
list_typegeom = ''
|
||||
UndefinedTable = False
|
||||
if len(list_typegeom) > 1:
|
||||
for typegeom in list_typegeom:
|
||||
if typegeom[0] == 'MultiPolygon':
|
||||
@@ -547,9 +553,12 @@ class Flux_Editor(QDialog, EDITOR_CLASS):
|
||||
# Ajout de la couche au canevas QGIS
|
||||
QgsProject.instance().addMapLayer(layer)
|
||||
else:
|
||||
layer = QgsVectorLayer(uri.uri(), table, "postgres")
|
||||
# Ajout de la couche au canevas QGIS
|
||||
QgsProject.instance().addMapLayer(layer)
|
||||
if UndefinedTable:
|
||||
layer = QgsVectorLayer(uri.uri(), table, "postgres")
|
||||
# Ajout de la couche au canevas QGIS
|
||||
QgsProject.instance().addMapLayer(layer)
|
||||
else:
|
||||
self.QMBquestion = QMessageBox.question(iface.mainWindow(), u"Attention !", "La couche «" + str(self.tableWidget_2.item(row, 1).text()) + ' ' + str(self.tableWidget_2.item(row, 2).text()) + "» semble ne pas avoir le même nom dans la BD, merci de contacter votre administrateur pour régler le problème !", QMessageBox.StandardButton(0x00004000))
|
||||
else:
|
||||
self.QMBquestion = QMessageBox.question(iface.mainWindow(), u"Attention !", "La couche «" + str(self.tableWidget_2.item(row, 1).text()) + ' ' + str(self.tableWidget_2.item(row, 2).text()) + "» ne ce trouve pas dans cette BD !", QMessageBox.StandardButton(0x00004000))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user