File tree 1 file changed +15
-12
lines changed
1 file changed +15
-12
lines changed Original file line number Diff line number Diff line change @@ -44,23 +44,26 @@ def load_user_expressions(path):
44
44
if not os .path .exists (initfile ):
45
45
open (initfile , "w" ).close ()
46
46
47
+ template = """\" \" \"
48
+ Define new functions using @qgsfunction. feature and parent must always be the
49
+ last args. Use args=-1 to pass a list of values as arguments
50
+ \" \" \"
51
+
52
+ from qgis.core import *
53
+ from qgis.gui import *
54
+
55
+ @qgsfunction(args='auto', group='Custom')
56
+ def func(value1, feature, parent):
57
+ return value1
58
+ """
59
+
60
+
47
61
try :
48
62
import expressions
49
63
50
64
expressions .load = load_user_expressions
51
65
expressions .load (expressionspath )
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
- \" \" \"
56
-
57
- from qgis.core import *
58
- from qgis.gui import *
59
-
60
- @qgsfunction(args='auto', group='Custom')
61
- def func(value1, feature, parent):
62
- return value1
63
- """
66
+ expressions .template = template
64
67
except ImportError :
65
68
# We get a import error and crash for some reason even if we make the expressions package
66
69
# TODO Fix the crash on first load with no expressions folder
You can’t perform that action at this time.
0 commit comments