コード例 #1
0
def test_parameter_abstract():

    helpstr = """
      This is a help text.
      It must appears in the 'abstract' field of
      wps 
    """

    title = "Parameter with help"

    param = QgsProcessingParameterNumber(
        "TEST",
        title,
        type=QgsProcessingParameterNumber.Integer,
        minValue=1,
        defaultValue=10)

    param.setHelp(helpstr)

    inp = parse_input_definition(param)

    assert isinstance(inp, LiteralInput)
    assert inp.identifier == "TEST"
    assert inp.title == title
    assert inp.abstract == helpstr
コード例 #2
0
ファイル: build_input.py プロジェクト: Gustry/QuickOSM
    def add_top_parameters(self):
        """Set up the parameter."""
        super().add_top_parameters()

        param = QgsProcessingParameterNumber(
            self.DISTANCE, tr('Distance (meters)'), defaultValue=1000, minValue=1)
        help_string = tr(
            'The distance to use when doing the buffering around the named area. '
            'The distance must be in meters.'
        )
        param.setHelp(help_string)
        self.addParameter(param)
コード例 #3
0
    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)
コード例 #4
0
def test_input_title():
    input_title = "This is the title"
    input_abstract = "This is the input abstract"
    param = QgsProcessingParameterNumber(
        "Input_title",
        description=input_title,
        type=QgsProcessingParameterNumber.Integer,
        minValue=1,
        defaultValue=10)

    param.setHelp(input_abstract)

    inp = parse_input_definition(param)

    assert inp.title == input_title
    assert inp.abstract == input_abstract
コード例 #5
0
ファイル: build_input.py プロジェクト: Gustry/QuickOSM
    def add_bottom_parameters(self):
        """Set up the advanced parameters."""
        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.')
        param.setHelp(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.')
        param.setHelp(help_string)
        self.addParameter(param)