def initAlgorithm(self, config): label = tr("Connexion PostgreSQL vers la base de données") tooltip = tr("Base de données de destination") if Qgis.QGIS_VERSION_INT >= 31400: param = QgsProcessingParameterProviderConnection( self.DATABASE, label, "postgres", optional=False, ) else: param = QgsProcessingParameterString(self.DATABASE, label) param.setMetadata( { "widget_wrapper": { "class": "processing.gui.wrappers_postgis.ConnectionWidgetWrapper" } } ) if Qgis.QGIS_VERSION_INT >= 31600: param.setHelp(tooltip) else: param.tooltip_3liz = tooltip self.addParameter(param) label = tr("Schéma") tooltip = 'Nom du schéma pour chercher les couches' default = 'veloroutes' if Qgis.QGIS_VERSION_INT >= 31400: param = QgsProcessingParameterDatabaseSchema( self.SCHEMA, label, self.DATABASE, defaultValue=default, optional=False, ) else: param = QgsProcessingParameterString(self.SCHEMA, label, default, False, True) param.setMetadata( { "widget_wrapper": { "class": "processing.gui.wrappers_postgis.SchemaWidgetWrapper", "connection_param": self.DATABASE, } } ) if Qgis.QGIS_VERSION_INT >= 31600: param.setHelp(tooltip) else: param.tooltip_3liz = tooltip self.addParameter(param) # OUTPUTS output = QgsProcessingOutputString(self.OUTPUT_MSG, tr("Message de sortie")) output.tooltip_3liz = output.description() self.addOutput(output) output = QgsProcessingOutputMultipleLayers(self.OUTPUT, tr("Couches dont le style a été modifié")) output.tooltip_3liz = 'Les différentes couches de l\'extension véloroutes et voies vertes' self.addOutput(output)
def add_bottom_parameters(self): param = QgsProcessingParameterNumber(self.TIMEOUT, tr('Timeout'), defaultValue=25, minValue=5) param.setFlags(param.flags() | QgsProcessingParameterDefinition.FlagAdvanced) help_string = tr('The timeout to use for the Overpass API.') if Qgis.QGIS_VERSION_INT >= 31500: param.setHelp(help_string) else: param.tooltip_3liz = help_string self.addParameter(param) server = get_setting('defaultOAPI', OVERPASS_SERVERS[0]) + 'interpreter' param = QgsProcessingParameterString(self.SERVER, tr('Overpass server'), optional=False, defaultValue=server) param.setFlags(param.flags() | QgsProcessingParameterDefinition.FlagAdvanced) help_string = tr( 'The Overpass API server to use to build the encoded URL.') if Qgis.QGIS_VERSION_INT >= 31500: param.setHelp(help_string) else: param.tooltip_3liz = help_string self.addParameter(param) output = QgsProcessingOutputString(self.OUTPUT_URL, tr('Query as encoded URL')) help_string = tr( 'The query is generated and encoded with the Overpass API URL. This output should be used in the ' 'File Downloader algorithm.') if Qgis.QGIS_VERSION_INT >= 31500: pass # output.setHelp(help_string) else: output.tooltip_3liz = help_string self.addOutput(output) output = QgsProcessingOutputString(self.OUTPUT_OQL_QUERY, tr('Raw query as OQL')) help_string = tr('The query is generated in the OQL format.') if Qgis.QGIS_VERSION_INT >= 31500: pass # output.setHelp(help_string) else: output.tooltip_3liz = help_string self.addOutput(output)
def initAlgorithm(self, config): # INPUTS parameter = QgsProcessingParameterString( self.INPUT, "Champ qui ne sert à rien !", optional=True ) parameter.setFlags( parameter.flags() | QgsProcessingParameterDefinition.FlagHidden ) self.addParameter(parameter) # OUTPUTS output = QgsProcessingOutputString(self.OUTPUT_MSG, tr("Message de sortie")) output.tooltip_3liz = output.description() self.addOutput(output)