lecture des description dans un tooltip

This commit is contained in:
Tom LAVEILLE 2026-03-05 10:09:58 +01:00
parent 5a03084daa
commit 8c55d902c0
2 changed files with 64 additions and 14 deletions

View File

@ -285,16 +285,20 @@ class Flux_Editor(QDialog, EDITOR_CLASS):
if self.comboBox.currentText() == 'toutes les catégories': if self.comboBox.currentText() == 'toutes les catégories':
custom_list = schemaname_list custom_list = schemaname_list
elif self.comboBox.currentText() == 'travaux': elif self.comboBox.currentText() == 'travaux':
custom_list = """(SELECT schemaname,tablename from pg_catalog.pg_tables custom_list = schemaname_list[:-2] + """
where schemaname like '""" + str(self.comboBox.currentText()) + """%' order by schemaname,tablename) UNION (SELECT schemaname,matviewname AS tablename FROM pg_catalog.pg_matviews where schemaname like '""" + str(self.comboBox.currentText()) + """%' order by schemaname,tablename) order by schemaname,tablename;""" WHERE schemaname LIKE '""" + str(self.comboBox.currentText()) + """%';
"""
else: else:
custom_list = """(SELECT schemaname,tablename from pg_catalog.pg_tables custom_list = schemaname_list[:-2] + """
where schemaname like '\\_""" + str(self.comboBox.currentText()) + """%' order by schemaname,tablename) UNION (SELECT schemaname,matviewname AS tablename FROM pg_catalog.pg_matviews where schemaname like '\\_""" + str(self.comboBox.currentText()) + """%' order by schemaname,tablename) order by schemaname,tablename;""" WHERE schemaname LIKE '_""" + str(self.comboBox.currentText()) + """%';
"""
else: else:
if self.comboBox.currentText() == 'toutes les catégories': if self.comboBox.currentText() == 'toutes les catégories':
custom_list = schemaname_list_ref custom_list = schemaname_list_ref
else: else:
custom_list = """SELECT schemaname, tablename from pg_catalog.pg_tables WHERE schemaname LIKE '""" + str(self.comboBox.currentText()) + """' AND tablename NOT LIKE 'qgis_projects' order by schemaname, tablename;""" custom_list = schemaname_list_ref[:-2] + """
WHERE schemaname LIKE '""" + str(self.comboBox.currentText()) + """%' AND tablename NOT LIKE 'qgis_projects';
"""
cur.execute(custom_list) cur.execute(custom_list)
list_schema = cur.fetchall() list_schema = cur.fetchall()
@ -384,6 +388,7 @@ class Flux_Editor(QDialog, EDITOR_CLASS):
self.tableWidget.setColumnCount(5) self.tableWidget.setColumnCount(5)
i = 0 i = 0
for value in list_schema: for value in list_schema:
metadata = value[2]
if dbtype == sigdb: if dbtype == sigdb:
type_val = str(value[0])[1:3] type_val = str(value[0])[1:3]
schema_name = str(value[0])[4:] schema_name = str(value[0])[4:]
@ -448,8 +453,9 @@ class Flux_Editor(QDialog, EDITOR_CLASS):
self.tableWidget.setCellWidget(i, 4, self.FavButton) self.tableWidget.setCellWidget(i, 4, self.FavButton)
# Coloration des lignes selon les droits d'accès # Coloration des lignes selon les droits d'accès
if (str(value[0]) + '.' + str(value[1])) in GrandUser: if (str(value[0]) + '.' + str(value[1])) in GrandUser: # L'utilisateur a les droits
pass # L'utilisateur a les droits for j in range(self.tableWidget.columnCount()):
self.tableWidget.item(i, j).setToolTip(metadata)
else: else:
# Coloration en violet si droits insuffisants # Coloration en violet si droits insuffisants
for j in range(self.tableWidget.columnCount()): for j in range(self.tableWidget.columnCount()):

View File

