-
Notifications
You must be signed in to change notification settings - Fork 3
/
read_widget.py
28 lines (26 loc) · 930 Bytes
/
read_widget.py
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
class ReadWidget:
CATEGORY = "quicknodes"
@classmethod
def INPUT_TYPES(s):
return { "required": {
"node": ("INT", {"default":0}),
"widget": ("STRING", {"default":""}),
"if_absent":("STRING",{"default":"not found"})
},
"hidden" : {
"prompt":"PROMPT"
} }
RETURN_TYPES = ("STRING",)
RETURN_NAMES = ("text",)
FUNCTION = "func"
def func(self, node, widget, if_absent, prompt):
try:
w = prompt[str(node)]['inputs'][widget]
w = f"{w}" if not isinstance(w,list) else f"{widget} in an input on #{node}"
except:
w = if_absent
return (w,)
@classmethod
def IS_CHANGED(self, node, widget, if_absent, prompt):
return self.func(node, widget, if_absent, prompt)[0]
CLAZZES = [ReadWidget]