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

Disable callbacks when extension is disabled #661

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

adieyal
Copy link
Owner

@adieyal adieyal commented Nov 5, 2023

Ensure that callbacks (apart from settings and wildcards manager), only run when dynamic prompts is enabled. This builds on #648

@adieyal adieyal requested a review from akx November 5, 2023 21:42
@adieyal adieyal changed the title Bug/initialize properties before exit Disable callbacks when extension is disabled Nov 6, 2023
Copy link
Collaborator

@akx akx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd probably call the variable script_protocol just script for brevity – or maybe both the type name and the variable should be e.g. SDDPScript and sddp?

@adieyal
Copy link
Owner Author

adieyal commented Nov 6, 2023

and keep the module name the same? script_protocol? or change it to sddp_script?

@adieyal adieyal force-pushed the bug/initialize-properties-before-exit branch from 29d47bc to 5ef7740 Compare November 6, 2023 07:27
@akx
Copy link
Collaborator

akx commented Nov 6, 2023

Now that I think of it, I'm not sure the protocol is actually required at all – couldn't we just use the actual script object as a type (guarded against circular imports)?

if TYPE_CHECKING:
    from dynamic_prompts.dynamic_prompting import Script as SDDPScript

@adieyal
Copy link
Owner Author

adieyal commented Nov 6, 2023

Now that I think of it, I'm not sure the protocol is actually required at all – couldn't we just use the actual script object as a type (guarded against circular imports)?

if TYPE_CHECKING:
    from dynamic_prompts.dynamic_prompting import Script as SDDPScript

Happy to do that too. I'll make the change.

Ensure that callbacks (apart from settings and wildcards manager), only run when dynamic prompts is enabled. This builds on #648
@adieyal adieyal force-pushed the bug/initialize-properties-before-exit branch from 5ef7740 to 6b5016c Compare November 8, 2023 23:01
Copy link
Collaborator

@akx akx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably one mis-import there?

from sd_dynamic_prompts.settings import on_ui_settings
from sd_dynamic_prompts.wildcards_tab import initialize as initialize_wildcards_tab

if TYPE_CHECKING:
from sd_dynamic_prompts.sddp_script import SDDPScript
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
from sd_dynamic_prompts.sddp_script import SDDPScript
from sd_dynamic_prompts.dynamic_prompting import Script as SDDPScript

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants