diff --git a/.docker/docker-compose.yml b/.docker/docker-compose.yml index 41ebd9e5..3bd7954d 100644 --- a/.docker/docker-compose.yml +++ b/.docker/docker-compose.yml @@ -6,7 +6,7 @@ services: profiles: - "qgis" - "db" - image: kartoza/postgis:11.5-2.5 # Despite the tag, it's a 11.7 version + image: kartoza/postgis:13-3 container_name: postgis networks: qgis_plugin_network: @@ -30,7 +30,7 @@ services: qgis: profiles: - "qgis" - image: qgis/qgis:release-3_16 + image: qgis/qgis:release-3_22 container_name: qgis networks: qgis_plugin_network: diff --git a/CHANGELOG.md b/CHANGELOG.md index 689a7c71..ed4320f4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ ## Unreleased +* Raise to QGIS 3.22 minimum version +* Upgrade to PostgreSQL 13 for testing and SQL files + ## 1.3.0 - 2024-02-05 * Additional glossary terms for publication frequency and link types (contribution from @effjot Florian Jenn) diff --git a/pg_metadata/install/sql/pgmetadata/10_FUNCTION.sql b/pg_metadata/install/sql/pgmetadata/10_FUNCTION.sql index 8d27bccd..67c0c7bf 100755 --- a/pg_metadata/install/sql/pgmetadata/10_FUNCTION.sql +++ b/pg_metadata/install/sql/pgmetadata/10_FUNCTION.sql @@ -3,8 +3,8 @@ BEGIN; -- PostgreSQL database dump -- --- Dumped from database version 11.7 (Debian 11.7-2.pgdg100+1) --- Dumped by pg_dump version 11.7 (Debian 11.7-2.pgdg100+1) +-- Dumped from database version 13.4 (Debian 13.4-1.pgdg110+1) +-- Dumped by pg_dump version 13.4 (Debian 13.4-1.pgdg110+1) SET statement_timeout = 0; SET lock_timeout = 0; diff --git a/pg_metadata/install/sql/pgmetadata/20_TABLE_SEQUENCE_DEFAULT.sql b/pg_metadata/install/sql/pgmetadata/20_TABLE_SEQUENCE_DEFAULT.sql index 6b7b2d9e..e649310a 100755 --- a/pg_metadata/install/sql/pgmetadata/20_TABLE_SEQUENCE_DEFAULT.sql +++ b/pg_metadata/install/sql/pgmetadata/20_TABLE_SEQUENCE_DEFAULT.sql @@ -3,8 +3,8 @@ BEGIN; -- PostgreSQL database dump -- --- Dumped from database version 11.7 (Debian 11.7-2.pgdg100+1) --- Dumped by pg_dump version 11.7 (Debian 11.7-2.pgdg100+1) +-- Dumped from database version 13.4 (Debian 13.4-1.pgdg110+1) +-- Dumped by pg_dump version 13.4 (Debian 13.4-1.pgdg110+1) SET statement_timeout = 0; SET lock_timeout = 0; @@ -19,7 +19,7 @@ SET row_security = off; SET default_tablespace = ''; -SET default_with_oids = false; +; -- contact CREATE TABLE pgmetadata.contact ( diff --git a/pg_metadata/install/sql/pgmetadata/30_VIEW.sql b/pg_metadata/install/sql/pgmetadata/30_VIEW.sql index 5ec0d049..bf14ea55 100755 --- a/pg_metadata/install/sql/pgmetadata/30_VIEW.sql +++ b/pg_metadata/install/sql/pgmetadata/30_VIEW.sql @@ -3,8 +3,8 @@ BEGIN; -- PostgreSQL database dump -- --- Dumped from database version 11.7 (Debian 11.7-2.pgdg100+1) --- Dumped by pg_dump version 11.7 (Debian 11.7-2.pgdg100+1) +-- Dumped from database version 13.4 (Debian 13.4-1.pgdg110+1) +-- Dumped by pg_dump version 13.4 (Debian 13.4-1.pgdg110+1) SET statement_timeout = 0; SET lock_timeout = 0; @@ -274,7 +274,7 @@ CREATE VIEW pgmetadata.v_locales AS UNION SELECT replace((columns.column_name)::text, 'label_'::text, ''::text) AS locale FROM information_schema.columns - WHERE (((columns.table_schema)::text = 'pgmetadata'::text) AND ((columns.table_name)::text = 'glossary'::text) AND ((columns.column_name)::text ~~ 'label_%'::text)) + WHERE (((columns.table_schema)::name = 'pgmetadata'::name) AND ((columns.table_name)::name = 'glossary'::name) AND ((columns.column_name)::name ~~ 'label_%'::text)) ORDER BY 1; @@ -305,7 +305,7 @@ CREATE VIEW pgmetadata.v_orphan_tables AS FROM information_schema.tables WHERE ((NOT (concat(tables.table_schema, '.', tables.table_name) IN ( SELECT concat(dataset.schema_name, '.', dataset.table_name) AS concat FROM pgmetadata.dataset))) AND ((tables.table_schema)::name <> ALL (ARRAY['pg_catalog'::name, 'information_schema'::name]))) - ORDER BY (tables.table_schema)::text, (tables.table_name)::text; + ORDER BY ((tables.table_schema)::text), ((tables.table_name)::text); -- VIEW v_orphan_tables @@ -317,8 +317,8 @@ CREATE VIEW pgmetadata.v_schema_list AS SELECT row_number() OVER () AS id, (schemata.schema_name)::text AS schema_name FROM information_schema.schemata - WHERE ((schemata.schema_name)::text <> ALL ((ARRAY['pg_toast'::character varying, 'pg_temp_1'::character varying, 'pg_toast_temp_1'::character varying, 'pg_catalog'::character varying, 'information_schema'::character varying])::text[])) - ORDER BY (schemata.schema_name)::text; + WHERE ((schemata.schema_name)::name <> ALL (ARRAY['pg_toast'::name, 'pg_temp_1'::name, 'pg_toast_temp_1'::name, 'pg_catalog'::name, 'information_schema'::name])) + ORDER BY ((schemata.schema_name)::text); -- VIEW v_schema_list @@ -350,8 +350,8 @@ CREATE VIEW pgmetadata.v_table_list AS (tables.table_schema)::text AS schema_name, (tables.table_name)::text AS table_name FROM information_schema.tables - WHERE ((tables.table_schema)::text <> ALL ((ARRAY['pg_toast'::character varying, 'pg_temp_1'::character varying, 'pg_toast_temp_1'::character varying, 'pg_catalog'::character varying, 'information_schema'::character varying])::text[])) - ORDER BY tables.table_schema, (tables.table_name)::text; + WHERE ((tables.table_schema)::name <> ALL (ARRAY['pg_toast'::name, 'pg_temp_1'::name, 'pg_toast_temp_1'::name, 'pg_catalog'::name, 'information_schema'::name])) + ORDER BY tables.table_schema, ((tables.table_name)::text); -- VIEW v_table_list diff --git a/pg_metadata/install/sql/pgmetadata/40_INDEX.sql b/pg_metadata/install/sql/pgmetadata/40_INDEX.sql index 727bd924..8c626ed6 100755 --- a/pg_metadata/install/sql/pgmetadata/40_INDEX.sql +++ b/pg_metadata/install/sql/pgmetadata/40_INDEX.sql @@ -3,8 +3,8 @@ BEGIN; -- PostgreSQL database dump -- --- Dumped from database version 11.7 (Debian 11.7-2.pgdg100+1) --- Dumped by pg_dump version 11.7 (Debian 11.7-2.pgdg100+1) +-- Dumped from database version 13.4 (Debian 13.4-1.pgdg110+1) +-- Dumped by pg_dump version 13.4 (Debian 13.4-1.pgdg110+1) SET statement_timeout = 0; SET lock_timeout = 0; diff --git a/pg_metadata/install/sql/pgmetadata/50_TRIGGER.sql b/pg_metadata/install/sql/pgmetadata/50_TRIGGER.sql index 8e7c3ccb..a8a00816 100755 --- a/pg_metadata/install/sql/pgmetadata/50_TRIGGER.sql +++ b/pg_metadata/install/sql/pgmetadata/50_TRIGGER.sql @@ -3,8 +3,8 @@ BEGIN; -- PostgreSQL database dump -- --- Dumped from database version 11.7 (Debian 11.7-2.pgdg100+1) --- Dumped by pg_dump version 11.7 (Debian 11.7-2.pgdg100+1) +-- Dumped from database version 13.4 (Debian 13.4-1.pgdg110+1) +-- Dumped by pg_dump version 13.4 (Debian 13.4-1.pgdg110+1) SET statement_timeout = 0; SET lock_timeout = 0; diff --git a/pg_metadata/install/sql/pgmetadata/60_CONSTRAINT.sql b/pg_metadata/install/sql/pgmetadata/60_CONSTRAINT.sql index 37397f69..9922f66b 100755 --- a/pg_metadata/install/sql/pgmetadata/60_CONSTRAINT.sql +++ b/pg_metadata/install/sql/pgmetadata/60_CONSTRAINT.sql @@ -3,8 +3,8 @@ BEGIN; -- PostgreSQL database dump -- --- Dumped from database version 11.7 (Debian 11.7-2.pgdg100+1) --- Dumped by pg_dump version 11.7 (Debian 11.7-2.pgdg100+1) +-- Dumped from database version 13.4 (Debian 13.4-1.pgdg110+1) +-- Dumped by pg_dump version 13.4 (Debian 13.4-1.pgdg110+1) SET statement_timeout = 0; SET lock_timeout = 0; diff --git a/pg_metadata/install/sql/pgmetadata/70_COMMENT.sql b/pg_metadata/install/sql/pgmetadata/70_COMMENT.sql index aa1c3de4..16d38018 100755 --- a/pg_metadata/install/sql/pgmetadata/70_COMMENT.sql +++ b/pg_metadata/install/sql/pgmetadata/70_COMMENT.sql @@ -3,8 +3,8 @@ BEGIN; -- PostgreSQL database dump -- --- Dumped from database version 11.7 (Debian 11.7-2.pgdg100+1) --- Dumped by pg_dump version 11.7 (Debian 11.7-2.pgdg100+1) +-- Dumped from database version 13.4 (Debian 13.4-1.pgdg110+1) +-- Dumped by pg_dump version 13.4 (Debian 13.4-1.pgdg110+1) SET statement_timeout = 0; SET lock_timeout = 0; diff --git a/pg_metadata/locator.py b/pg_metadata/locator.py index 2db21bbb..54d1d0b7 100644 --- a/pg_metadata/locator.py +++ b/pg_metadata/locator.py @@ -5,6 +5,7 @@ from qgis.core import ( Qgis, QgsDataSourceUri, + QgsIconUtils, QgsLocatorFilter, QgsLocatorResult, QgsProject, @@ -13,6 +14,7 @@ QgsRasterLayer, QgsSettings, QgsVectorLayer, + QgsWkbTypes, ) from qgis.PyQt.QtCore import QLocale from qgis.PyQt.QtWidgets import QDockWidget @@ -22,7 +24,6 @@ connections_list, ) from pg_metadata.qgis_plugin_tools.tools.i18n import tr -from pg_metadata.tools import icon_for_geometry_type SCHEMA = 'pgmetadata' @@ -98,7 +99,7 @@ def fetch_result_single_database(self, search: str, connection_name: str): result = QgsLocatorResult() result.filter = self result.displayString = item[0] - result.icon = icon_for_geometry_type(item[3]) + result.icon = QgsIconUtils.iconForWkbType(QgsWkbTypes.parseType(item[3])) result.userData = { 'name': item[4], 'connection': connection_name, diff --git a/pg_metadata/metadata.txt b/pg_metadata/metadata.txt index f84f27c1..94143cb2 100644 --- a/pg_metadata/metadata.txt +++ b/pg_metadata/metadata.txt @@ -1,6 +1,6 @@ [general] name=PgMetadata -qgisMinimumVersion=3.16 +qgisMinimumVersion=3.22 description=Store some metadata about layers which are stored in PostgreSQL. It's possible to define title, abstract, links, contacts etc. It also provides some search tool, in the QGIS Locator bar for instance. author=3Liz email=info@3liz.com diff --git a/pg_metadata/resources/projects/pg_metadata_administration.qgs b/pg_metadata/resources/projects/pg_metadata_administration.qgs index 4e046c3b..ef717da6 100644 --- a/pg_metadata/resources/projects/pg_metadata_administration.qgs +++ b/pg_metadata/resources/projects/pg_metadata_administration.qgs @@ -1,13 +1,12 @@ - - - + + - - - + + + - GEOGCRS["WGS 84",DATUM["World Geodetic System 1984",ELLIPSOID["WGS 84",6378137,298.257223563,LENGTHUNIT["metre",1]]],PRIMEM["Greenwich",0,ANGLEUNIT["degree",0.0174532925199433]],CS[ellipsoidal,2],AXIS["geodetic latitude (Lat)",north,ORDER[1],ANGLEUNIT["degree",0.0174532925199433]],AXIS["geodetic longitude (Lon)",east,ORDER[2],ANGLEUNIT["degree",0.0174532925199433]],USAGE[SCOPE["unknown"],AREA["World"],BBOX[-90,-180,90,180]],ID["EPSG",4326]] + GEOGCRS["WGS 84",ENSEMBLE["World Geodetic System 1984 ensemble",MEMBER["World Geodetic System 1984 (Transit)"],MEMBER["World Geodetic System 1984 (G730)"],MEMBER["World Geodetic System 1984 (G873)"],MEMBER["World Geodetic System 1984 (G1150)"],MEMBER["World Geodetic System 1984 (G1674)"],MEMBER["World Geodetic System 1984 (G1762)"],MEMBER["World Geodetic System 1984 (G2139)"],ELLIPSOID["WGS 84",6378137,298.257223563,LENGTHUNIT["metre",1]],ENSEMBLEACCURACY[2.0]],PRIMEM["Greenwich",0,ANGLEUNIT["degree",0.0174532925199433]],CS[ellipsoidal,2],AXIS["geodetic latitude (Lat)",north,ORDER[1],ANGLEUNIT["degree",0.0174532925199433]],AXIS["geodetic longitude (Lon)",east,ORDER[2],ANGLEUNIT["degree",0.0174532925199433]],USAGE[SCOPE["Horizontal component of 3D system."],AREA["World."],BBOX[-90,-180,90,180]],ID["EPSG",4326]] +proj=longlat +datum=WGS84 +no_defs 3452 4326 @@ -19,96 +18,135 @@ - - - - + + + + + + + + - + + - - + + + + - + - + + - + - + + - + - + + - + - + + - - + + + + - - - - + + + + + + + + - - + + + + - - + + + + - - + + + + - - - + + + + + - + + - + - + + - - - - + + + + + + + + dataset_00c9da4d_d717_48cc_a848_0d4544b019fd - + - + - - + + - - + + - - + + - + + degrees 5.04407452150329672 @@ -119,7 +157,7 @@ 0 - GEOGCRS["WGS 84",DATUM["World Geodetic System 1984",ELLIPSOID["WGS 84",6378137,298.257223563,LENGTHUNIT["metre",1]]],PRIMEM["Greenwich",0,ANGLEUNIT["degree",0.0174532925199433]],CS[ellipsoidal,2],AXIS["geodetic latitude (Lat)",north,ORDER[1],ANGLEUNIT["degree",0.0174532925199433]],AXIS["geodetic longitude (Lon)",east,ORDER[2],ANGLEUNIT["degree",0.0174532925199433]],USAGE[SCOPE["unknown"],AREA["World"],BBOX[-90,-180,90,180]],ID["EPSG",4326]] + GEOGCRS["WGS 84",ENSEMBLE["World Geodetic System 1984 ensemble",MEMBER["World Geodetic System 1984 (Transit)"],MEMBER["World Geodetic System 1984 (G730)"],MEMBER["World Geodetic System 1984 (G873)"],MEMBER["World Geodetic System 1984 (G1150)"],MEMBER["World Geodetic System 1984 (G1674)"],MEMBER["World Geodetic System 1984 (G1762)"],MEMBER["World Geodetic System 1984 (G2139)"],ELLIPSOID["WGS 84",6378137,298.257223563,LENGTHUNIT["metre",1]],ENSEMBLEACCURACY[2.0]],PRIMEM["Greenwich",0,ANGLEUNIT["degree",0.0174532925199433]],CS[ellipsoidal,2],AXIS["geodetic latitude (Lat)",north,ORDER[1],ANGLEUNIT["degree",0.0174532925199433]],AXIS["geodetic longitude (Lon)",east,ORDER[2],ANGLEUNIT["degree",0.0174532925199433]],USAGE[SCOPE["Horizontal component of 3D system."],AREA["World."],BBOX[-90,-180,90,180]],ID["EPSG",4326]] +proj=longlat +datum=WGS84 +no_defs 3452 4326 @@ -131,92 +169,92 @@ 0 - + - + - - - - - - + + + Annotations_cf42651e_5b61_4496_9a61_b4923b089864 @@ -243,7 +281,7 @@ - + @@ -259,13 +297,15 @@ false - + - + 1 + 0 + - + contact_640d326a_25a7_4b9c_8878_42d1201a8198 service='pgmetadata' sslmode=disable key='id' estimatedmetadata=true checkPrimaryKeyUnicity='1' table="pgmetadata"."contact" @@ -301,7 +341,7 @@ - + @@ -318,7 +358,7 @@ - + @@ -328,156 +368,160 @@ postgres - - - - + + + + - + - + + 1 1 1 + 0 - + - - - - + + + + + - - - + + + - - + + - + + - + + - + + - + + - + + - + + - - - - - - + + + + + + - - - - - - + + + + + + - - - - - - + + + + + + - - - - - - + + + + + + - + - + - + - - - + + - + - + 0 - # -*- coding: utf-8 -*- """ QGIS forms can have a Python function that is called when the form is opened. @@ -493,44 +537,45 @@ from qgis.PyQt.QtWidgets import QWidget def my_form_open(dialog, layer, feature): geom = feature.geometry() control = dialog.findChild(QWidget, "MyLineEdit") -]]> + 0 tablayout - - - - - + + + + + - - - - - - + + + + + + - - - - - - + + + + + + - + + - concat("name", ' (', "organisation_name", ')') - + dataset_00c9da4d_d717_48cc_a848_0d4544b019fd service='pgmetadata' sslmode=disable key='id' estimatedmetadata=true srid=4326 type=Polygon checkPrimaryKeyUnicity='1' table="pgmetadata"."dataset" (geom) @@ -539,7 +584,7 @@ def my_form_open(dialog, layer, feature): Dataset - GEOGCRS["WGS 84",DATUM["World Geodetic System 1984",ELLIPSOID["WGS 84",6378137,298.257223563,LENGTHUNIT["metre",1]]],PRIMEM["Greenwich",0,ANGLEUNIT["degree",0.0174532925199433]],CS[ellipsoidal,2],AXIS["geodetic latitude (Lat)",north,ORDER[1],ANGLEUNIT["degree",0.0174532925199433]],AXIS["geodetic longitude (Lon)",east,ORDER[2],ANGLEUNIT["degree",0.0174532925199433]],USAGE[SCOPE["unknown"],AREA["World"],BBOX[-90,-180,90,180]],ID["EPSG",4326]] + GEOGCRS["WGS 84",ENSEMBLE["World Geodetic System 1984 ensemble",MEMBER["World Geodetic System 1984 (Transit)"],MEMBER["World Geodetic System 1984 (G730)"],MEMBER["World Geodetic System 1984 (G873)"],MEMBER["World Geodetic System 1984 (G1150)"],MEMBER["World Geodetic System 1984 (G1674)"],MEMBER["World Geodetic System 1984 (G1762)"],MEMBER["World Geodetic System 1984 (G2139)"],ELLIPSOID["WGS 84",6378137,298.257223563,LENGTHUNIT["metre",1]],ENSEMBLEACCURACY[2.0]],PRIMEM["Greenwich",0,ANGLEUNIT["degree",0.0174532925199433]],CS[ellipsoidal,2],AXIS["geodetic latitude (Lat)",north,ORDER[1],ANGLEUNIT["degree",0.0174532925199433]],AXIS["geodetic longitude (Lon)",east,ORDER[2],ANGLEUNIT["degree",0.0174532925199433]],USAGE[SCOPE["Horizontal component of 3D system."],AREA["World."],BBOX[-90,-180,90,180]],ID["EPSG",4326]] +proj=longlat +datum=WGS84 +no_defs 3452 4326 @@ -566,7 +611,7 @@ def my_form_open(dialog, layer, feature): - + undefined 1 @@ -574,7 +619,7 @@ def my_form_open(dialog, layer, feature): - GEOGCRS["WGS 84",DATUM["World Geodetic System 1984",ELLIPSOID["WGS 84",6378137,298.257223563,LENGTHUNIT["metre",1]]],PRIMEM["Greenwich",0,ANGLEUNIT["degree",0.0174532925199433]],CS[ellipsoidal,2],AXIS["geodetic latitude (Lat)",north,ORDER[1],ANGLEUNIT["degree",0.0174532925199433]],AXIS["geodetic longitude (Lon)",east,ORDER[2],ANGLEUNIT["degree",0.0174532925199433]],USAGE[SCOPE["unknown"],AREA["World"],BBOX[-90,-180,90,180]],ID["EPSG",4326]] + GEOGCRS["WGS 84",ENSEMBLE["World Geodetic System 1984 ensemble",MEMBER["World Geodetic System 1984 (Transit)"],MEMBER["World Geodetic System 1984 (G730)"],MEMBER["World Geodetic System 1984 (G873)"],MEMBER["World Geodetic System 1984 (G1150)"],MEMBER["World Geodetic System 1984 (G1674)"],MEMBER["World Geodetic System 1984 (G1762)"],MEMBER["World Geodetic System 1984 (G2139)"],ELLIPSOID["WGS 84",6378137,298.257223563,LENGTHUNIT["metre",1]],ENSEMBLEACCURACY[2.0]],PRIMEM["Greenwich",0,ANGLEUNIT["degree",0.0174532925199433]],CS[ellipsoidal,2],AXIS["geodetic latitude (Lat)",north,ORDER[1],ANGLEUNIT["degree",0.0174532925199433]],AXIS["geodetic longitude (Lon)",east,ORDER[2],ANGLEUNIT["degree",0.0174532925199433]],USAGE[SCOPE["Horizontal component of 3D system."],AREA["World."],BBOX[-90,-180,90,180]],ID["EPSG",4326]] +proj=longlat +datum=WGS84 +no_defs 3452 4326 @@ -586,7 +631,7 @@ def my_form_open(dialog, layer, feature): - + @@ -596,176 +641,315 @@ def my_form_open(dialog, layer, feature): postgres - - - - + + + + - + - + + 1 1 1 + 0 - + - + - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + - + - - - + + + + + + + + + - + + + + + + + + + + + + - - - - + + + + + 0 0 1 - - - + + + - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -773,520 +957,520 @@ def my_form_open(dialog, layer, feature): - + + + - - + + - + + - - + + - + + - + + - + + + + + + + + + + + + - + + + + + + + + + + + + - + + - + + - + + + + + + + + + + + + - + + - + - + + + + + + - + + + + + + - + + + + + - + + + + + + + + + + + + - + + + + + + + + + + + + - - + + - + + + + + + + + + + + + - n + - - + + + - + + - + + - + + - + + - - + + + + + + - + + + + + - + + + + + - - + + + + + + + + + + + + + - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - - - + + - + - + 0 - # -*- coding: utf-8 -*- """ QGIS forms can have a Python function that is called when the form is opened. @@ -1302,131 +1486,140 @@ from qgis.PyQt.QtWidgets import QWidget def my_form_open(dialog, layer, feature): geom = feature.geometry() control = dialog.findChild(QWidget, "MyLineEdit") -]]> + 0 tablayout - - - - - - - - - - - - + + + + + + + + + + + + - - - - - - + + + + + + - - - - - - - - - + + + + + + + + + - - - + + + - - + + + + + + - - + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + - + + - - concat("schema_name", '.', "table_name") - + dataset_contact_ff2bb406_5b18_4ab7_9fc0_3a25c3aa9675 service='pgmetadata' sslmode=disable key='id' estimatedmetadata=true checkPrimaryKeyUnicity='1' table="pgmetadata"."dataset_contact" - Dataset <-> Contact + Dataset <-> Contact @@ -1456,7 +1649,7 @@ def my_form_open(dialog, layer, feature): - + @@ -1473,7 +1666,7 @@ def my_form_open(dialog, layer, feature): - + @@ -1483,155 +1676,159 @@ def my_form_open(dialog, layer, feature): postgres - - - - + + + + - + - + + 1 1 1 + 0 - + - - - - + + + + + - - - + + + - + - - + + - - + + - + + - + + + + + + + + - + + + + + + + + - + + + + + + + + + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + - + - + - + - - - + + - + - + 0 - # -*- coding: utf-8 -*- """ QGIS forms can have a Python function that is called when the form is opened. @@ -1647,27 +1844,28 @@ from qgis.PyQt.QtWidgets import QWidget def my_form_open(dialog, layer, feature): geom = feature.geometry() control = dialog.findChild(QWidget, "MyLineEdit") -]]> + 0 generatedlayout - - - - + + + + - - - - + + + + - - + + + "id" - + glossary_7235d2fd_01a3_45dc_8321_ea0dc29e55ab service='pgmetadata' sslmode=disable key='id' estimatedmetadata=true checkPrimaryKeyUnicity='1' table="pgmetadata"."glossary" @@ -1703,7 +1901,7 @@ def my_form_open(dialog, layer, feature): - + @@ -1720,7 +1918,7 @@ def my_form_open(dialog, layer, feature): - + @@ -1730,229 +1928,233 @@ def my_form_open(dialog, layer, feature): postgres - - - - + + + + - + - + + 1 1 1 + 0 - + - - "label_en" - "description_en" - - - - + + + + + + + - - - + + + - - + + - + - - + - - + - - + - - + - - + - - + - - + - - + - - + - - + - - + - - + - - + - - - - - - - - - - - - - - - + + + + + + + + + + + + + + - - - - - - - - - - - - - - + + + + + + + + + + + + + + - - - - - - - - - - - - - - + + + + + + + + + + + + + + - - - - - - - - - - - - - - + + + + + + + + + + + + + + - + - + - + - - - + + - + - + 0 - # -*- coding: utf-8 -*- """ QGIS forms can have a Python function that is called when the form is opened. @@ -1968,31 +2170,32 @@ from qgis.PyQt.QtWidgets import QWidget def my_form_open(dialog, layer, feature): geom = feature.geometry() control = dialog.findChild(QWidget, "MyLineEdit") -]]> + 0 generatedlayout - - - - - - + + + + + + - - - - - - + + + + + + - - + + + "label" - + html_template_e9cca240_a640_4a7c_a9d0_a181beb9797e service='pgmetadata' sslmode=disable key='id' estimatedmetadata=true checkPrimaryKeyUnicity='1' table="pgmetadata"."html_template" @@ -2028,7 +2231,7 @@ def my_form_open(dialog, layer, feature): - + @@ -2045,7 +2248,7 @@ def my_form_open(dialog, layer, feature): - + @@ -2055,120 +2258,124 @@ def my_form_open(dialog, layer, feature): postgres - - - - + + + + - + - + + 1 1 1 + 0 - + - - - - + + + + + - - - + + + - - + + - + + - + - + + - - - + + + - - - + + + - - - + + + - - - + + + - + - + - + - - - + + - + - + 0 - # -*- coding: utf-8 -*- """ QGIS forms can have a Python function that is called when the form is opened. @@ -2184,29 +2391,30 @@ from qgis.PyQt.QtWidgets import QWidget def my_form_open(dialog, layer, feature): geom = feature.geometry() control = dialog.findChild(QWidget, "MyLineEdit") -]]> + 0 tablayout - - + + - - - + + + - - - + + + - - + + + "section" - + link_6157b282_9882_44f3_b6a1_c133f5595d2a service='pgmetadata' sslmode=disable key='id' estimatedmetadata=true checkPrimaryKeyUnicity='1' table="pgmetadata"."link" @@ -2243,7 +2451,7 @@ def my_form_open(dialog, layer, feature): - + @@ -2261,7 +2469,7 @@ def my_form_open(dialog, layer, feature): - + @@ -2271,235 +2479,239 @@ def my_form_open(dialog, layer, feature): postgres - - - - + + + + - + - + + 1 1 1 + 0 - + - - - - + + + + + - - - + + + - + - - + + - + + - + + - + + + + + + + + + + + + - + + - + + - + + - + + + + + + + + + + + + - + + + + + + - + + + + + + + + - - - - - - - - - + + + + + + + + + - - - - - - - - - + + + + + + + + + - - - - - - - - - + + + + + + + + + - - - - - - - - - + + + + + + + + + - + - + - + - - - + + - + - + 0 - # -*- coding: utf-8 -*- """ QGIS forms can have a Python function that is called when the form is opened. @@ -2515,47 +2727,48 @@ from qgis.PyQt.QtWidgets import QWidget def my_form_open(dialog, layer, feature): geom = feature.geometry() control = dialog.findChild(QWidget, "MyLineEdit") -]]> + 0 tablayout - - - - - - - - + + + + + + + + - - - - - - - - - + + + + + + + + + - - - - - - - - - + + + + + + + + + - - + + + "name" - + theme_3d260140_3e41_4dbe_8e79_813f3f5d3d50 service='pgmetadata' sslmode=disable key='id' estimatedmetadata=true checkPrimaryKeyUnicity='1' table="pgmetadata"."theme" @@ -2591,7 +2804,7 @@ def my_form_open(dialog, layer, feature): - + @@ -2608,7 +2821,7 @@ def my_form_open(dialog, layer, feature): - + @@ -2618,122 +2831,126 @@ def my_form_open(dialog, layer, feature): postgres - - - - + + + + - + - + + 1 1 1 + 0 - + - - - + + + + - - - + + + - - + + - + - - + + - + + - + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + - + - + - + - - - + + - + - + 0 - # -*- coding: utf-8 -*- """ QGIS forms can have a Python function that is called when the form is opened. @@ -2749,27 +2966,28 @@ from qgis.PyQt.QtWidgets import QWidget def my_form_open(dialog, layer, feature): geom = feature.geometry() control = dialog.findChild(QWidget, "MyLineEdit") -]]> + 0 generatedlayout - - - - + + + + - - - - + + + + - - + + + "description" - + v_locales_f4efa77e_8eb0_4d5a_809c_d479ae6cc850 service='pgmetadata' sslmode=disable key='locale' estimatedmetadata=true checkPrimaryKeyUnicity='1' table="pgmetadata"."v_locales" @@ -2796,7 +3014,7 @@ def my_form_open(dialog, layer, feature): dataset Lists the locales available in the glossary, by listing the columns label_xx of the table pgmetadata.glossary - + @@ -2812,85 +3030,90 @@ def my_form_open(dialog, layer, feature): false - + postgres - - - - + + + + - + - + + 1 1 1 + 0 - + - - + + + + - - + - - + + - + - - + - + - + - + - + - + - - + + - - + + - + - + 0 - + 0 generatedlayout - - - - + + + + + - + v_orphan_dataset_items_0fbfb83f_0c98_4391_bf51_8b5d8a362a73 service='pgmetadata' sslmode=disable key='schema_name' estimatedmetadata=true checkPrimaryKeyUnicity='1' table="pgmetadata"."v_orphan_dataset_items" @@ -2926,7 +3149,7 @@ def my_form_open(dialog, layer, feature): - + @@ -2943,7 +3166,7 @@ def my_form_open(dialog, layer, feature): - + @@ -2953,110 +3176,114 @@ def my_form_open(dialog, layer, feature): postgres - - - - + + + + - + - + + 1 1 1 + 0 - + - - - + + + + - - - + + + - - + + - + + - + + - + + - - - + + + - - - + + + - - - + + + - - - + + + - + - + - + - - - + + - + - + 0 - # -*- coding: utf-8 -*- """ QGIS forms can have a Python function that is called when the form is opened. @@ -3072,29 +3299,30 @@ from qgis.PyQt.QtWidgets import QWidget def my_form_open(dialog, layer, feature): geom = feature.geometry() control = dialog.findChild(QWidget, "MyLineEdit") -]]> + 0 tablayout - - + + - - - + + + - - - + + + - - + + + "schema_name" || '.' || "table_name" - + v_orphan_tables_33b5eba9_96d1_442a_a32e_90a10c6fd2e5 service='pgmetadata' sslmode=disable key='id' estimatedmetadata=true checkPrimaryKeyUnicity='1' table="pgmetadata"."v_orphan_tables" @@ -3130,7 +3358,7 @@ def my_form_open(dialog, layer, feature): - + @@ -3147,7 +3375,7 @@ def my_form_open(dialog, layer, feature): - + @@ -3157,114 +3385,118 @@ def my_form_open(dialog, layer, feature): postgres - - - - + + + + - + - + + 1 1 1 + 0 - + - - "schemaname" || '.' || "tablename" - "schemaname" - - - - + + + + + + + - - - + + + - - + + - + + - + + - + + - - - + + + - - - + + + - - - + + + - - - + + + - + - + - + - - - + + - + - + 0 - # -*- coding: utf-8 -*- """ QGIS forms can have a Python function that is called when the form is opened. @@ -3280,29 +3512,30 @@ from qgis.PyQt.QtWidgets import QWidget def my_form_open(dialog, layer, feature): geom = feature.geometry() control = dialog.findChild(QWidget, "MyLineEdit") -]]> + 0 tablayout - - + + - - - + + + - - - + + + - - + + + "schemaname" || '.' || "tablename" - + v_schema_list_140f3a29_ae94_480c_932c_fb47bdad292c service='pgmetadata' sslmode=disable key='id' estimatedmetadata=true checkPrimaryKeyUnicity='1' table="pgmetadata"."v_schema_list" @@ -3338,7 +3571,7 @@ def my_form_open(dialog, layer, feature): - + @@ -3355,7 +3588,7 @@ def my_form_open(dialog, layer, feature): - + @@ -3365,96 +3598,100 @@ def my_form_open(dialog, layer, feature): postgres - - - - + + + + - + - + + 1 1 1 + 0 - + - - - - + + + + + - - - + + + - - + + - + + - + + - - + + - - + + - - + + - - + + - + - + - + - - - + + - + - + 0 - # -*- coding: utf-8 -*- """ QGIS forms can have a Python function that is called when the form is opened. @@ -3470,26 +3707,27 @@ from qgis.PyQt.QtWidgets import QWidget def my_form_open(dialog, layer, feature): geom = feature.geometry() control = dialog.findChild(QWidget, "MyLineEdit") -]]> + 0 tablayout - + - - + + - - + + - - + + + "schema_name" - + v_table_comment_from_metadata_d6be195f_86d0_4ef6_af4d_d1fef8a4b7f7 service='pgmetadata' sslmode=disable key='table_schema' estimatedmetadata=true checkPrimaryKeyUnicity='1' table="pgmetadata"."v_table_comment_from_metadata" @@ -3516,7 +3754,7 @@ def my_form_open(dialog, layer, feature): dataset View containing the desired formatted comment for the tables listed in the pgmetadata.dataset table. This view is used by the trigger to update the table comment when the dataset item is added or modified - + @@ -3532,129 +3770,134 @@ def my_form_open(dialog, layer, feature): false - + postgres - - - - + + + + - + - + + 1 1 1 + 0 - + - - + + + + - - + - - + + - + - - + - - + - - + - - + - - - - - - + + + + + - - - - - + + + + + - - - - - + + + + + - - - - - + + + + + - + - + - - + + - - + + - + - + 0 - + 0 generatedlayout - - - - + + + + + - + v_table_list_48c78797_5376_47b8_90e0_8c4f8236fa44 service='pgmetadata' sslmode=disable key='id' estimatedmetadata=true checkPrimaryKeyUnicity='1' table="pgmetadata"."v_table_list" @@ -3690,7 +3933,7 @@ def my_form_open(dialog, layer, feature): - + @@ -3707,7 +3950,7 @@ def my_form_open(dialog, layer, feature): - + @@ -3717,115 +3960,119 @@ def my_form_open(dialog, layer, feature): postgres - - - - + + + + - + - + + 1 1 1 + 0 - + - - "schema_name" || '.' || "table_name" - "schema_name" - "schema_name" || '.' || "table_name" - - - - + + + + + + + + - - - + + + - - + + - + + - + + - + + - - - + + + - - - + + + - - - + + + - - - + + + - + - + - + - - - + + - + - + 0 - # -*- coding: utf-8 -*- """ QGIS forms can have a Python function that is called when the form is opened. @@ -3841,29 +4088,30 @@ from qgis.PyQt.QtWidgets import QWidget def my_form_open(dialog, layer, feature): geom = feature.geometry() control = dialog.findChild(QWidget, "MyLineEdit") -]]> + 0 tablayout - - + + - - - + + + - - - + + + - - + + + "schema_name" || '.' || "table_name" - + v_valid_dataset_4e46ef23_a5aa_441f_b21a_92bb573cbdfd service='pgmetadata' sslmode=disable key='schema_name' estimatedmetadata=true checkPrimaryKeyUnicity='1' table="pgmetadata"."v_valid_dataset" @@ -3890,7 +4138,7 @@ def my_form_open(dialog, layer, feature): dataset - + @@ -3906,109 +4154,114 @@ def my_form_open(dialog, layer, feature): false - + postgres - - - - + + + + - + - + + 1 1 1 + 0 - + - - + + + + - - + - - + + - + - - + - - + - - - - + + + - - - + + + - - - + + + - - - + + + - + - + - - + + - - + + - + - + 0 - + 0 generatedlayout - - - - + + + + + - + @@ -4071,13 +4324,13 @@ def my_form_open(dialog, layer, feature): 1 - + - + - - - + + + None @@ -4105,36 +4358,36 @@ def my_form_open(dialog, layer, feature): false - - + + - - + + false - - + + false 5000 - - + + false + + - - + + @@ -4151,18 +4404,18 @@ def my_form_open(dialog, layer, feature): - + mdouchin 2020-10-07T17:29:03 - - - - - - + + + + + + - GEOGCRS["WGS 84",DATUM["World Geodetic System 1984",ELLIPSOID["WGS 84",6378137,298.257223563,LENGTHUNIT["metre",1]]],PRIMEM["Greenwich",0,ANGLEUNIT["degree",0.0174532925199433]],CS[ellipsoidal,2],AXIS["geodetic latitude (Lat)",north,ORDER[1],ANGLEUNIT["degree",0.0174532925199433]],AXIS["geodetic longitude (Lon)",east,ORDER[2],ANGLEUNIT["degree",0.0174532925199433]],USAGE[SCOPE["unknown"],AREA["World"],BBOX[-90,-180,90,180]],ID["EPSG",4326]] + GEOGCRS["WGS 84",ENSEMBLE["World Geodetic System 1984 ensemble",MEMBER["World Geodetic System 1984 (Transit)"],MEMBER["World Geodetic System 1984 (G730)"],MEMBER["World Geodetic System 1984 (G873)"],MEMBER["World Geodetic System 1984 (G1150)"],MEMBER["World Geodetic System 1984 (G1674)"],MEMBER["World Geodetic System 1984 (G1762)"],MEMBER["World Geodetic System 1984 (G2139)"],ELLIPSOID["WGS 84",6378137,298.257223563,LENGTHUNIT["metre",1]],ENSEMBLEACCURACY[2.0]],PRIMEM["Greenwich",0,ANGLEUNIT["degree",0.0174532925199433]],CS[ellipsoidal,2],AXIS["geodetic latitude (Lat)",north,ORDER[1],ANGLEUNIT["degree",0.0174532925199433]],AXIS["geodetic longitude (Lon)",east,ORDER[2],ANGLEUNIT["degree",0.0174532925199433]],USAGE[SCOPE["Horizontal component of 3D system."],AREA["World."],BBOX[-90,-180,90,180]],ID["EPSG",4326]] +proj=longlat +datum=WGS84 +no_defs 3452 4326 @@ -4174,19 +4427,19 @@ def my_form_open(dialog, layer, feature): - + + + + + + + + - + \ No newline at end of file diff --git a/pg_metadata/test/data/install/sql/pgmetadata/20_TABLE_SEQUENCE_DEFAULT.sql b/pg_metadata/test/data/install/sql/pgmetadata/20_TABLE_SEQUENCE_DEFAULT.sql index 49f5b017..c8740326 100755 --- a/pg_metadata/test/data/install/sql/pgmetadata/20_TABLE_SEQUENCE_DEFAULT.sql +++ b/pg_metadata/test/data/install/sql/pgmetadata/20_TABLE_SEQUENCE_DEFAULT.sql @@ -18,8 +18,6 @@ SET row_security = off; SET default_tablespace = ''; -SET default_with_oids = false; - -- contact CREATE TABLE pgmetadata.contact ( id integer NOT NULL, diff --git a/pg_metadata/test/test_resources.py b/pg_metadata/test/test_resources.py index 4522862e..9d011060 100644 --- a/pg_metadata/test/test_resources.py +++ b/pg_metadata/test/test_resources.py @@ -16,18 +16,23 @@ class TestResources(unittest.TestCase): def test_qgis_version(self): """ Test QGIS versions are correct in metadata and provided QGIS version. """ - expected_qgis_version = "3.16" + expected_qgis_version = "3.22" # Test the QGIS project qgis_project = resources_path('projects', 'pg_metadata_administration.qgs') with open(qgis_project, encoding='utf8') as f: - f.readline() first_line = f.readline() self.assertTrue( - 'version="{}'.format(expected_qgis_version) in first_line, 'The QGIS project is wrong.') + f'version="{expected_qgis_version}' in first_line, + f'The QGIS project is wrong, {expected_qgis_version} not found in {first_line}.' + ) # Test the minimum version to match the project config = configparser.ConfigParser() config.read(plugin_path('metadata.txt')) self.assertEqual( - config["general"]["qgisMinimumVersion"], expected_qgis_version, 'The metadata.txt is wrong') + expected_qgis_version, + config["general"]["qgisMinimumVersion"], + f'The metadata.txt is wrong, {expected_qgis_version} not found in ' + f'{config["general"]["qgisMinimumVersion"]}' + ) diff --git a/pg_metadata/test/test_sql.py b/pg_metadata/test/test_sql.py index c0434547..07e7ac89 100644 --- a/pg_metadata/test/test_sql.py +++ b/pg_metadata/test/test_sql.py @@ -358,7 +358,7 @@ def test_trigger_calculate_fields(self): self.assertEqual('LINESTRING', result[0]) self.assertEqual('EPSG:4326', result[1]) coordinates = [f.strip()[0:6] for f in result[2].split(',')] - self.assertListEqual(['3.8540', '3.8969', '43.578', '43.621'], coordinates) + self.assertListEqual(['3.854', '3.897', '43.578', '43.622'], coordinates) # Test date, creation_date is equal to update_date sql = "SELECT creation_date, update_date FROM pgmetadata.dataset" @@ -374,7 +374,7 @@ def test_trigger_calculate_fields(self): self.assertEqual('LINESTRING', result[1]) self.assertEqual('EPSG:4326', result[2]) coordinates = [f.strip()[0:6] for f in result[3].split(',')] - self.assertListEqual(['3.8540', '3.8969', '43.578', '43.621'], coordinates) + self.assertListEqual(['3.854', '3.897', '43.578', '43.622'], coordinates) # Test date, creation_date is not equal to update_date sql = "SELECT creation_date, update_date FROM pgmetadata.dataset" diff --git a/pg_metadata/tools.py b/pg_metadata/tools.py deleted file mode 100644 index cfe01b94..00000000 --- a/pg_metadata/tools.py +++ /dev/null @@ -1,30 +0,0 @@ -__copyright__ = "Copyright 2020, 3Liz" -__license__ = "GPL version 3" -__email__ = "info@3liz.org" - -from qgis.core import QgsLayerItem -from qgis.PyQt.QtCore import NULL -from qgis.PyQt.QtGui import QIcon - -from pg_metadata.qgis_plugin_tools.tools.resources import resources_path - - -def icon_for_geometry_type(geometry_type: str) -> QIcon(): - """ Return the correct icon according to the geometry type. """ - if geometry_type == NULL: - return QgsLayerItem.iconTable() - - elif geometry_type in ('POINT', 'POINTM', 'MULTIPOINT'): - return QgsLayerItem.iconPoint() - - elif geometry_type in ('LINESTRING', 'LINESTRINGM', 'MULTILINESTRING', 'MULTILINESTRINGM'): - return QgsLayerItem.iconLine() - - elif geometry_type in ('POLYGON', 'POLYGONM', 'MULTIPOLYGON', 'MULTIPOLYGONM'): - return QgsLayerItem.iconPolygon() - - elif geometry_type == 'RASTER': - return QgsLayerItem.iconRaster() - - # Default icon - return QIcon(resources_path('icons', 'icon.png'))