diff --git a/README.md b/README.md index 4c25c6b..0ce0e8d 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Scroll Over Textarea +# ComfyUI Scroll Over Textarea A ComfyUI extension to allow textarea elements to be scrolled over. Useful when using a trackpad in order to prevent accidental forward/back navigation (two fingers horizontally on a Mac) when scrolling around the UI. diff --git a/pyproject.toml b/pyproject.toml index 7841a92..649ac8f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -33,7 +33,7 @@ homepage = "https://github.com/joreyaesh/comfyui_scroll_over_textarea" [tool.comfy] PublisherId = "joreyaesh" -DisplayName = "Scroll Over Textarea" +DisplayName = "ComfyUI Scroll Over Textarea" Icon = "" [tool.setuptools.package-data] diff --git a/src/comfyui_scroll_over_textarea/nodes.py b/src/comfyui_scroll_over_textarea/nodes.py index bcf0e9b..d612f24 100644 --- a/src/comfyui_scroll_over_textarea/nodes.py +++ b/src/comfyui_scroll_over_textarea/nodes.py @@ -1,9 +1,9 @@ from inspect import cleandoc -class Example: +class ScrollOverTextareaDummyNode: """ - A example node + An empty dummy node since this has changes only for the UI. Class methods ------------- @@ -50,42 +50,9 @@ class Example: + First value is a string indicate the type of field or a list for selection. + Secound value is a config for type "INT", "STRING" or "FLOAT". """ - return { - "required": { - "image": ("Image", {"tooltip": "This is an image"}), - "int_field": ( - "INT", - { - "default": 0, - "min": 0, # Minimum value - "max": 4096, # Maximum value - "step": 64, # Slider's step - "display": "number", # Cosmetic only: display as "number" or "slider" - }, - ), - "float_field": ( - "FLOAT", - { - "default": 1.0, - "min": 0.0, - "max": 10.0, - "step": 0.01, - "round": 0.001, # The value represeting the precision to round to, will be set to the step value by default. Can be set to False to disable rounding. - "display": "number", - }, - ), - "print_to_screen": (["enable", "disable"],), - "string_field": ( - "STRING", - { - "multiline": False, # True if you want the field to look like the one on the ClipTextEncode node - "default": "Hello World!", - }, - ), - }, - } + return {} - RETURN_TYPES = ("IMAGE",) + RETURN_TYPES = () # RETURN_NAMES = ("image_output_name",) DESCRIPTION = cleandoc(__doc__) FUNCTION = "test" @@ -93,41 +60,15 @@ class Example: # OUTPUT_NODE = False # OUTPUT_TOOLTIPS = ("",) # Tooltips for the output node - CATEGORY = "Example" + CATEGORY = "Dummy" - def test(self, image, string_field, int_field, float_field, print_to_screen): - if print_to_screen == "enable": - print( - f"""Your input contains: - string_field aka input text: {string_field} - int_field: {int_field} - float_field: {float_field} - """ - ) - # do some processing on the image, in this example I just invert it - image = 1.0 - image - return (image,) - - """ - The node will always be re executed if any of the inputs change but - this method can be used to force the node to execute again even when the inputs don't change. - You can make this node return a number or a string. This value will be compared to the one returned the last time the node was - executed, if it is different the node will be executed again. - This method is used in the core repo for the LoadImage node where they return the image hash as a string, if the image hash - changes between executions the LoadImage node is executed again. - """ - # @classmethod - # def IS_CHANGED(s, image, string_field, int_field, float_field, print_to_screen): - # return "" + def test(self): + return () # A dictionary that contains all nodes you want to export with their names # NOTE: names should be globally unique -NODE_CLASS_MAPPINGS = { - # "Example": Example -} +NODE_CLASS_MAPPINGS = {"ScrollOverTextareaDummyNode": ScrollOverTextareaDummyNode} # A dictionary that contains the friendly/humanly readable titles for the nodes -NODE_DISPLAY_NAME_MAPPINGS = { - # "Example": "Example Node" -} +NODE_DISPLAY_NAME_MAPPINGS = {"ScrollOverTextareaDummyNode": "Scroll Over Textarea"} diff --git a/tests/test_comfyui_scroll_over_textarea.py b/tests/test_comfyui_scroll_over_textarea.py index 830f6c5..70ce7a6 100644 --- a/tests/test_comfyui_scroll_over_textarea.py +++ b/tests/test_comfyui_scroll_over_textarea.py @@ -3,22 +3,22 @@ """Tests for `comfyui_scroll_over_textarea` package.""" import pytest -from src.comfyui_scroll_over_textarea.nodes import Example +from src.comfyui_scroll_over_textarea.nodes import ScrollOverTextareaDummyNode @pytest.fixture def example_node(): """Fixture to create an Example node instance.""" - return Example() + return ScrollOverTextareaDummyNode() def test_example_node_initialization(example_node): """Test that the node can be instantiated.""" - assert isinstance(example_node, Example) + assert isinstance(example_node, ScrollOverTextareaDummyNode) def test_return_types(): """Test the node's metadata.""" - assert Example.RETURN_TYPES == ("IMAGE",) - assert Example.FUNCTION == "test" - assert Example.CATEGORY == "Example" + assert ScrollOverTextareaDummyNode.RETURN_TYPES == ("IMAGE",) + assert ScrollOverTextareaDummyNode.FUNCTION == "test" + assert ScrollOverTextareaDummyNode.CATEGORY == "Example" diff --git a/web/js/comfyui_scroll_over_textarea.js b/web/js/comfyui_scroll_over_textarea.js index ec96aa5..8b47ad5 100644 --- a/web/js/comfyui_scroll_over_textarea.js +++ b/web/js/comfyui_scroll_over_textarea.js @@ -1,7 +1,7 @@ import { app } from '../../../scripts/app.js'; app.registerExtension({ - name: 'Scroll Over Textarea', + name: 'ComfyUI Scroll Over Textarea', settings: [ { id: 'comfyui_scroll_over_textarea.enable', @@ -14,7 +14,7 @@ app.registerExtension({ }, ], async setup() { - console.log('Scroll Over Textarea Extension Loaded'); + console.log('ComfyUI Scroll Over Textarea Extension Loaded'); const cb = (event) => { app.canvas.processMouseWheel(event); event.preventDefault();