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 = ' ' ):
121
+ def __init__ (self , groupDesc , name , label , description , group = 'allParams' , advanced = False , semantic = Semantic . NONE , enabled = True , joinChar = ' ' ):
116
122
"""
117
123
:param groupDesc: the description of the Attributes composing this group
118
124
"""
@@ -211,7 +217,7 @@ def __init__(self, name, label, description, value, uid, group, advanced, semant
211
217
class File (Attribute ):
212
218
"""
213
219
"""
214
- def __init__ (self , name , label , description , value , uid , group = 'allParams' , advanced = False , semantic = '' , enabled = True ):
220
+ def __init__ (self , name , label , description , value , uid , group = 'allParams' , advanced = False , semantic = Semantic . NONE , enabled = True ):
215
221
super (File , self ).__init__ (name = name , label = label , description = description , value = value , uid = uid , group = group , advanced = advanced , semantic = semantic , enabled = enabled )
216
222
217
223
def validateValue (self , value ):
@@ -230,7 +236,7 @@ def checkValueTypes(self):
230
236
class BoolParam (Param ):
231
237
"""
232
238
"""
233
- def __init__ (self , name , label , description , value , uid , group = 'allParams' , advanced = False , semantic = '' , enabled = True ):
239
+ def __init__ (self , name , label , description , value , uid , group = 'allParams' , advanced = False , semantic = Semantic . NONE , enabled = True ):
234
240
super (BoolParam , self ).__init__ (name = name , label = label , description = description , value = value , uid = uid , group = group , advanced = advanced , semantic = semantic , enabled = enabled )
235
241
236
242
def validateValue (self , value ):
@@ -251,7 +257,7 @@ def checkValueTypes(self):
251
257
class IntParam (Param ):
252
258
"""
253
259
"""
254
- def __init__ (self , name , label , description , value , range , uid , group = 'allParams' , advanced = False , semantic = '' , enabled = True ):
260
+ def __init__ (self , name , label , description , value , range , uid , group = 'allParams' , advanced = False , semantic = Semantic . NONE , enabled = True ):
255
261
self ._range = range
256
262
super (IntParam , self ).__init__ (name = name , label = label , description = description , value = value , uid = uid , group = group , advanced = advanced , semantic = semantic , enabled = enabled )
257
263
@@ -273,7 +279,7 @@ def checkValueTypes(self):
273
279
class FloatParam (Param ):
274
280
"""
275
281
"""
276
- def __init__ (self , name , label , description , value , range , uid , group = 'allParams' , advanced = False , semantic = '' , enabled = True ):
282
+ def __init__ (self , name , label , description , value , range , uid , group = 'allParams' , advanced = False , semantic = Semantic . NONE , enabled = True ):
277
283
self ._range = range
278
284
super (FloatParam , self ).__init__ (name = name , label = label , description = description , value = value , uid = uid , group = group , advanced = advanced , semantic = semantic , enabled = enabled )
279
285
@@ -294,7 +300,7 @@ def checkValueTypes(self):
294
300
class ChoiceParam (Param ):
295
301
"""
296
302
"""
297
- def __init__ (self , name , label , description , value , values , exclusive , uid , group = 'allParams' , joinChar = ' ' , advanced = False , semantic = '' , enabled = True ):
303
+ def __init__ (self , name , label , description , value , values , exclusive , uid , group = 'allParams' , joinChar = ' ' , advanced = False , semantic = Semantic . NONE , enabled = True ):
298
304
assert values
299
305
self ._values = values
300
306
self ._exclusive = exclusive
@@ -332,7 +338,7 @@ def checkValueTypes(self):
332
338
class StringParam (Param ):
333
339
"""
334
340
"""
335
- def __init__ (self , name , label , description , value , uid , group = 'allParams' , advanced = False , semantic = '' , enabled = True , uidIgnoreValue = None ):
341
+ def __init__ (self , name , label , description , value , uid , group = 'allParams' , advanced = False , semantic = Semantic . NONE , enabled = True , uidIgnoreValue = None ):
336
342
super (StringParam , self ).__init__ (name = name , label = label , description = description , value = value , uid = uid , group = group , advanced = advanced , semantic = semantic , enabled = enabled ,
337
343
uidIgnoreValue = uidIgnoreValue )
338
344
@@ -350,7 +356,7 @@ def checkValueTypes(self):
350
356
class ColorParam (Param ):
351
357
"""
352
358
"""
353
- def __init__ (self , name , label , description , value , uid , group = 'allParams' , advanced = False , semantic = '' , enabled = True ):
359
+ def __init__ (self , name , label , description , value , uid , group = 'allParams' , advanced = False , semantic = Semantic . NONE , enabled = True ):
354
360
super (ColorParam , self ).__init__ (name = name , label = label , description = description , value = value , uid = uid , group = group , advanced = advanced , semantic = semantic , enabled = enabled )
355
361
356
362
def validateValue (self , value ):
@@ -510,7 +516,7 @@ class Node(object):
510
516
"This is useful for development, we can invalidate the output of the node when we modify the code.\n "
511
517
"It is displayed in bold font in the invalidation/comment messages tooltip." ,
512
518
value = "" ,
513
- semantic = "multiline" ,
519
+ semantic = Semantic . MULTILINE ,
514
520
uid = [0 ],
515
521
advanced = True ,
516
522
uidIgnoreValue = "" , # If the invalidation string is empty, it does not participate to the node's UID
@@ -521,7 +527,7 @@ class Node(object):
521
527
description = "User comments describing this specific node instance.\n "
522
528
"It is displayed in regular font in the invalidation/comment messages tooltip." ,
523
529
value = "" ,
524
- semantic = "multiline" ,
530
+ semantic = Semantic . MULTILINE ,
525
531
uid = [],
526
532
),
527
533
StringParam (
0 commit comments