-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathpySLBL_validation_multiple.py
More file actions
50 lines (39 loc) · 1.49 KB
/
pySLBL_validation_multiple.py
File metadata and controls
50 lines (39 loc) · 1.49 KB
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
38
39
40
41
42
43
44
45
46
47
48
49
50
# -*- coding: utf-8 -*-
"""
Created on Mon Mar 9 14:14:33 2020
@author: Nicolet_Pierrick
"""
import arcpy
import os
class ToolValidator(object):
"""Class for validating a tool's parameter values and controlling
the behavior of the tool's dialog."""
def __init__(self):
"""Setup arcpy and the list of tool parameters."""
self.params = arcpy.GetParameterInfo()
def initializeParameters(self):
"""Refine the properties of a tool's parameters. This method is
called when the tool is opened."""
lst=['4 neighbours, average','8 neighbours, average', '4 neighbours, min/max','8 neighbours, min/max']
self.params[7].filter.list=lst
self.params[7].value = '4 neighbours, average'
lst=['Single value','Auto','Auto min/inter/max']
self.params[2].filter.list=lst
self.params[2].value = 'Single value'
return
def updateParameters(self):
"""Modify the values and properties of parameters before internal
validation is performed. This method is called whenever a parameter
has been changed."""
def updateMessages(self):
"""Modify the messages created by internal validation for each tool
parameter. This method is called after internal validation."""
if self.params[2].value == 'Single value':
self.params[3].enabled = 1
self.params[3].parameterType = 'Required'
else:
self.params[3].enabled = 0
self.params[3].value = ''
self.params[3].parameterType = 'Optional'
self.params[3].clearMessage()
return