Téléverser les fichiers vers "CenRa_Metabase"

This commit is contained in:
Tom LAVEILLE 2024-10-07 17:16:57 +02:00
parent 8ee1d6d888
commit 7b6e77d17e
3 changed files with 273 additions and 252 deletions

View File

@ -8,6 +8,10 @@ from qgis.PyQt.QtCore import QCoreApplication, Qt, QTranslator, QUrl
from qgis.PyQt.QtGui import QDesktopServices, QIcon
from qgis.PyQt.QtWidgets import QAction, QMessageBox
from qgis.utils import iface
import qgis
#include <QSettings>
'''
from pg_metadata.connection_manager import (
store_connections,
@ -19,17 +23,20 @@ from pg_metadata.locator import LocatorFilter
from pg_metadata.processing.provider import PgMetadataProvider
from pg_metadata.qgis_plugin_tools.tools.custom_logging import setup_logger
'''
from CenRa_Metabase.resources.i18n import setup_translation, tr
import os
from CenRa_Metabase.resources.resources import (
from .tools.resources import (
plugin_path,
resources_path,
maj_verif,
)
from CenRa_Metabase.dock import CenRa_Metabase
from CenRa_Metabase.editor import Metabase_Editor
from .dock import CenRa_Metabase
from .editor import Metabase_Editor
from .about_form import MetabaseAboutDialog
#from CenRa_Metabase.issues import CenRa_Issues
from PyQt5.QtCore import *
class PgMetadata:
def __init__(self):
@ -46,15 +53,24 @@ class PgMetadata:
global NAME
NAME = plugin_dir[end_find:]
maj_verif(NAME)
# Display About window on first use
version = qgis.utils.pluginMetadata('CenRa_METABASE','version')
s = QSettings()
versionUse = s.value("metadata/version", 1, type=str)
if str(versionUse) != str(version) :
s.setValue("metadata/version", str(version))
print(versionUse,version)
self.open_about_dialog()
# setup_logger('pg_metadata')
locale, file_path = setup_translation(
folder=plugin_path("i18n"), file_pattern="CenRa_Metabase_{}.qm")
if file_path:
self.translator = QTranslator()
self.translator.load(file_path)
#locale, file_path = setup_translation(
# folder=plugin_path("i18n"), file_pattern="CenRa_Metabase_{}.qm")
#if file_path:
# self.translator = QTranslator()
# self.translator.load(file_path)
# noinspection PyCallByClass,PyArgumentList
QCoreApplication.installTranslator(self.translator)
# QCoreApplication.installTranslator(self.translator)
# noinspection PyPep8Naming
#def initProcessing(self):
@ -136,7 +152,12 @@ class PgMetadata:
if clicked == QMessageBox.No:
iface.messageBar().pushInfo('PgMetadata', tr(f'Keeping {n_invalid} invalid connections.'))
'''
def open_about_dialog(self):
"""
About dialog
"""
dialog = MetabaseAboutDialog(iface)
dialog.exec_()
def open_help():
""" Open the online help. """
QDesktopServices.openUrl(QUrl('https://plateformesig.cenra-outils.org/'))
@ -157,7 +178,7 @@ class PgMetadata:
def unload(self):
""" Unload the plugin. """
if self.editor:
iface.removePluginMenu(tr('CenRa_Metabase'),self.editor_action)
iface.removePluginMenu('CenRa_Metabase',self.editor_action)
#self.editor.removeToolBarIcon(self.editor_action)

View File

@ -18,6 +18,7 @@ from qgis.core import (
QgsSettings,
QgsVectorLayer,
QgsGeometry,
QgsWkbTypes,
)
from qgis.PyQt.QtCore import QLocale, QUrl, QDateTime
from qgis.PyQt.QtGui import QDesktopServices, QIcon
@ -35,15 +36,14 @@ from qgis.PyQt.QtWidgets import (
QTableWidgetItem,
)
from qgis.utils import iface
from CenRa_Metabase.resources.i18n import tr
from CenRa_Metabase.resources.resources import (
from .tools.resources import (
load_ui,
resources_path,
login_base,
send_issues,
)
from CenRa_Metabase.issues import CenRa_Issues
from .issues import CenRa_Issues
EDITOR_CLASS = load_ui('CenRa_Metabase_editorwidget_base.ui')
LOGGER = logging.getLogger('CenRa_Metabase')
@ -55,7 +55,6 @@ class Metabase_Editor(QDialog, EDITOR_CLASS):
super().__init__()
self.setupUi(self)
self.settings = QgsSettings()
self.import_xml.setAutoRaise(True)
self.import_xml.setText('')
self.import_xml.setIcon(QIcon(QgsApplication.iconPath('mActionAddHtml.svg')))
@ -207,6 +206,7 @@ class Metabase_Editor(QDialog, EDITOR_CLASS):
iface.layerTreeView().setCurrentLayer(layer)
def raise_(self):
self.activateWindow()
global layer
layer = iface.activeLayer()
global uid_delete_list_link,uid_delete_list_contact,array_link,array_contact
@ -354,7 +354,7 @@ class Metabase_Editor(QDialog, EDITOR_CLASS):
if qgstype != 'Raster' :
count_layers = str(layer.featureCount())
geomtype = str(layer.wkbType())[8:]
geomtype = QgsWkbTypes.displayString(layer.wkbType())
elif qgstype == 'Raster':
count_layers = str(layer.dataProvider().bandCount())
geomtype = qgstype

View File

@ -5,8 +5,8 @@
[general]
name=CenRa_Metabase
qgisMinimumVersion=3.0
description=CenRa_Metabase
version=1.0
description=CenRa_METABASE
version=1.2
author=Conservatoire d'Espaces Naturels de Rhône-Alpes
email=si_besoin@cen-rhonealpes.fr
@ -21,7 +21,7 @@ tracker=https://gitea.cenra-outils.org/api/v1/repos/CEN-RA/Plugin_QGIS/issues
hasProcessingProvider=no
# Uncomment the following line and add your changelog:
# changelog=
changelog=<h2>CenRa_Metabase:</h2></br><p><h3>07/10/2024 - Version 1.2: </h3> - Correctif de bug.</p></br><p><h3>03/10/2024 - Version 1.1: </h3> - Remonte la fênetre dans la pille.</p></br><p><h3>26/08/2024 - Version 1.0: </h3> - Lancement du plugin CenRa_Metabase </p></br>
# Tags are comma separated with spaces allowed
tags=python