From 2dfaed096917fbbf505b66490e074ab8af9f9866 Mon Sep 17 00:00:00 2001 From: Nuked Date: Fri, 26 Apr 2024 10:58:01 +0200 Subject: [PATCH] - added new shortcut for settings - changed min of node size to 0 - updated readme --- README.md | 2 ++ __init__.py | 19 ++++++++++++++++++- app/js/functions/settings.js | 15 +++++++-------- app/js/functions/utils.js | 6 ++++++ app/js/sidebar_node.js | 3 +++ 5 files changed, 36 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index c4c898c..e90cd72 100644 --- a/README.md +++ b/README.md @@ -41,6 +41,7 @@ Maybe you don't need it. I need it >.< to your ComfyUI `custom_nodes` directory 2. Enjoy! +NOTE: If you choose to use a different method to install the ComfyUI-N-Sidebar, please ensure that you rename the folder to `ComfyUI-N-Sidebar`. # Uninstall - Delete the `ComfyUI-N-Sidebar` folder in `custom_nodes` @@ -54,6 +55,7 @@ to your ComfyUI `custom_nodes` directory - `Alt+Z` to toggle show/hide sidebar - `Alt+X` to focus on the search field +- `Alt+G` to open the settings # Features diff --git a/__init__.py b/__init__.py index c547a65..300c7b9 100644 --- a/__init__.py +++ b/__init__.py @@ -50,6 +50,23 @@ class JSONConfigManager: self.data[parameter_name] = value self.write_json_file() + +# If is different from ComfyUISidebar, change it +if __package__ != "ComfyUI-N-Sidebar": + RED = "\033[31m" + END = '\33[0m' + print(f"{RED}!!!{END}") + print(f"{RED}!!!{END}") + print(f"{RED}WARNING:'{__package__}' folder name is WRONG!!! Please rename it 'ComfyUI-N-Sidebar'.{END}") + print(f"{RED}!!!{END}") + print(f"{RED}!!!{END}") +else: + print("ComfyUI-N-Sidebar is loading...") + + + + + file_path = os.path.join(folder_paths.get_folder_paths("custom_nodes")[0],"ComfyUI-N-Sidebar","app","settings.json") @@ -57,7 +74,7 @@ config_manager = JSONConfigManager(file_path) NODE_CLASS_MAPPINGS = {} NODE_DISPLAY_NAME_MAPPINGS = {} -print(folder_paths.get_folder_paths("custom_nodes")) + list_panels = os.path.join(folder_paths.get_folder_paths("custom_nodes")[0],"ComfyUI-N-Sidebar","app","panels") list_panels_array = [] diff --git a/app/js/functions/settings.js b/app/js/functions/settings.js index d93c3bf..6df7ff7 100644 --- a/app/js/functions/settings.js +++ b/app/js/functions/settings.js @@ -139,7 +139,7 @@ function settingsSetup(app,$el) { defaultValue: "10", type: "slider", attrs: { - min: 2, + min: 0, max: 40, step: 1, }, @@ -170,7 +170,7 @@ function settingsSetup(app,$el) { type: "slider", attrs: { min: 0, - max: 300, + max: 500, step: 1, }, onChange(value) { @@ -307,16 +307,15 @@ function settingsSetup(app,$el) { }); + + + const switch_settings = document.getElementById("switch_settings"); - const sb_modal_backdrop = document.getElementById("sb-modal-backdrop-settings"); + const sb_modal_backdrop = document.getElementById("sb-modal-backdrop-settings"); switch_settings.addEventListener('click', function() { //set sb-settingsDiv visible - - const sb_settingsDiv = document.getElementById("sb_settingsDiv"); - - sb_settingsDiv.classList.remove('sb_hidden'); - sb_modal_backdrop.classList.remove('sb_hidden'); + showSettings(); }) document.body.addEventListener('click', function(event) { diff --git a/app/js/functions/utils.js b/app/js/functions/utils.js index 9d8800c..4f6f0ae 100644 --- a/app/js/functions/utils.js +++ b/app/js/functions/utils.js @@ -504,3 +504,9 @@ document.body.addEventListener('click', function(event) { +function showSettings() { + const sb_settingsDiv = document.getElementById("sb_settingsDiv"); + const sb_modal_backdrop = document.getElementById("sb-modal-backdrop-settings"); + sb_settingsDiv.classList.remove('sb_hidden'); + sb_modal_backdrop.classList.remove('sb_hidden'); +} \ No newline at end of file diff --git a/app/js/sidebar_node.js b/app/js/sidebar_node.js index 4bf5014..b13e02f 100644 --- a/app/js/sidebar_node.js +++ b/app/js/sidebar_node.js @@ -919,6 +919,9 @@ function handleKeyPress(event) { if (event.altKey && event.key.toLowerCase() === "z") { toggleSHSB() } + if (event.altKey && event.key.toLowerCase() === "g") { + showSettings() + } }