Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow to install manager on install page #173

Merged
merged 4 commits into from
Nov 5, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions install_comfyui_manager.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import os
PladsElsker marked this conversation as resolved.
Show resolved Hide resolved
import sys


default_install_location = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'ComfyUI', 'custom_nodes', 'ComfyUI-Manager')


def main(install_location):
import git
git_repo_url = 'https://github.com/ltdrdata/ComfyUI-Manager.git'
os.mkdir(install_location)
git.Repo.clone_from(git_repo_url, install_location)


if __name__ == '__main__':
install_location = default_install_location
if len(sys.argv) > 1:
inistall_location = sys.argv[1]

main(install_location)
16 changes: 12 additions & 4 deletions lib_comfyui/webui/tab.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import textwrap
import gradio as gr
import install_comfyui
import install_comfyui_manager
from lib_comfyui import external_code, ipc
from lib_comfyui.webui import settings, gradio_utils
from lib_comfyui.default_workflow_types import sandbox_tab_workflow_type
Expand All @@ -24,6 +25,9 @@ def create_tab():
gr.Markdown(comfyui_install_instructions_markdown)

with gr.Column():
with gr.Row():
install_manager = gr.Checkbox(label='Install with ComfyUI-Manager', value=True)

with gr.Row():
install_path = gr.Textbox(placeholder=f'Leave empty to install at {install_comfyui.default_install_location}', label='Installation path')

Expand All @@ -33,7 +37,7 @@ def create_tab():
with gr.Row():
installed_feedback = gr.Markdown()

install_button.click(automatic_install_comfyui, inputs=[install_path], outputs=[installed_feedback], show_progress=True)
install_button.click(automatic_install_comfyui, inputs=[install_manager, install_path], outputs=[installed_feedback], show_progress=True)

gradio_utils.ExtensionDynamicProperty(
key='workflow_type_ids',
Expand All @@ -44,7 +48,7 @@ def create_tab():


@ipc.restrict_to_process('webui')
def automatic_install_comfyui(install_location):
def automatic_install_comfyui(should_install_manager, install_location):
from modules import shared
install_location = install_location.strip()
if not install_location:
Expand All @@ -58,6 +62,10 @@ def automatic_install_comfyui(install_location):
install_comfyui.main(install_location)
shared.opts.comfyui_install_location = install_location

if should_install_manager:
manager_install_location = os.path.join(install_location, 'custom_nodes', 'ComfyUI-Manager')
PladsElsker marked this conversation as resolved.
Show resolved Hide resolved
install_comfyui_manager.main(manager_install_location)

return gr.Markdown.update('Installed! Now please reload the UI.')


Expand All @@ -68,10 +76,10 @@ def can_install_at(path):

comfyui_install_instructions_markdown = '''
## ComfyUI extension
It looks like your ComfyUI installation isn't set up yet!
It looks like your ComfyUI installation isn't set up yet.
If you already have ComfyUI installed on your computer, go to `Settings > ComfyUI`, and set the proper install location.

Alternatively, if you don't have ComfyUI installed, you can install it with this button:
Alternatively, if you don't have ComfyUI installed, you can install it here:
'''


Expand Down