| 1 | class PDStringSelector: |
| 2 | @classmethod |
| 3 | def INPUT_TYPES(cls): |
| 4 | return { |
| 5 | "required": { |
| 6 | "aspect_ratio": ("STRING", {"default": "2:3"}), |
| 7 | "2:3": ("STRING", {"default": "768"}), |
| 8 | "1:1": ("STRING", {"default": "680"}), |
| 9 | "3:2": ("STRING", {"default": "1024"}), |
| 10 | } |
| 11 | } |
| 12 | |
| 13 | RETURN_TYPES = ("STRING", "INT") |
| 14 | RETURN_NAMES = ("string", "int") |
| 15 | FUNCTION = "select_value" |
| 16 | CATEGORY = "PDuse/Text" |
| 17 | |
| 18 | def select_value(self, aspect_ratio, **values): |
| 19 | ratio = aspect_ratio.strip() |
| 20 | if ratio not in values: |
| 21 | ratio = "2:3" |
| 22 | value = str(values[ratio]).strip() |
| 23 | return (value, int(float(value))) |
| 24 | |
| 25 | |
| 26 | NODE_CLASS_MAPPINGS = { |
nothing calls this directly
no outgoing calls
no test coverage detected