user.patch

QGIS/python/user.py - Kristian Evers, 2015-07-03 02:25 AM

Download (1.05 KB)

View differences:

user_new.py Fri Jul 3 09:16:17 2015
50 50
    expressions.load = load_user_expressions
51 51
    expressions.load(expressionspath)
52 52
    expressions.template = """\"\"\"
53
    Define new functions using @qgsfunction. feature and parent must always be the
54
    last args. Use args=-1 to pass a list of values as arguments
55
    \"\"\"
53
Define new functions using @qgsfunction. feature and parent must always be the
54
last args. Use args=-1 to pass a list of values as arguments
55
\"\"\"
56 56

  
57
    from qgis.core import *
58
    from qgis.gui import *
57
from qgis.core import *
58
from qgis.gui import *
59 59

  
60
    @qgsfunction(args='auto', group='Custom')
61
    def func(value1, feature, parent):
62
        return value1
63
    """
60
@qgsfunction(args='auto', group='Custom')
61
def func(value1, feature, parent):
62
    return value1
63
"""
64 64
except ImportError:
65 65
    # We get a import error and crash for some reason even if we make the expressions package
66 66
    # TODO Fix the crash on first load with no expressions folder