@ -2,13 +2,57 @@
schemaname_distinct = """SELECT DISTINCT schemaname from pg_catalog.pg_tables schemaname_distinct = """SELECT DISTINCT schemaname from pg_catalog.pg_tables
WHERE schemaname NOT LIKE '_archives' AND schemaname NOT LIKE 'topology' AND schemaname NOT LIKE 'information_schema' AND schemaname NOT LIKE 'pg_catalog' and schemaname NOT LIKE 'public' AND schemaname NOT LIKE '_trier' WHERE schemaname NOT LIKE '_archives' AND schemaname NOT LIKE 'topology' AND schemaname NOT LIKE 'information_schema' AND schemaname NOT LIKE 'pg_catalog' and schemaname NOT LIKE 'public' AND schemaname NOT LIKE '_trier'
order by schemaname;""" order by schemaname;"""
schemaname_list_ref = """SELECT schemaname,tablename from pg_catalog.pg_tables
WHERE schemaname NOT LIKE '_archives' AND schemaname NOT LIKE 'topology' AND schemaname NOT LIKE 'information_schema' AND schemaname NOT LIKE 'pg_catalog' and schemaname NOT LIKE 'public' AND schemaname NOT LIKE '_trier' schemaname_list_ref = """
order by schemaname,tablename;""" WITH TableList AS (SELECT
schemaname_list = """(SELECT schemaname,tablename from pg_catalog.pg_tables schemaname,
where schemaname like 'trav%' or schemaname like '\\_ag%' or schemaname like '\\_00%' or schemaname like '\\_01%' or schemaname like '\\_07%' or schemaname like '\\_26%' or schemaname like '\\_form%' or schemaname like '\\_42%' or schemaname like '\\_69%' order by schemaname,tablename) tablename
UNION FROM pg_catalog.pg_tables
(SELECT schemaname,matviewname AS tablename FROM pg_catalog.pg_matviews order by schemaname,tablename) order by schemaname,tablename;""" WHERE
schemaname NOT LIKE '_archives' AND schemaname NOT LIKE 'topology' AND schemaname NOT LIKE 'information_schema' AND schemaname NOT LIKE 'pg_catalog' and schemaname NOT LIKE 'public' AND schemaname NOT LIKE '_trier'
ORDER BY schemaname,tablename),
TableDescription AS (SELECT
schemaname,
tablename,
description
FROM TableList
LEFT JOIN pg_description ON objoid = (quote_ident(schemaname)||'.'||quote_ident(tablename))::regclass
ORDER BY schemaname, tablename)
SELECT * FROM TableDescription;
"""
schemaname_list = """
WITH
TableList as (SELECT
schemaname,
tablename
FROM pg_catalog.pg_tables
WHERE schemaname LIKE 'trav%' OR schemaname LIKE '_ag%' OR schemaname LIKE '_00%' OR schemaname LIKE '_01%' OR schemaname LIKE '_07%' OR schemaname LIKE '_26%' OR schemaname LIKE '_form%' OR schemaname LIKE '_42%' OR schemaname LIKE '_69%'
ORDER BY schemaname,tablename),
ViewList as (SELECT
schemaname,
matviewname AS tablename
FROM pg_catalog.pg_matviews
ORDER BY schemaname,tablename),
TableAndView as (SELECT
schemaname,
tablename
FROM TableList
UNION SELECT schemaname,tablename FROM ViewList),
TableViewDescription as (SELECT
schemaname,
tablename,
description
FROM TableAndView
LEFT JOIN pg_description ON objoid = (quote_ident(schemaname)||'.'||quote_ident(tablename))::regclass
ORDER BY schemaname,tablename)
SELECT * FROM TableViewDescription;
"""
geom = "geom" geom = "geom"
champ_travaux_prevus_multipolygon = """(gid serial NOT NULL, groupe_gestion text, gestion_lib text, id_gestion text, datedebut date, datefin date, commentaire text, surface_m2 double precision, surface_ha double precision, date_creation date, date_maj date, geom geometry(MultiPolygon,2154))""" champ_travaux_prevus_multipolygon = """(gid serial NOT NULL, groupe_gestion text, gestion_lib text, id_gestion text, datedebut date, datefin date, commentaire text, surface_m2 double precision, surface_ha double precision, date_creation date, date_maj date, geom geometry(MultiPolygon,2154))"""
champ_travaux_prevus_multilinestring = """(gid serial NOT NULL, groupe_gestion text, gestion_lib text, id_gestion text, datedebut date, datefin date, commentaire text, longueur_m double precision, longueur_km double precision, date_creation date, date_maj date, geom geometry(MultiLineString,2154))""" champ_travaux_prevus_multilinestring = """(gid serial NOT NULL, groupe_gestion text, gestion_lib text, id_gestion text, datedebut date, datefin date, commentaire text, longueur_m double precision, longueur_km double precision, date_creation date, date_maj date, geom geometry(MultiLineString,2154))"""