File: v_transform.py

package info (click to toggle)
qgis 3.40.14%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,185,400 kB
  • sloc: cpp: 1,616,418; python: 372,869; xml: 23,474; sh: 3,761; perl: 3,664; ansic: 2,829; sql: 2,137; yacc: 1,068; lex: 577; javascript: 540; lisp: 411; makefile: 155
file content (37 lines) | stat: -rw-r--r-- 1,668 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
"""
***************************************************************************
    v_transform.py
    ----------
    Date                 : February 2024
    Copyright            : (C) 2024 by Andrea Giudiceandrea
    Email                : andreaerdna at libero dot it
***************************************************************************
*                                                                         *
*   This program is free software; you can redistribute it and/or modify  *
*   it under the terms of the GNU General Public License as published by  *
*   the Free Software Foundation; either version 2 of the License, or     *
*   any later version.                                                    *
*                                                                         *
***************************************************************************
"""

__author__ = "Andrea Giudiceandrea"
__date__ = "February 2024"
__copyright__ = "(C) 2024, Andrea Giudiceandrea"

from qgis.PyQt.QtCore import QCoreApplication


def checkParameterValuesBeforeExecuting(alg, parameters, context):
    """Verify if we have the right parameters"""
    # -w, -x and -y parameters are mutually exclusive
    w = alg.parameterAsBoolean(parameters, "-w", context)
    x = alg.parameterAsBoolean(parameters, "-x", context)
    y = alg.parameterAsBoolean(parameters, "-y", context)
    if sum([w, x, y]) > 1:
        return False, QCoreApplication.translate(
            "GrassAlgorithmExt",
            "The 'Swap coordinates' parameters -w, -x and -y are mutually exclusive. You need to set either none or only one of them!",
        )

    return True, None