10
10
import distutils .util
11
11
import shlex
12
12
13
+ class Semantic (Enum ):
14
+ NONE = ""
15
+ IMAGE = "image"
16
+ MULTILINE = "multiline"
17
+ COLOR_HUE = "color/hue"
18
+
13
19
class Attribute (BaseObject ):
14
20
"""
15
21
"""
@@ -72,7 +78,7 @@ def matchDescription(self, value, strict=True):
72
78
73
79
class ListAttribute (Attribute ):
74
80
""" A list of Attributes """
75
- def __init__ (self , elementDesc , name , label , description , group = 'allParams' , advanced = False , semantic = '' , enabled = True , joinChar = ' ' ):
81
+ def __init__ (self , elementDesc , name , label , description , group = 'allParams' , advanced = False , semantic = Semantic . NONE , enabled = True , joinChar = ' ' ):
76
82
"""
77
83
:param elementDesc: the Attribute description of elements to store in that list
78
84
"""
@@ -112,7 +118,7 @@ def matchDescription(self, value, strict=True):
112
118
113
119
class GroupAttribute (Attribute ):
114
120
""" A macro Attribute composed of several Attributes """
115
- def __init__ (self , groupDesc , name , label , description , group = 'allParams' , advanced = False , semantic = '' , enabled = True , joinChar = ' ' , brackets = None ):
121
+ def __init__ (self , groupDesc , name , label , description , group = 'allParams' , advanced = False , semantic = Semantic . NONE , enabled = True , joinChar = ' ' , brackets = None ):
116
122
"""
117
123
:param groupDesc: the description of the Attributes composing this group
118
124
"""
@@ -213,7 +219,7 @@ def __init__(self, name, label, description, value, uid, group, advanced, semant
213
219
class File (Attribute ):
214
220
"""
215
221
"""
216
- def __init__ (self , name , label , description , value , uid , group = 'allParams' , advanced = False , semantic = '' , enabled = True ):
222
+ def __init__ (self , name , label , description , value , uid , group = 'allParams' , advanced = False , semantic = Semantic . NONE , enabled = True ):
217
223
super (File , self ).__init__ (name = name , label = label , description = description , value = value , uid = uid , group = group , advanced = advanced , semantic = semantic , enabled = enabled )
218
224
219
225
def validateValue (self , value ):
@@ -232,7 +238,7 @@ def checkValueTypes(self):
232
238
class BoolParam (Param ):
233
239
"""
234
240
"""
235
- def __init__ (self , name , label , description , value , uid , group = 'allParams' , advanced = False , semantic = '' , enabled = True ):
241
+ def __init__ (self , name , label , description , value , uid , group = 'allParams' , advanced = False , semantic = Semantic . NONE , enabled = True ):
236
242
super (BoolParam , self ).__init__ (name = name , label = label , description = description , value = value , uid = uid , group = group , advanced = advanced , semantic = semantic , enabled = enabled )
237
243
238
244
def validateValue (self , value ):
@@ -253,7 +259,7 @@ def checkValueTypes(self):
253
259
class IntParam (Param ):
254
260
"""
255
261
"""
256
- def __init__ (self , name , label , description , value , range , uid , group = 'allParams' , advanced = False , semantic = '' , enabled = True ):
262
+ def __init__ (self , name , label , description , value , range , uid , group = 'allParams' , advanced = False , semantic = Semantic . NONE , enabled = True ):
257
263
self ._range = range
258
264
super (IntParam , self ).__init__ (name = name , label = label , description = description , value = value , uid = uid , group = group , advanced = advanced , semantic = semantic , enabled = enabled )
259
265
@@ -275,7 +281,7 @@ def checkValueTypes(self):
275
281
class FloatParam (Param ):
276
282
"""
277
283
"""
278
- def __init__ (self , name , label , description , value , range , uid , group = 'allParams' , advanced = False , semantic = '' , enabled = True ):
284
+ def __init__ (self , name , label , description , value , range , uid , group = 'allParams' , advanced = False , semantic = Semantic . NONE , enabled = True ):
279
285
self ._range = range
280
286
super (FloatParam , self ).__init__ (name = name , label = label , description = description , value = value , uid = uid , group = group , advanced = advanced , semantic = semantic , enabled = enabled )
281
287
@@ -296,7 +302,7 @@ def checkValueTypes(self):
296
302
class ChoiceParam (Param ):
297
303
"""
298
304
"""
299
- def __init__ (self , name , label , description , value , values , exclusive , uid , group = 'allParams' , joinChar = ' ' , advanced = False , semantic = '' , enabled = True ):
305
+ def __init__ (self , name , label , description , value , values , exclusive , uid , group = 'allParams' , joinChar = ' ' , advanced = False , semantic = Semantic . NONE , enabled = True ):
300
306
assert values
301
307
self ._values = values
302
308
self ._exclusive = exclusive
@@ -334,7 +340,7 @@ def checkValueTypes(self):
334
340
class StringParam (Param ):
335
341
"""
336
342
"""
337
- def __init__ (self , name , label , description , value , uid , group = 'allParams' , advanced = False , semantic = '' , enabled = True , uidIgnoreValue = None ):
343
+ def __init__ (self , name , label , description , value , uid , group = 'allParams' , advanced = False , semantic = Semantic . NONE , enabled = True , uidIgnoreValue = None ):
338
344
super (StringParam , self ).__init__ (name = name , label = label , description = description , value = value , uid = uid , group = group , advanced = advanced , semantic = semantic , enabled = enabled ,
339
345
uidIgnoreValue = uidIgnoreValue )
340
346
@@ -352,7 +358,7 @@ def checkValueTypes(self):
352
358
class ColorParam (Param ):
353
359
"""
354
360
"""
355
- def __init__ (self , name , label , description , value , uid , group = 'allParams' , advanced = False , semantic = '' , enabled = True ):
361
+ def __init__ (self , name , label , description , value , uid , group = 'allParams' , advanced = False , semantic = Semantic . NONE , enabled = True ):
356
362
super (ColorParam , self ).__init__ (name = name , label = label , description = description , value = value , uid = uid , group = group , advanced = advanced , semantic = semantic , enabled = enabled )
357
363
358
364
def validateValue (self , value ):
@@ -512,7 +518,7 @@ class Node(object):
512
518
"This is useful for development, we can invalidate the output of the node when we modify the code.\n "
513
519
"It is displayed in bold font in the invalidation/comment messages tooltip." ,
514
520
value = "" ,
515
- semantic = "multiline" ,
521
+ semantic = Semantic . MULTILINE ,
516
522
uid = [0 ],
517
523
advanced = True ,
518
524
uidIgnoreValue = "" , # If the invalidation string is empty, it does not participate to the node's UID
@@ -523,7 +529,7 @@ class Node(object):
523
529
description = "User comments describing this specific node instance.\n "
524
530
"It is displayed in regular font in the invalidation/comment messages tooltip." ,
525
531
value = "" ,
526
- semantic = "multiline" ,
532
+ semantic = Semantic . MULTILINE ,
527
533
uid = [],
528
534
),
529
535
StringParam (
0 commit comments